当前位置:首页 > molehill介绍翻译
Context3DVertexBufferFormat.FLOAT_2 );
Our vertices position and uv values are defined into our VertexBuffer3D object : 01.vertexBuffer.uploadFromVector( 02.Vector.
04.// x,y,u,v 05.-1,-1, 0,1, 06.0,1, 1,0, 07.1,-1, 1,1, 08.] 09.), 10.0, 3 11.);
Then we retrieve the uv values in our fragment shader and sample our texture :
1.fragmentShaderAssembler.assemble( Context3DProgramType.FRAGMENT, 2.\
3.\ 4.\ 5.);
To define our texture, we instantiate our BitmapData, upload it to a Texture object and upload it to the GPU: 1.texture
=
context3D.createTexture( 256, 256,
Context3DTextureFormat.BGRA, false );
2.var bitmap:Bitmap = new MolePeopleBitmap();
3.texture.uploadFromBitmapData( bitmap.bitmapData ); And then to access it from fs1, we set it:
1.context3D.setTextureAt( 1, texture ); By using this modified shader program, we end up with this :
I will cover in later tutorials new effects like per-fragment fog or heat signature with texture lookup too. Of course, we just covered here how shaders work with Molehill. To control your pixels you need triangles and vertices and indices defining them in your scene. For this, you will need other objects like VertexBuffer3D and IndexBuffer3D, attached to your Context3D object. The following figure illustrates the overall interaction of objects:
As you can see, the Molehill APIs are very low-level and expose features for advanced 3D developers who want to work at such a level with 3D. Of course, some developers will prefer working with higher-level frameworks, which exposes ready to go APIs, and we took care of that. Building mountains out of Molehill
We know that many ActionScript 3 developers would prefer having a light, a camera, a plane to work with rather than a vertex buffer and shadersbytecode. So to make sure that everyone can enjoy the power of Molehill, we are actively working with existing 3D frameworks like Alternativa3D, Flare3D, Away3D, Minko, Sophie3D, Yogurt3D and more. Today most of these frameworks are already Molehill enabled and will be available for you when Molehill is available in a next version of the Adobe Flash runtimes.
Most of the developers from these frameworks were at Max this year to present sessions about how they leveraged Molehill in their respective framework. We expect developers to build their engine on top of Molehill, hence, advanced 3D developers and non-3D developers will be able to benefit from Molehill. I hope you enjoyed this little deep dive into Molehill, stay tuned for more Molehill stuff soon
Post a comment | Trackback URI
共分享92篇相关文档