public override BlockDebrisParticleSystem CreateDebrisParticleSystem(SubsystemTerrain subsystemTerrain, Vector3 position, int value, float strength) { int data = Terrain.ExtractData(value); Color fabricColor = SubsystemPalette.GetFabricColor(subsystemTerrain, GetColor(data)); return(new BlockDebrisParticleSystem(subsystemTerrain, position, strength, DestructionDebrisScale, fabricColor, DefaultTextureSlot)); }
public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z) { int data = Terrain.ExtractData(value); Color fabricColor = SubsystemPalette.GetFabricColor(generator, GetColor(data)); generator.GenerateCubeVertices(this, value, x, y, z, 0.0625f, 0.0625f, 0.0625f, 0.0625f, fabricColor, fabricColor, fabricColor, fabricColor, fabricColor, -1, geometry.OpaqueSubsetsByFace); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int data = Terrain.ExtractData(value); color *= SubsystemPalette.GetFabricColor(environmentData, GetColor(data)); BlocksManager.DrawCubeBlock(primitivesRenderer, value, new Vector3(size, 0.0625f * size, size), ref matrix, color, color, environmentData); }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int data = Terrain.ExtractData(value); int clothingColor = GetClothingColor(data); ClothingData clothingData = GetClothingData(data); Matrix matrix2 = m_slotTransforms[(int)clothingData.Slot] * Matrix.CreateScale(size) * matrix; if (clothingData.IsOuter) { BlocksManager.DrawMeshBlock(primitivesRenderer, m_outerMesh, clothingData.Texture, color * SubsystemPalette.GetFabricColor(environmentData, clothingColor), 1f, ref matrix2, environmentData); } else { BlocksManager.DrawMeshBlock(primitivesRenderer, m_innerMesh, clothingData.Texture, color * SubsystemPalette.GetFabricColor(environmentData, clothingColor), 1f, ref matrix2, environmentData); } }
public void UpdateRenderTargets() { if (m_skinTexture == null || m_componentPlayer.PlayerData.CharacterSkinName != m_skinTextureName) { m_skinTexture = CharacterSkinsManager.LoadTexture(m_componentPlayer.PlayerData.CharacterSkinName); m_skinTextureName = m_componentPlayer.PlayerData.CharacterSkinName; Utilities.Dispose(ref m_innerClothedTexture); Utilities.Dispose(ref m_outerClothedTexture); } if (m_innerClothedTexture == null || m_innerClothedTexture.Width != m_skinTexture.Width || m_innerClothedTexture.Height != m_skinTexture.Height) { m_innerClothedTexture = new RenderTarget2D(m_skinTexture.Width, m_skinTexture.Height, 1, ColorFormat.Rgba8888, DepthFormat.None); m_componentHumanModel.TextureOverride = m_innerClothedTexture; m_clothedTexturesValid = false; } if (m_outerClothedTexture == null || m_outerClothedTexture.Width != m_skinTexture.Width || m_outerClothedTexture.Height != m_skinTexture.Height) { m_outerClothedTexture = new RenderTarget2D(m_skinTexture.Width, m_skinTexture.Height, 1, ColorFormat.Rgba8888, DepthFormat.None); m_componentOuterClothingModel.TextureOverride = m_outerClothedTexture; m_clothedTexturesValid = false; } if (DrawClothedTexture && !m_clothedTexturesValid) { m_clothedTexturesValid = true; Rectangle scissorRectangle = Display.ScissorRectangle; RenderTarget2D renderTarget = Display.RenderTarget; try { Display.RenderTarget = m_innerClothedTexture; Display.Clear(new Vector4(Color.Transparent)); int num = 0; TexturedBatch2D texturedBatch2D = m_primitivesRenderer.TexturedBatch(m_skinTexture, useAlphaTest: false, num++, DepthStencilState.None, null, BlendState.NonPremultiplied, SamplerState.PointClamp); texturedBatch2D.QueueQuad(Vector2.Zero, new Vector2(m_innerClothedTexture.Width, m_innerClothedTexture.Height), 0f, Vector2.Zero, Vector2.One, Color.White); ClothingSlot[] innerSlotsOrder = m_innerSlotsOrder; foreach (ClothingSlot slot in innerSlotsOrder) { foreach (int clothe in GetClothes(slot)) { int data = Terrain.ExtractData(clothe); ClothingData clothingData = ClothingBlock.GetClothingData(data); Color fabricColor = SubsystemPalette.GetFabricColor(m_subsystemTerrain, ClothingBlock.GetClothingColor(data)); texturedBatch2D = m_primitivesRenderer.TexturedBatch(clothingData.Texture, useAlphaTest: false, num++, DepthStencilState.None, null, BlendState.NonPremultiplied, SamplerState.PointClamp); if (!clothingData.IsOuter) { texturedBatch2D.QueueQuad(new Vector2(0f, 0f), new Vector2(m_innerClothedTexture.Width, m_innerClothedTexture.Height), 0f, Vector2.Zero, Vector2.One, fabricColor); } } } m_primitivesRenderer.Flush(); Display.RenderTarget = m_outerClothedTexture; Display.Clear(new Vector4(Color.Transparent)); num = 0; innerSlotsOrder = m_outerSlotsOrder; foreach (ClothingSlot slot2 in innerSlotsOrder) { foreach (int clothe2 in GetClothes(slot2)) { int data2 = Terrain.ExtractData(clothe2); ClothingData clothingData2 = ClothingBlock.GetClothingData(data2); Color fabricColor2 = SubsystemPalette.GetFabricColor(m_subsystemTerrain, ClothingBlock.GetClothingColor(data2)); texturedBatch2D = m_primitivesRenderer.TexturedBatch(clothingData2.Texture, useAlphaTest: false, num++, DepthStencilState.None, null, BlendState.NonPremultiplied, SamplerState.PointClamp); if (clothingData2.IsOuter) { texturedBatch2D.QueueQuad(new Vector2(0f, 0f), new Vector2(m_outerClothedTexture.Width, m_outerClothedTexture.Height), 0f, Vector2.Zero, Vector2.One, fabricColor2); } } } m_primitivesRenderer.Flush(); } finally { Display.RenderTarget = renderTarget; Display.ScissorRectangle = scissorRectangle; } } }