Created
January 31, 2013 13:04
-
-
Save JohnBrookes/4682713 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function initObjects():void | |
{ | |
var splitH:Number = 8 | |
var splitV:Number = 8 | |
var depth:Number = 69; | |
var i:int = 0; | |
var j:int = 0; | |
var mat:TextureMaterial = new TextureMaterial(Cast.bitmapTexture(new ImageEmbed())); | |
mat.animateUVs = true; | |
var cont:ObjectContainer3D | |
var planeFrontMesh:Mesh | |
var pg:PlaneGeometry | |
pg = new PlaneGeometry(1920 / splitH, 1080 / splitV, 1, 1, false) | |
for (i = 0; i <= splitH - 1; i++) | |
{ | |
for (j = 0; j <= splitV - 1; j++) | |
{ | |
cont = new ObjectContainer3D(); | |
cont.x = 1920 / splitH * i - 1920 / 2 + 1920 / (splitH * 2); | |
cont.y = 1080 / splitV * -j + 1080 / 2 - 1080 / (splitV * 2); | |
cont.z = depth / 2; | |
scene.addChild(cont); | |
planeFrontMesh = new Mesh(pg, mat); | |
planeFrontMesh.z = -depth / 2; | |
cont.addChild(planeFrontMesh); | |
planeFrontMesh.geometry.scaleUV(1 / splitH, 1 / splitV); | |
//causes UV warning | |
planeFrontMesh.subMeshes[0].offsetU = ((1 / splitH) * i); | |
planeFrontMesh.subMeshes[0].offsetV = (1 / splitV * j); | |
//note this doesnt cause the trace warning as offsetU is never the same as the last value set | |
//so uvTransformDirty is set and matrix assigned | |
//planeFrontMesh.subMeshes[0].offsetU = 1/i; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment