Remove SheetType.DualIndexed from voxel rendering.
This commit is contained in:
@@ -54,10 +54,10 @@ namespace OpenRA.Graphics
|
||||
if (allocated)
|
||||
throw new SheetOverflowException("");
|
||||
allocated = true;
|
||||
return SheetBuilder.AllocateSheet(SheetType.DualIndexed, Game.Settings.Graphics.SheetSize);
|
||||
return SheetBuilder.AllocateSheet(SheetType.Indexed, Game.Settings.Graphics.SheetSize);
|
||||
};
|
||||
|
||||
return new SheetBuilder(SheetType.DualIndexed, allocate);
|
||||
return new SheetBuilder(SheetType.Indexed, allocate);
|
||||
}
|
||||
|
||||
public VoxelLoader(IReadOnlyFileSystem fileSystem)
|
||||
@@ -78,6 +78,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
var c = 0;
|
||||
for (var v = 0; v < sv; v++)
|
||||
{
|
||||
for (var u = 0; u < su; u++)
|
||||
{
|
||||
var voxel = first(u, v) ?? second(u, v);
|
||||
@@ -85,22 +86,28 @@ namespace OpenRA.Graphics
|
||||
normals[c] = voxel == null ? (byte)0 : voxel.Normal;
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
var s = sheetBuilder.Allocate(new Size(su, sv));
|
||||
Util.FastCopyIntoChannel(s, 0, colors);
|
||||
Util.FastCopyIntoChannel(s, 1, normals);
|
||||
var size = new Size(su, sv);
|
||||
var s = sheetBuilder.Allocate(size);
|
||||
var t = sheetBuilder.Allocate(size);
|
||||
Util.FastCopyIntoChannel(s, colors);
|
||||
Util.FastCopyIntoChannel(t, normals);
|
||||
|
||||
// s and t are guaranteed to use the same sheet because
|
||||
// of the custom voxel sheet allocation implementation
|
||||
s.Sheet.CommitBufferedData();
|
||||
|
||||
var channelP = ChannelSelect[(int)s.Channel];
|
||||
var channelC = ChannelSelect[(int)s.Channel + 1];
|
||||
var channelC = ChannelSelect[(int)t.Channel];
|
||||
return new Vertex[6]
|
||||
{
|
||||
new Vertex(coord(0, 0), s.Left, s.Top, 0, 0, channelP, channelC),
|
||||
new Vertex(coord(su, 0), s.Right, s.Top, 0, 0, channelP, channelC),
|
||||
new Vertex(coord(su, sv), s.Right, s.Bottom, 0, 0, channelP, channelC),
|
||||
new Vertex(coord(su, sv), s.Right, s.Bottom, 0, 0, channelP, channelC),
|
||||
new Vertex(coord(0, sv), s.Left, s.Bottom, 0, 0, channelP, channelC),
|
||||
new Vertex(coord(0, 0), s.Left, s.Top, 0, 0, channelP, channelC)
|
||||
new Vertex(coord(0, 0), s.Left, s.Top, t.Left, t.Top, channelP, channelC),
|
||||
new Vertex(coord(su, 0), s.Right, s.Top, t.Right, t.Top, channelP, channelC),
|
||||
new Vertex(coord(su, sv), s.Right, s.Bottom, t.Right, t.Bottom, channelP, channelC),
|
||||
new Vertex(coord(su, sv), s.Right, s.Bottom, t.Right, t.Bottom, channelP, channelC),
|
||||
new Vertex(coord(0, sv), s.Left, s.Bottom, t.Left, t.Bottom, channelP, channelC),
|
||||
new Vertex(coord(0, 0), s.Left, s.Top, t.Left, t.Top, channelP, channelC)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -332,7 +332,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
var size = new Size(renderer.SheetSize, renderer.SheetSize);
|
||||
var framebuffer = renderer.Device.CreateFrameBuffer(size);
|
||||
var sheet = new Sheet(SheetType.DualIndexed, framebuffer.Texture);
|
||||
var sheet = new Sheet(SheetType.BGRA, framebuffer.Texture);
|
||||
mappedBuffers.Add(sheet, framebuffer);
|
||||
|
||||
return sheet;
|
||||
|
||||
@@ -15,7 +15,8 @@ void main()
|
||||
if (color.a < 0.01)
|
||||
discard;
|
||||
|
||||
vec4 normal = (2.0 * texture2D(Palette, vec2(dot(x, vNormalsMask), PaletteRows.y)) - 1.0);
|
||||
vec4 y = texture2D(DiffuseTexture, vTexCoord.pq);
|
||||
vec4 normal = (2.0 * texture2D(Palette, vec2(dot(y, vNormalsMask), PaletteRows.y)) - 1.0);
|
||||
vec3 intensity = AmbientLight + DiffuseLight * max(dot(normal, LightDirection), 0.0);
|
||||
gl_FragColor = vec4(intensity * color.rgb, color.a);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user