How to generate vertices for 3D Diamond Shape in DirectX?
I am creating an application which receive DIAMETER, CROWN, GIRDLE and PAVILION as parameter and render a model of diamond according to parameters.
Refer to the image:
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.Sign up to join this community
If number of sides is a constant, then possibly best solution would be to use 3D model made in 3D modelling application and scale its parts separately.
When you have the model, you can split it height-wise into segments (crown, girdle, pavilion). Then, when you have input parameters you scale the model according to diameter and each of the parts separately.
If you take bottom as base you scale all vertices by pavilion factor, then scale girdle and crown by 1/pavilion*girdle from girdle base and finally scale crown by 1/girdle*crown. This way each segment will be of right size.
for generating vertices for a shape, you first must create some sort of layout of the vertices. Start with just position to keep it simple. ( add up more afterwards ). Then you have to manualy alocate an big memory chunk to fill with vertices you are using.
From there you create a BufferResource in Dx11. Then you simply specifiy that you want to bind it as an vertex buffer.
there is more detail and instructions in the link below.