xml3d / xml3d.js

The WebGL/JS implementation of XML3D
Other
75 stars 25 forks source link

Add configurable GL states to materials #192

Closed csvurt closed 8 years ago

csvurt commented 8 years ago

We'd like to be able to set certain GL states on a per-material basis. For example, consider a material that causes objects to be rendered without depth testing:

<material model="urn:xml3d:material:phong">
   <string name="gl-depthTest">false</string>
   <string name="gl-depthMask">false</string>
</material>

Any objects using this material should then be rendered without a depth test and without writing into the depth buffer, causing them to always appear on top of everything else.

All states should match the appropriate WebGL function name (with a gl- prefix) and take appropriate string values as arguments. For example, the gl-cullFaceMode property should take one of BACK, FRONT or FRONT_AND_BACK.

This feature should be confined to the webgl folder of the renderer since it's WebGL specific.

All configurable GL states should also be accessible through the RenderInterface. This should allow users to query the list of changeable states and set a different default state.

The renderer should ensure that the proper states are set during rendering and then reset back to the default after the objects using this material have been drawn.

csvurt commented 8 years ago

Merged into webcomponents branch with 35d74f4f1ec86d6efb3b604e3238d5b0986c72c4