public override void SetSunLight(SunLight light) { SetVertexShaderConstant(Matrix.Transpose(worldMatrix)); //SetVertexShaderConstant(viewMatrix); //SetVertexShaderConstant(Matrix.Invert(worldMatrix * viewMatrix)); SetVertexShaderConstant(light.Direction); SetVertexShaderConstant(light.Color); }
public override void SetJointMatrices(Matrix[] jointMatrices) { for (int i = 0; i < 32; i++) { Matrix m = i < jointMatrices.Length ? jointMatrices[i] : Matrix.Identity; SetVertexShaderConstant(Matrix.Transpose(m)); } }
public override void ApplyFogSettings(FogSettings fogSettings) { SetVertexShaderConstant(Matrix.Transpose(worldMatrix)); // SlimDX optimizes the World matrix to 4x3 we only need for our world position a float3 IncrementVertexShaderRegister(-4); SetVertexShaderConstant(device.CameraInvertedViewMatrix.Translation, false); SetVertexShaderConstant(fogSettings.FogColor); SetVertexShaderConstants(fogSettings.FogStart, fogSettings.FogEnd, 0.0f, 0.0f); }
public override void SetModelViewProjection(Matrix model, Matrix view, Matrix projection) { vertexShaderCurrentRegister = 0; pixelShaderCurrentRegister = 0; worldMatrix = model; viewMatrix = view; worldViewProjectionMatrix = model * view * projection; SetVertexShaderConstant(Matrix.Transpose(worldViewProjectionMatrix)); }
private static void WriteMatrixToShaderBufferStream(DataStream shaderStream, Matrix value) { shaderStream.WriteRange(Matrix.Transpose(value).GetValues, 0, 16); }
public override void SetModelViewProjection(Matrix matrix) { vertexShaderCurrentRegister = 0; pixelShaderCurrentRegister = 0; SetVertexShaderConstant(Matrix.Transpose(matrix)); }