Added base block face brightness modifier

This commit is contained in:
William Moorehouse 2015-11-07 17:23:46 -05:00
parent 95f49dd277
commit f90d3717c0
3 changed files with 12 additions and 10 deletions

View File

@ -36,10 +36,6 @@ namespace TrueCraft.Client.Modules
ChunkRenderer.Start(); ChunkRenderer.Start();
OpaqueEffect = new BasicEffect(Game.GraphicsDevice); OpaqueEffect = new BasicEffect(Game.GraphicsDevice);
OpaqueEffect.EnableDefaultLighting();
OpaqueEffect.DirectionalLight0.SpecularColor = Color.Black.ToVector3();
OpaqueEffect.DirectionalLight1.SpecularColor = Color.Black.ToVector3();
OpaqueEffect.DirectionalLight2.SpecularColor = Color.Black.ToVector3();
OpaqueEffect.TextureEnabled = true; OpaqueEffect.TextureEnabled = true;
OpaqueEffect.Texture = Game.TextureMapper.GetTexture("terrain.png"); OpaqueEffect.Texture = Game.TextureMapper.GetTexture("terrain.png");
OpaqueEffect.FogEnabled = true; OpaqueEffect.FogEnabled = true;

View File

@ -88,13 +88,22 @@ namespace TrueCraft.Client.Rendering
var quad = new VertexPositionNormalColorTexture[4]; var quad = new VertexPositionNormalColorTexture[4];
var unit = CubeMesh[(int)face]; var unit = CubeMesh[(int)face];
var normal = CubeNormals[(int)face]; var normal = CubeNormals[(int)face];
var faceColor = new Color(FaceBrightness[(int)face] * color.ToVector3());
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
quad[i] = new VertexPositionNormalColorTexture(offset + unit[i], normal, color, texture[textureOffset + i]); quad[i] = new VertexPositionNormalColorTexture(offset + unit[i], normal, faceColor, texture[textureOffset + i]);
} }
return quad; return quad;
} }
protected static readonly float[] FaceBrightness =
new float[]
{
0.6f, 0.6f, // North / South
0.8f, 0.8f, // East / West
1.0f, 0.5f // Top / Bottom
};
protected enum CubeFace protected enum CubeFace
{ {
PositiveZ = 0, PositiveZ = 0,

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\targets\Client.targets" /> <Import Project="..\targets\Client.targets" />
<PropertyGroup> <PropertyGroup>
@ -379,8 +379,5 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup />
<Folder Include="Modules\" />
<Folder Include="Content\Audio\" />
</ItemGroup>
</Project> </Project>