Skip to content

Commit

Permalink
Iron updates
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Mar 4, 2020
1 parent 67c9f6e commit cb39df5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Binary file modified file_read/file.blend
Binary file not shown.
12 changes: 6 additions & 6 deletions mesh_generate/Sources/arm/BoxGenerator.hx
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ class BoxGenerator extends iron.Trait {
var posI16 = new Int16Array(numVertices * 4); // pos.xyz, nor.z
var norI16 = new Int16Array(numVertices * 2); // nor.xy
toI16(posI16, norI16, positions, normals);

var indU32 = new Uint32Array(indices.length);
toU32(indU32, indices);

var pos:TVertexArray = { attrib: "pos", values: posI16 };
var nor:TVertexArray = { attrib: "nor", values: norI16 };
var pos:TVertexArray = { attrib: "pos", values: posI16, data: "short4norm" };
var nor:TVertexArray = { attrib: "nor", values: norI16, data: "short2norm" };
var ind:TIndexArray = { material: 0, values: indU32 };

var rawmeshData:TMeshData = {
var rawmeshData:TMeshData = {
name: "BoxMesh",
vertex_arrays: [pos, nor],
index_arrays: [ind],
Expand All @@ -68,7 +68,7 @@ class BoxGenerator extends iron.Trait {
// Mesh data parsed
meshData = data;
meshData.geom.calculateAABB();

// Fetch material from scene data
Data.getMaterial("Scene", "Material", function(data:MaterialData) {
// Material loaded
Expand All @@ -84,7 +84,7 @@ class BoxGenerator extends iron.Trait {
if (mouse.started()) {
// Create new object in active scene
var object = Scene.active.addMeshObject(meshData, materials);

// Just for testing, add rigid body trait
var aabb = meshData.geom.aabb;
object.transform.loc.set(Math.random() * 8 - 4, Math.random() * 8 - 4, 5);
Expand Down
4 changes: 2 additions & 2 deletions mesh_import/Sources/arm/ImportMesh.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class ImportMesh extends iron.Trait {
var mesh = new ObjParser(blob);

// Positions, normals and indices
var pos:TVertexArray = { attrib: "pos", values: mesh.posa };
var nor:TVertexArray = { attrib: "nor", values: mesh.nora };
var pos:TVertexArray = { attrib: "pos", values: mesh.posa, data: "short4norm" };
var nor:TVertexArray = { attrib: "nor", values: mesh.nora, data: "short2norm" };
var ind:TIndexArray = { material: 0, values: mesh.inda };

var rawmeshData:TMeshData = {
Expand Down
4 changes: 2 additions & 2 deletions screen_image/Sources/arm/MyTrait.hx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class MyTrait extends iron.Trait {

// Access final composited image that is afterwards drawn to the screen
var image = RenderPathCreator.finalTarget.image;

g.color = 0xffffffff;
if (image.g4.renderTargetsInvertedY()) {
if (kha.Image.renderTargetsInvertedY()) {
g.drawScaledImage(image, 0, image.height / 5, image.width / 5, -image.height / 5);
}
else {
Expand Down

0 comments on commit cb39df5

Please sign in to comment.