PS_IN VS( VS_IN _In ) { float4 WorldPosition = mul( new float4( _In.Position, 1.0f ), _Local2World ); PS_IN Out; Out.__Position = mul( WorldPosition, _CubeMapWorld2Proj ); Out.Position = WorldPosition.xyz; Out.Normal = mul( _float4( _In.Normal, 0.0f ), _Local2World ); Out.Tangent = mul( _float4( _In.Tangent, 0.0f ), _Local2World ); Out.BiTangent = mul( _float4( _In.BiTangent, 0.0f ), _Local2World ); Out.UV = _In.UV; return Out; }
PS_IN VS(VS_IN _In) { float4 WorldPosition = mul(new float4(_In.Position, 1.0f), _Local2World); PS_IN Out; Out.__Position = mul(WorldPosition, _CubeMapWorld2Proj); Out.Position = WorldPosition.xyz; Out.Normal = mul(_float4(_In.Normal, 0.0f), _Local2World); Out.Tangent = mul(_float4(_In.Tangent, 0.0f), _Local2World); Out.BiTangent = mul(_float4(_In.BiTangent, 0.0f), _Local2World); Out.UV = _In.UV; return(Out); }
internal void AddVertexWithColor(Vector4 vertex, Vector4 color, Vector3 normal) { vertexAddCount++; VertexCount++; int stride = ActiveEffect.GetStride(); VS_IN vsin = new VS_IN() { Vertex = vertex, Color = color, Uv = uvVertices[uvIndex++], TextureIndex = ArrayIndex, Normal = normal }; uvIndex = uvIndex % 4; ActiveEffect.WriteVertex(stream, ref vsin); if (mode == PrimitiveTopology.TriangleList) { if (vertexAddCount % 4 == 1) { vertex0 = vsin; } else if (vertexAddCount % 4 == 3) { vertex2 = vsin; } else if (vertexAddCount % 4 == 0) { VertexCount += 2; ActiveEffect.WriteVertex(stream, ref vertex0); ActiveEffect.WriteVertex(stream, ref vertex2); } } bool isStreamAlmostFull = (VertexCount * stride) >= stream.Length - 32 * stride; bool isQuadComplete = vertexAddCount % 4 == 0; bool timeToFlushVertices = isStreamAlmostFull && isQuadComplete; if (timeToFlushVertices) { Draw(); } }