Integrating HLSL shaders

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Integrating HLSL shaders

      Hi all,

      I've been thinking about what would be the best way to integrate HLSL into the GCC2 framework.

      My plan of attack is as follows, and if anyone see's a hole in the plan, please let me know.

      1. When the objects get created, check to see if they have an effect file associated with them.

      2. If so, load it, and compile the shader, (D3DXCreateEffectFromFile), and select the best technique with FindNextValidTechnique()

      3. On the pre-render, possibly set/get values through the shader's constant table.

      4. On the VRender() call begin(), beginpass(), endpass(), and end().

      5. On the PostRender() (not sure what routines should happen here.)

      6. When the game/object dies, safe_release the effect.

      7. Possibly consider an effectMgr, maybe wrapping a associative container with shader pointers, to string names, so I could query the effectMgr for "SuperGloss" and get the corresponding entry back.

      That's the plan of attack at this point. Any and all input is welcome.

      Regards,
      B.
      -B.
    • RE: Integrating HLSL shaders

      I'd definitely do #7 - you don't really want a 1:1 mapping between shaders and game objects!

      You could get away with that in Teapot Wars, but not much else....
      Mr.Mike
      Author, Programmer, Brewer, Patriot