Advertisement Jump to content
Sign in to follow this  
forsandifs

HLSL container?

This topic is 3017 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!