Esempio n. 1
0
 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));
     }
 }
Esempio n. 2
0
 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;
 }
Esempio n. 4
0
 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));
 }
Esempio n. 5
0
 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);
     }
 }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
 public void SetModelMatrix(Matrix matrix)
 {
     ShaderEffect.World = GetXnaMatrix(matrix);
 }
Esempio n. 9
0
 public void SetViewMatrix(Matrix matrix)
 {
     ShaderEffect.View = GetXnaMatrix(matrix);
 }
Esempio n. 10
0
		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;
		}
Esempio n. 11
0
		public override void SetJointMatrices(Matrix[] jointMatrices)
		{
			shaderValues.JointMatrices = jointMatrices;
		}
Esempio n. 12
0
		private static void WriteMatrixToShaderBufferStream(DataStream shaderStream, Matrix value)
		{
			shaderStream.WriteRange(Matrix.Transpose(value).GetValues, 0, 16);
		}
Esempio n. 13
0
		public override void SetModelViewProjection(Matrix matrix)
		{
			shaderValues.WorldViewProjection = matrix;
			shaderBufferValuesLoaded = true;
		}
Esempio n. 14
0
		public void SetProjectionMatrix(Matrix matrix)
		{
			ShaderEffect.Projection = GetXnaMatrix(matrix);
		}
Esempio n. 15
0
		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;
		}
Esempio n. 16
0
		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;
		}
Esempio n. 17
0
		public void SetViewMatrix(Matrix matrix)
		{
			ShaderEffect.View = GetXnaMatrix(matrix);
		}
Esempio n. 18
0
 public void SetProjectionMatrix(Matrix matrix)
 {
     ShaderEffect.Projection = GetXnaMatrix(matrix);
 }
 public override void SetModelViewProjection(Matrix matrix)
 {
     shaderValues.WorldViewProjection = matrix;
     shaderBufferValuesLoaded         = true;
 }
Esempio n. 20
0
 public override void SetModelViewProjection(Matrix matrix)
 {
     vertexShaderCurrentRegister = 0;
     pixelShaderCurrentRegister  = 0;
     SetVertexShaderConstant(Matrix.Transpose(matrix));
 }
 private static void WriteMatrixToShaderBufferStream(DataStream shaderStream, Matrix value)
 {
     shaderStream.WriteRange(Matrix.Transpose(value).GetValues, 0, 16);
 }
Esempio n. 22
0
 private void SetVertexShaderConstant(Matrix matrix)
 {
     NativeDevice.SetVertexShaderConstant(vertexShaderCurrentRegister, matrix.GetValues);
     IncrementVertexShaderRegister(16);
 }
Esempio n. 23
0
		public void SetModelMatrix(Matrix matrix)
		{
			ShaderEffect.World = GetXnaMatrix(matrix);
		}
Esempio n. 24
0
		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);
		}