How to generate vertices for 3D Diamond Shape in DirectX?
EDIT:
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:
How to generate vertices for 3D Diamond Shape in DirectX?
EDIT:
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:
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.
CreateBuffer Information
How to create a vertex buffer information