im just confused: Im trying to render 2 cubes instead of one. So in my main class i have my WORLD matrix. Then if i render the mesh the camera is multiplying all matrices with the worldProjectionBuffer etc... But how do i add the MeshRenderer´s world matrices to the of the Camera? And how do i add them to the Buffer then? :/ Please help me!
Creating the Buffer:
worldViewProjectionBuffer = new SharpDX.Direct3D11.Buffer(device1, Utilities.SizeOf<Matrix>(), ResourceUsage.Default, BindFlags.ConstantBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);
Setting the Buffer:
context.VertexShader.SetConstantBuffer(0, worldViewProjectionBuffer);
The Camera is updated every Frame:
currentCamera.Update(context, worldViewProjectionBuffer);
OnFrameUpdate();
renderer.Draw(context);
The Update of the Camera is recreating the matrices, but how would i add 2 other world matrices to the camera?
internal void Update(DeviceContext context, SharpDX.Direct3D11.Buffer worldView)
{
viewProjection = Matrix.Multiply(view, projection);
worldViewProjection = world * viewProjection;
worldViewProjection.Transpose();
context.UpdateSubresource(ref worldViewProjection, worldView);
}
And the MeshRenderer has it own world matrix - but how do i add the vertices from the model to it?!
public sealed class MeshRenderer : BaseRenderer, IDisposable, ICloneable
{
private Model mesh;
private Material material;
private Matrix world;
...
Thank in Advance,
Best Regards, Kerbo