Update to latest armory
This commit is contained in:
+5
-8
@@ -25,8 +25,6 @@ class App extends iron.Trait {
|
||||
public static var path = '/';
|
||||
static var modalW = 625;
|
||||
static var modalH = 545;
|
||||
static var lastW = -1;
|
||||
static var lastH = -1;
|
||||
static var appx = 0;
|
||||
|
||||
public static function getEnumTexts():Array<String> {
|
||||
@@ -41,6 +39,10 @@ class App extends iron.Trait {
|
||||
public function new() {
|
||||
super();
|
||||
|
||||
#if arm_resizable
|
||||
iron.App.onResize = resize;
|
||||
#end
|
||||
|
||||
kha.System.notifyOnDropFiles(function(filePath:String) {
|
||||
dropPath = StringTools.rtrim(filePath);
|
||||
var mouse = iron.system.Input.getMouse();
|
||||
@@ -203,12 +205,6 @@ class App extends iron.Trait {
|
||||
}
|
||||
|
||||
static function render(g:kha.graphics2.Graphics) {
|
||||
if (lastW >= 0 && arm.App.realw() > 0 && (lastW != arm.App.realw() || lastH != arm.App.realh())) {
|
||||
arm.App.resize();
|
||||
}
|
||||
lastW = arm.App.realw();
|
||||
lastH = arm.App.realh();
|
||||
|
||||
if (arm.App.realw() == 0 || arm.App.realh() == 0) return;
|
||||
|
||||
if (arm.App.dragAsset != null) {
|
||||
@@ -253,6 +249,7 @@ class App extends iron.Trait {
|
||||
UITrait.inst.ddirty = 2;
|
||||
}
|
||||
|
||||
g.end();
|
||||
uimodal.beginLayout(g, right - Std.int(uimodal.ELEMENT_W()), bottom - Std.int(uimodal.ELEMENT_H() * 1.2), Std.int(uimodal.ELEMENT_W()));
|
||||
if (uimodal.button("OK")) {
|
||||
showFiles = false;
|
||||
|
||||
@@ -569,7 +569,9 @@ class Importer {
|
||||
],
|
||||
index_arrays: [
|
||||
{ values: mesh.inda, material: 0 }
|
||||
]
|
||||
],
|
||||
scale_pos: mesh.scalePos,
|
||||
scale_tex: mesh.scaleTex
|
||||
};
|
||||
if (mesh.texa != null) raw.vertex_arrays.push({ values: mesh.texa, attrib: "tex" });
|
||||
#else
|
||||
@@ -579,7 +581,7 @@ class Importer {
|
||||
mesh.texa = new kha.arrays.Int16Array(verts * 2);
|
||||
var n = new iron.math.Vec4();
|
||||
for (i in 0...verts) {
|
||||
n.set(mesh.posa[i * 4 + 0] / 32767, mesh.posa[i * 4 + 1] / 32767, mesh.posa[i * 4 + 2] / 32767).normalize();
|
||||
n.set(mesh.posa[i * 4] / 32767, mesh.posa[i * 4 + 1] / 32767, mesh.posa[i * 4 + 2] / 32767).normalize();
|
||||
// Sphere projection
|
||||
// mesh.texa[i * 2 + 0] = Math.atan2(n.x, n.y) / (Math.PI * 2) + 0.5;
|
||||
// mesh.texa[i * 2 + 1] = n.z * 0.5 + 0.5;
|
||||
@@ -606,9 +608,9 @@ class Importer {
|
||||
new MeshData(raw, function(md:MeshData) {
|
||||
|
||||
#if arm_editor // Append
|
||||
if (htab.position == 0) {
|
||||
if (UITrait.inst.htab.position == 0) {
|
||||
var mats = new haxe.ds.Vector(1);
|
||||
mats[0] = selectedMaterial2.data;
|
||||
mats[0] = UITrait.inst.selectedMaterial2.data;
|
||||
var object = iron.Scene.active.addMeshObject(md, mats, iron.Scene.active.getChild("Scene"));
|
||||
path = StringTools.replace(path, "\\", "/");
|
||||
var ar = path.split("/");
|
||||
|
||||
@@ -58,11 +58,10 @@ class MeshUtil {
|
||||
};
|
||||
|
||||
new MeshData(raw, function(md:MeshData) {
|
||||
var mergedObject = UITrait.inst.mergedObject;
|
||||
mergedObject = new MeshObject(md, UITrait.inst.paintObject.materials);
|
||||
mergedObject.name = UITrait.inst.paintObject.name;
|
||||
mergedObject.force_context = "paint";
|
||||
UITrait.inst.mainObject().addChild(mergedObject);
|
||||
UITrait.inst.mergedObject = new MeshObject(md, UITrait.inst.paintObject.materials);
|
||||
UITrait.inst.mergedObject.name = UITrait.inst.paintObject.name;
|
||||
UITrait.inst.mergedObject.force_context = "paint";
|
||||
UITrait.inst.mainObject().addChild(UITrait.inst.mergedObject);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +103,10 @@ class Project {
|
||||
var n = UITrait.inst.newObjectNames[UITrait.inst.newObject];
|
||||
iron.data.Data.deleteMesh(UITrait.inst.paintObject.data.handle);
|
||||
iron.data.Data.getMesh("mesh_" + n, n, function(md:MeshData) {
|
||||
|
||||
var hasCurrent = @:privateAccess kha.graphics4.Graphics2.current != null;
|
||||
if (hasCurrent) UITrait.inst.ui.g.end();
|
||||
|
||||
UITrait.inst.autoFillHandle.selected = false;
|
||||
UITrait.inst.paintObject.setData(md);
|
||||
UITrait.inst.paintObject.transform.scale.set(1, 1, 1);
|
||||
@@ -110,7 +114,6 @@ class Project {
|
||||
UITrait.inst.paintObject.name = n;
|
||||
UITrait.inst.paintObjects = [UITrait.inst.paintObject];
|
||||
UITrait.inst.maskHandle.position = 0;
|
||||
UITrait.inst.ui.g.end();
|
||||
UITrait.inst.materials = [new MaterialSlot()];
|
||||
UITrait.inst.selectedMaterial = UITrait.inst.materials[0];
|
||||
UINodes.inst.canvasMap = new Map();
|
||||
@@ -129,12 +132,12 @@ class Project {
|
||||
UINodes.inst.updateCanvasMap();
|
||||
UINodes.inst.parsePaintMaterial();
|
||||
RenderUtil.makeMaterialPreview();
|
||||
UITrait.inst.ui.g.begin(false);
|
||||
UITrait.inst.assets = [];
|
||||
UITrait.inst.assetNames = [];
|
||||
UITrait.inst.assetId = 0;
|
||||
|
||||
ViewportUtil.resetViewport();
|
||||
|
||||
if (hasCurrent) UITrait.inst.ui.g.begin(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -334,8 +334,8 @@ class UITrait extends iron.Trait {
|
||||
gizmoX = iron.Scene.active.getChild("GizmoX");
|
||||
gizmoY = iron.Scene.active.getChild("GizmoY");
|
||||
gizmoZ = iron.Scene.active.getChild("GizmoZ");
|
||||
var light = iron.Scene.active.getChild("Lamp");
|
||||
light.addTrait(new armory.trait.physics.RigidBody(0.0));
|
||||
var light = iron.Scene.active.getChild("Light");
|
||||
// light.addTrait(new armory.trait.physics.RigidBody(0, 0));
|
||||
#end
|
||||
|
||||
selectedObject = iron.Scene.active.getChild("Cube");
|
||||
@@ -612,7 +612,7 @@ class UITrait extends iron.Trait {
|
||||
|
||||
object.transform.buildMatrix();
|
||||
|
||||
object.addTrait(new armory.trait.physics.RigidBody(0.0));
|
||||
object.addTrait(new armory.trait.physics.RigidBody(0, 0));
|
||||
|
||||
selectObject(object);
|
||||
}
|
||||
@@ -626,7 +626,7 @@ class UITrait extends iron.Trait {
|
||||
object.transform.scale.setFrom(lo.transform.scale);
|
||||
object.transform.buildMatrix();
|
||||
|
||||
object.addTrait(new armory.trait.physics.RigidBody(0.0));
|
||||
object.addTrait(new armory.trait.physics.RigidBody(0, 0));
|
||||
|
||||
selectObject(object);
|
||||
}
|
||||
@@ -745,7 +745,7 @@ class UITrait extends iron.Trait {
|
||||
ddirty = 2;
|
||||
}
|
||||
|
||||
function selectObject(o:iron.object.Object) {
|
||||
public function selectObject(o:iron.object.Object) {
|
||||
selectedObject = o;
|
||||
|
||||
#if arm_editor
|
||||
@@ -1000,7 +1000,7 @@ class UITrait extends iron.Trait {
|
||||
p.raw.strength = ui.slider(Id.handle({value: p.raw.strength}), "Strength", 0.0, 5.0, true);
|
||||
}
|
||||
else if (Std.is(selectedObject, iron.object.LightObject)) {
|
||||
selectedType = "(Lamp)";
|
||||
selectedType = "(Light)";
|
||||
var light = cast(selectedObject, iron.object.LightObject);
|
||||
light.data.raw.strength = ui.slider(Id.handle({value: light.data.raw.strength / 10}), "Strength", 0.0, 5.0, true) * 10;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@ class RenderPathDeferred {
|
||||
|
||||
path = _path;
|
||||
|
||||
#if arm_editor
|
||||
armory.data.Config.raw.rp_gi = true;
|
||||
#end
|
||||
|
||||
armory.renderpath.RenderPathDeferred.init(path);
|
||||
|
||||
// Paint
|
||||
@@ -157,7 +161,7 @@ class RenderPathDeferred {
|
||||
path.currentFace = -1;
|
||||
|
||||
if (l.data.raw.type == "point") @:privateAccess Inc.pointIndex++;
|
||||
else if (l.data.raw.type == "spot") @:privateAccess Inc.spotIndex++;
|
||||
else if (l.data.raw.type == "spot" || l.data.raw.type == "area") @:privateAccess Inc.spotIndex++;
|
||||
}
|
||||
#end
|
||||
}
|
||||
@@ -396,13 +400,24 @@ class RenderPathDeferred {
|
||||
}
|
||||
#end
|
||||
|
||||
#if (rp_shadowmap)
|
||||
// Inc.drawShadowMap();
|
||||
drawShadowMap(); // Paint
|
||||
#end
|
||||
|
||||
// Voxels
|
||||
#if (rp_gi != "Off")
|
||||
var relight = false;
|
||||
if (armory.data.Config.raw.rp_gi != false)
|
||||
{
|
||||
var voxelize = path.voxelize();
|
||||
|
||||
#if ((rp_gi == "Voxel GI") && (rp_voxelgi_relight))
|
||||
// Relight if light was moved
|
||||
for (light in iron.Scene.active.lights) {
|
||||
if (light.transform.diff()) { voxelize = true; break; }
|
||||
}
|
||||
#end
|
||||
|
||||
#if arm_voxelgi_temporal
|
||||
voxelize = ++RenderPathCreator.voxelFrame % RenderPathCreator.voxelFreq == 0;
|
||||
|
||||
@@ -415,63 +430,41 @@ class RenderPathDeferred {
|
||||
if (voxelize) {
|
||||
var res = Inc.getVoxelRes();
|
||||
|
||||
#if (rp_gi == "Voxel GI")
|
||||
var voxtex = "voxelsOpac";
|
||||
#else
|
||||
// #if (rp_gi == "Voxel GI")
|
||||
// var voxtex = "voxelsOpac";
|
||||
// #else
|
||||
var voxtex = voxels;
|
||||
#end
|
||||
// #end
|
||||
|
||||
path.clearImage(voxtex, 0x00000000);
|
||||
path.setTarget("");
|
||||
path.setViewport(res, res);
|
||||
path.bindTarget(voxtex, "voxels");
|
||||
path.drawMeshes("voxel");
|
||||
|
||||
relight = true;
|
||||
}
|
||||
|
||||
#if ((rp_gi == "Voxel GI") && (rp_voxelgi_relight))
|
||||
// Relight if light was moved
|
||||
for (light in iron.Scene.active.lights) {
|
||||
if (light.transform.diff()) { relight = true; break; }
|
||||
}
|
||||
#end
|
||||
|
||||
if (relight) {
|
||||
#if (rp_gi == "Voxel GI")
|
||||
// Inc.computeVoxelsBegin();
|
||||
// for (i in 0...lights.length) Inc.computeVoxels(i); // Redraws SM
|
||||
// Inc.computeVoxelsEnd();
|
||||
#if (rp_gi_bounces)
|
||||
voxels = "voxelsBounce";
|
||||
#end
|
||||
#else
|
||||
path.generateMipmaps(voxels); // AO
|
||||
// path.bindTarget("voxelsNor", "voxelsNor");
|
||||
for (l in iron.Scene.active.lights) {
|
||||
if (!l.visible || !l.data.raw.cast_shadow || l.data.raw.type != "sun") continue;
|
||||
var n = "shadowMap";
|
||||
path.bindTarget(n, n);
|
||||
break;
|
||||
}
|
||||
#end
|
||||
path.drawMeshes("voxel");
|
||||
path.generateMipmaps(voxels);
|
||||
}
|
||||
|
||||
// if (relight) {
|
||||
// Inc.computeVoxelsBegin();
|
||||
// Inc.computeVoxels();
|
||||
// Inc.computeVoxelsEnd();
|
||||
// path.generateMipmaps(voxels);
|
||||
// }
|
||||
}
|
||||
#end
|
||||
|
||||
// ---
|
||||
// Deferred light
|
||||
// ---
|
||||
var lights = iron.Scene.active.lights;
|
||||
|
||||
// #if (rp_gi == "Voxel GI")
|
||||
// if (relight) Inc.computeVoxelsBegin();
|
||||
// #end
|
||||
// #if (rp_gi == "Voxel GI")
|
||||
// if (relight) Inc.computeVoxels(i);
|
||||
// #end
|
||||
// #if (rp_gi == "Voxel GI")
|
||||
// if (relight) Inc.computeVoxelsEnd();
|
||||
// #end
|
||||
|
||||
#if (rp_shadowmap)
|
||||
// Inc.drawShadowMap();
|
||||
drawShadowMap(); // Paint
|
||||
#end
|
||||
|
||||
path.setDepthFrom("tex", "gbuffer1"); // Unbind depth so we can read it
|
||||
path.setTarget("tex");
|
||||
path.bindTarget("_main", "gbufferD");
|
||||
|
||||
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user