Jump to content
  • Advertisement
Sign in to follow this  
forsandifs

HLSL container?

This topic is 2919 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In HLSL I would like to have a data structure as follows:

List of Objects
List of Triangles in Object
float4 describing vertex 1 position
float4 describing vertex 2 position
float4 describing vertex 3 position


How can I implement something like that?

Share this post


Link to post
Share on other sites
Advertisement
Well, I figured out the answer. By implementing the following buffer, for example, we have the desired data arrangement.


cbuffer ObjectData : register(b0)
{
int NumObjects;
Texture1D<int> NumTrisInObject;
Texture1D<float4> TriVertex1Pos;
Texture1D<float4> TriVertex2Pos;
Texture1D<float4> TriVertex3Pos;
}


This allows listing of all the vertices in all the objects and a way of knowing how to access a particular vertex in a particular object.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!