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 SetSunLight(SunLight light) { SetVertexShaderConstant(Matrix.Transpose(worldMatrix)); //SetVertexShaderConstant(viewMatrix); //SetVertexShaderConstant(Matrix.Invert(worldMatrix * viewMatrix)); SetVertexShaderConstant(light.Direction); SetVertexShaderConstant(light.Color); }
public override void SetModelViewProjection(Matrix model, Matrix view, Matrix projection) { shaderValues.World = model; //shaderValues.View = view; shaderValues.WorldView = model * view; shaderValues.WorldViewProjection = shaderValues.WorldView * projection; shaderBufferValuesLoaded = true; }
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)); }
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); }
private void WriteJointMatricesToShaderBufferStream(DataStream shaderStream) { Matrix[] jointMatrices = shaderValues.JointMatrices; for (int i = 0; i < 32; i++) { Matrix m = i < jointMatrices.Length ? jointMatrices[i] : Matrix.Identity; WriteMatrixToShaderBufferStream(shaderStream, m); } }
private static XnaMatrix GetXnaMatrix(Matrix matrix) { var m = new XnaMatrix(); m.M11 = matrix[0]; m.M12 = matrix[1]; m.M13 = matrix[2]; m.M14 = matrix[3]; m.M21 = matrix[4]; m.M22 = matrix[5]; m.M23 = matrix[6]; m.M24 = matrix[7]; m.M31 = matrix[8]; m.M32 = matrix[9]; m.M33 = matrix[10]; m.M34 = matrix[11]; m.M41 = matrix[12]; m.M42 = matrix[13]; m.M43 = matrix[14]; m.M44 = matrix[15]; return(m); }
public void SetModelMatrix(Matrix matrix) { ShaderEffect.World = GetXnaMatrix(matrix); }
public void SetViewMatrix(Matrix matrix) { ShaderEffect.View = GetXnaMatrix(matrix); }
public override void SetJointMatrices(Matrix[] jointMatrices) { shaderValues.JointMatrices = jointMatrices; }
private static void WriteMatrixToShaderBufferStream(DataStream shaderStream, Matrix value) { shaderStream.WriteRange(Matrix.Transpose(value).GetValues, 0, 16); }
public override void SetModelViewProjection(Matrix matrix) { shaderValues.WorldViewProjection = matrix; shaderBufferValuesLoaded = true; }
public void SetProjectionMatrix(Matrix matrix) { ShaderEffect.Projection = GetXnaMatrix(matrix); }
private static XnaMatrix GetXnaMatrix(Matrix matrix) { var m = new XnaMatrix(); m.M11 = matrix[0]; m.M12 = matrix[1]; m.M13 = matrix[2]; m.M14 = matrix[3]; m.M21 = matrix[4]; m.M22 = matrix[5]; m.M23 = matrix[6]; m.M24 = matrix[7]; m.M31 = matrix[8]; m.M32 = matrix[9]; m.M33 = matrix[10]; m.M34 = matrix[11]; m.M41 = matrix[12]; m.M42 = matrix[13]; m.M43 = matrix[14]; m.M44 = matrix[15]; return m; }
public override void SetModelViewMatrix(Matrix matrix) { Matrix modelView = matrix * Matrix.CreateTranslation(-0.5f, -0.5f, 0.0f); var m = new XnaMatrix(); m.Forward = new Vector3(modelView.Forward.X, modelView.Forward.Y, modelView.Forward.Z); m.Right = new Vector3(modelView.Right.X, modelView.Right.Y, modelView.Right.Z); m.Up = new Vector3(modelView.Up.X, modelView.Up.Y, modelView.Up.Z); m.Translation = new Vector3(modelView.Translation.X, modelView.Translation.Y, modelView.Translation.Z); m.M44 = 1.0f; effect.View = m; }
public override void SetModelViewProjection(Matrix matrix) { vertexShaderCurrentRegister = 0; pixelShaderCurrentRegister = 0; SetVertexShaderConstant(Matrix.Transpose(matrix)); }
private void SetVertexShaderConstant(Matrix matrix) { NativeDevice.SetVertexShaderConstant(vertexShaderCurrentRegister, matrix.GetValues); IncrementVertexShaderRegister(16); }
public override void SetProjectionMatrix(Matrix matrix) { //convert from matrix to xna projection! ShaderEffect.Projection = XnaMatrix.CreateOrthographicOffCenter(0, window.ViewportPixelSize.Width, window.ViewportPixelSize.Height, 0, 0, 1); }