public void Add(MyDecalTriangle_Data triangle, int remainingTrianglesOfThisDecal, Vector3D position, float lightSize, float emissivity) { // We can't add triangles while fading out //if (m_status == MyDecalsBufferState.FADING_OUT) return; MyDecalTriangle decalTriangle = m_freeTriangles.Pop(); decalTriangle.Start(lightSize); decalTriangle.Emissivity = emissivity; //decalTriangle.RandomOffset = MyMwcUtils.GetRandomFloat(0.0f, MathHelper.Pi); decalTriangle.RandomOffset = (float)MyRender.RenderTimeInMS; decalTriangle.Position = position; // We must repack vertex positions before copying to new triange, to avoid Z-fight. decalTriangle.Position0 = triangle.Vertexes.Vertex0; decalTriangle.Position1 = triangle.Vertexes.Vertex1; decalTriangle.Position2 = triangle.Vertexes.Vertex2; // Texture coords decalTriangle.TexCoord0 = triangle.TexCoords.TexCoord0; decalTriangle.TexCoord1 = triangle.TexCoords.TexCoord1; decalTriangle.TexCoord2 = triangle.TexCoords.TexCoord2; // Alpha decalTriangle.Color0 = triangle.Colors.Color0; decalTriangle.Color1 = triangle.Colors.Color1; decalTriangle.Color2 = triangle.Colors.Color2; //AdjustAlphaByDistance(normal, decalSize, position, decalTriangle); // Bump mapping decalTriangle.Normal0 = triangle.Normals.Normal0; decalTriangle.Normal1 = triangle.Normals.Normal1; decalTriangle.Normal2 = triangle.Normals.Normal2; /* * decalTriangle.Tangent0 = triangle.Tangents.Normal0; * decalTriangle.Tangent1 = triangle.Tangents.Normal1; * decalTriangle.Tangent2 = triangle.Tangents.Normal2; */ decalTriangle.RemainingTrianglesOfThisDecal = remainingTrianglesOfThisDecal; m_trianglesQueue.Enqueue(decalTriangle); }
public void Add(MyDecalTriangle_Data triangle, int remainingTrianglesOfThisDecal, Vector3D position, float lightSize, float emissivity) { MyDecalTriangle decalTriangle = m_freeTriangles.Pop(); decalTriangle.Start(lightSize); decalTriangle.Emissivity = emissivity; //decalTriangle.RandomOffset = MyMwcUtils.GetRandomFloat(0.0f, MathHelper.Pi); decalTriangle.RandomOffset = MyRender.RenderTimeInMS; decalTriangle.Position = position; // We must repack vertex positions before copying to new triange, to avoid Z-fight. decalTriangle.Position0 = triangle.Vertexes.Vertex0; decalTriangle.Position1 = triangle.Vertexes.Vertex1; decalTriangle.Position2 = triangle.Vertexes.Vertex2; // Texture coords decalTriangle.TexCoord0 = triangle.TexCoords.TexCoord0; decalTriangle.TexCoord1 = triangle.TexCoords.TexCoord1; decalTriangle.TexCoord2 = triangle.TexCoords.TexCoord2; // Alpha decalTriangle.Color0 = triangle.Colors.Color0; decalTriangle.Color1 = triangle.Colors.Color1; decalTriangle.Color2 = triangle.Colors.Color2; // Bump mapping decalTriangle.Normal0 = triangle.Normals.Normal0; decalTriangle.Normal1 = triangle.Normals.Normal1; decalTriangle.Normal2 = triangle.Normals.Normal2; /* * decalTriangle.Tangent0 = triangle.Tangents.Normal0; * decalTriangle.Tangent1 = triangle.Tangents.Normal1; * decalTriangle.Tangent2 = triangle.Tangents.Normal2; */ decalTriangle.Draw = true; decalTriangle.RemainingTrianglesOfThisDecal = remainingTrianglesOfThisDecal; m_trianglesQueue.Enqueue(decalTriangle); }