Some Shader advice

Started by
1 comment, last by Azzazelus 8 years, 10 months ago

Hello. I was reading Introduction to DirectX 11 especially the part where the author used the Effects lib in the DirectX sample code and made a different class for every shader. I was trying to make a vector of objects with pointers to DirectX resources and render them in a loop. I have a pointer to the vertex buffer, index buffer and texture buffer. Now I'm wondering how to get a pointer to a shader if shaders are different classes.

Should I do an universal class for shaders and change the params for every objects created with that class? Example obj1->TechniqueName = "tech", obj1->filename = filename etc ?

Advertisement
Google shader stitching, uber shaders, and shader permutations.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Thanks for the hint. In the meantime I made a function in the object class (the class with pointers to Dx resources) named Render and sends all the mesh data to a shader object that I choose.

Something like:

 
class object {
 
ID3D11Buffer* Dx11vertexBuffer;
ID3D11ShaderResourceView* mDiffuseMapSRV;
 
void renderObject(device etc..) {
  
    DiffuseShader->Render(Dx11vertexBuffer,mDiffuseMapSRV etc..)
   
}
 
}
 

So in my shader classes that are unique I can do whatever I want with the mesh data and texture. Is this acceptable for now until I learn something more advanced ?

This topic is closed to new replies.

Advertisement