Closed vjroger closed 11 years ago
That's cool!
I've got a suggestion for an optimisation. Instead of calling 'validate()' each frame and regenerating the uv's (which is kinda expensive), you could get rid of the 'offset' and instead use an animated UV vertex shader. Like this
var ball:Ball = new Ball(100,20,20,0.005,0.5);
ball.material = new StandardMaterial(new AnimateUVVertexShader(-0.2,0), new TextureVertexColorFragmentShader());
ball.material.textures[0] = someTexture;
addChild(ball)
This will keep all your processing on the GPU, and will save a lot of bandwidth as you're no longer creating/destroying vertex and index buffers each frame.
Thanx, you rule!
On Tue, Dec 4, 2012 at 10:23 PM, Jonathan Pace notifications@github.comwrote:
ew AnimateUVVertexShader(
Hi Jonathan,
here's a new class based on the plane:
package starling.display.graphics { import flash.geom.Rectangle;
}
greetings Rogier
PS, funny if you replace the uv's with:
var u:Number = Math.cos(i_Math.PI_2 / (_numVerticesX - 1)+0.4_j_Math.sin(offset10))(j/ (_numVerticesY - 1))/4 + offset; var v:Number = Math.sin(i_Math.PI_2 / (_numVerticesX - 1)+0.4_j_Math.sin(offset10))(j/ (_numVerticesY - 1))/2 +0.5;