Behind the 3D scenes - part2
2016-03-31 17:56
127 查看
渲染管道:从加载到渲染的整个过程。
模型是由多个节点构成,而节点石油节点node-parts构成,node-part包含了meshpart (形状)和 materialpart(颜色等信息),
灵活修改材料的颜色属性:
ModelBatch doesn't actually render them. Instead it sorts them so they are rendered in the most optimal order and then passes them
to the renderable's shader.Note that if no shader is provided (or the provided shader is not suitable), the ModelBatch will create
a Shader for us. It does that by asking a ShaderProvider for
the required shader.
For
OpenGL ES 2.0 it will encapsulate a ShaderProgram and set uniforms and attributes according to the specified Renderable.
真正负责渲染的是 Shader
To summarize:
ModelInstance contains a copy of the nodes and materials of a Model. But it only references the resources of the Model like the meshes and textures. A ModelInstance creates Renderable
instances for each NodePart it contains.
Renderable is the smallest renderable part, which is passed through the rendering pipeline.
ModelBatch gathers a Shader for each Renderable and sorts the renderables to make sure they are rendered in an optimal order.
Shader is responsible for actual rendering a Renderable. Most commonly an application uses multiple shaders, where each shader is dedicated to a single ShaderProgram (GLSL program). RenderContext is
used to keep track of the OpenGL context, like which texture is currently bound.
模型是由多个节点构成,而节点石油节点node-parts构成,node-part包含了meshpart (形状)和 materialpart(颜色等信息),
ModelLoader modelLoader = new G3dModelLoader(new JsonReader());//UBJsonReader for g3db格式 ModelData modelData = modelLoader.loadModelData(Gdx.files.internal("data/invaderscene.g3dj"));// g3dj格式的文件
model = new Model(modelData, new TextureProvider.FileTextureProvider());
灵活修改材料的颜色属性:
private void doneLoading() { Material blockMaterial = model.getNode("block1").parts.get(0).material; ColorAttribute colorAttribute = (ColorAttribute)blockMaterial.get(ColorAttribute.Diffuse); colorAttribute.color.set(Color.YELLOW); for (int i = 0; i < model.nodes.size; i++) { ... } }
Material blockMaterial = model.getMaterial("block_default1"); blockMaterial.set(ColorAttribute.createDiffuse(Color.YELLOW)); for (int i = 0; i < model.nodes.size; i++) { ... }
ModelBatch doesn't actually render them. Instead it sorts them so they are rendered in the most optimal order and then passes them
to the renderable's shader.Note that if no shader is provided (or the provided shader is not suitable), the ModelBatch will create
a Shader for us. It does that by asking a ShaderProvider for
the required shader.
For
OpenGL ES 2.0 it will encapsulate a ShaderProgram and set uniforms and attributes according to the specified Renderable.
真正负责渲染的是 Shader
To summarize:
ModelInstance contains a copy of the nodes and materials of a Model. But it only references the resources of the Model like the meshes and textures. A ModelInstance creates Renderable
instances for each NodePart it contains.
Renderable is the smallest renderable part, which is passed through the rendering pipeline.
ModelBatch gathers a Shader for each Renderable and sorts the renderables to make sure they are rendered in an optimal order.
Shader is responsible for actual rendering a Renderable. Most commonly an application uses multiple shaders, where each shader is dedicated to a single ShaderProgram (GLSL program). RenderContext is
used to keep track of the OpenGL context, like which texture is currently bound.
相关文章推荐
- java正则表达式 过滤特殊字符的正则表达式
- miniUI tree 过滤(filter)的问题
- C++11 function (2017-05-05 第2次修改)
- Spark Streaming+kafka+eclipse编程
- HTTP in iOS你看我就够
- 從DTS到驅動加載的過程分析
- 通过top命令发现plymouthd进程cpu负载达到近100% 解决办法
- 使用piranha搭建Linux Virtual Server (LVS)集群环境
- Ubuntu 下 vim+Ctags+Taglist+WinManager工具的安装
- Java的静态代理、动态代理,CGLib的动态代理,使用动态代理基于AOP的AspectJ框架—深入探究
- QEMU
- socket通信
- android:layout_weight attribute.
- (未做)排号机
- 如何处理好离职这件事
- 渲染管线
- 专访邓凡平:Android开发路上的快速学习之道
- Http请求中Content-Type讲解
- Web-Json
- 找到一种能用上数学去表示的方式 ---- 量化?具体化?建模?