- rename draw functions

This commit is contained in:
Magnus Norddahl 2019-08-16 07:12:26 +02:00
parent 5604685770
commit edecd3f7aa
5 changed files with 35 additions and 35 deletions

View file

@ -258,7 +258,7 @@ namespace CodeImp.DoomBuilder.Rendering
public void Render(RenderDevice device) public void Render(RenderDevice device)
{ {
// Render the quad // Render the quad
device.DrawUserPrimitives(type, 0, 2, vertices); device.Draw(type, 0, 2, vertices);
} }
#endregion #endregion

View file

@ -229,12 +229,12 @@ namespace CodeImp.DoomBuilder.Rendering
RenderDevice_DrawIndexed(Handle, type, startIndex, primitiveCount); RenderDevice_DrawIndexed(Handle, type, startIndex, primitiveCount);
} }
public void DrawPrimitives(PrimitiveType type, int startIndex, int primitiveCount) public void Draw(PrimitiveType type, int startIndex, int primitiveCount)
{ {
RenderDevice_Draw(Handle, type, startIndex, primitiveCount); RenderDevice_Draw(Handle, type, startIndex, primitiveCount);
} }
public void DrawUserPrimitives(PrimitiveType type, int startIndex, int primitiveCount, FlatVertex[] data) public void Draw(PrimitiveType type, int startIndex, int primitiveCount, FlatVertex[] data)
{ {
RenderDevice_DrawData(Handle, type, startIndex, primitiveCount, data); RenderDevice_DrawData(Handle, type, startIndex, primitiveCount, data);
} }

View file

@ -237,7 +237,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetShader(aapass); graphics.SetShader(aapass);
graphics.SetTexture(0, General.Map.Grid.Background.Texture); graphics.SetTexture(0, General.Map.Grid.Background.Texture);
graphics.Shaders.SetDisplay2DSettings(1f / windowsize.Width, 1f / windowsize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.SetDisplay2DSettings(1f / windowsize.Width, 1f / windowsize.Height, FSAA_FACTOR, layer.alpha, false);
graphics.DrawUserPrimitives(PrimitiveType.TriangleStrip, 0, 2, backimageverts); graphics.Draw(PrimitiveType.TriangleStrip, 0, 2, backimageverts);
graphics.SetVertexBuffer(0, screenverts, 0, sizeof(FlatVertex)); graphics.SetVertexBuffer(0, screenverts, 0, sizeof(FlatVertex));
break; break;
@ -246,7 +246,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetShader(aapass); graphics.SetShader(aapass);
graphics.SetTexture(0, backtex); graphics.SetTexture(0, backtex);
graphics.Shaders.SetDisplay2DSettings(1f / backsize.Width, 1f / backsize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.SetDisplay2DSettings(1f / backsize.Width, 1f / backsize.Height, FSAA_FACTOR, layer.alpha, false);
graphics.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); graphics.Draw(PrimitiveType.TriangleStrip, 0, 2);
break; break;
// GEOMETRY // GEOMETRY
@ -254,7 +254,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetShader(aapass); graphics.SetShader(aapass);
graphics.SetTexture(0, plottertex); graphics.SetTexture(0, plottertex);
graphics.Shaders.SetDisplay2DSettings(1f / structsize.Width, 1f / structsize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.SetDisplay2DSettings(1f / structsize.Width, 1f / structsize.Height, FSAA_FACTOR, layer.alpha, false);
graphics.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); graphics.Draw(PrimitiveType.TriangleStrip, 0, 2);
break; break;
// THINGS // THINGS
@ -262,7 +262,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetShader(aapass); graphics.SetShader(aapass);
graphics.SetTexture(0, thingstex); graphics.SetTexture(0, thingstex);
graphics.Shaders.SetDisplay2DSettings(1f / thingssize.Width, 1f / thingssize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.SetDisplay2DSettings(1f / thingssize.Width, 1f / thingssize.Height, FSAA_FACTOR, layer.alpha, false);
graphics.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); graphics.Draw(PrimitiveType.TriangleStrip, 0, 2);
break; break;
// OVERLAY // OVERLAY
@ -270,7 +270,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetShader(aapass); graphics.SetShader(aapass);
graphics.SetTexture(0, overlaytex); graphics.SetTexture(0, overlaytex);
graphics.Shaders.SetDisplay2DSettings(1f / overlaysize.Width, 1f / overlaysize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.SetDisplay2DSettings(1f / overlaysize.Width, 1f / overlaysize.Height, FSAA_FACTOR, layer.alpha, false);
graphics.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); graphics.Draw(PrimitiveType.TriangleStrip, 0, 2);
break; break;
// SURFACE // SURFACE
@ -278,7 +278,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetShader(aapass); graphics.SetShader(aapass);
graphics.SetTexture(0, surfacetex); graphics.SetTexture(0, surfacetex);
graphics.Shaders.SetDisplay2DSettings(1f / overlaysize.Width, 1f / overlaysize.Height, FSAA_FACTOR, layer.alpha, false); graphics.Shaders.SetDisplay2DSettings(1f / overlaysize.Width, 1f / overlaysize.Height, FSAA_FACTOR, layer.alpha, false);
graphics.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); graphics.Draw(PrimitiveType.TriangleStrip, 0, 2);
break; break;
} }
} }
@ -1261,7 +1261,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetBufferSubdata(thingsvertices, 0, verts, 0, buffercount * 6); graphics.SetBufferSubdata(thingsvertices, 0, verts, 0, buffercount * 6);
// Draw! // Draw!
graphics.DrawPrimitives(PrimitiveType.TriangleList, 0, buffercount * 2); graphics.Draw(PrimitiveType.TriangleList, 0, buffercount * 2);
buffercount = 0; buffercount = 0;
// Determine next lock size // Determine next lock size
@ -1274,7 +1274,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Draw what's still remaining // Draw what's still remaining
if(buffercount > 0) if(buffercount > 0)
graphics.DrawPrimitives(PrimitiveType.TriangleList, 0, buffercount * 2); graphics.Draw(PrimitiveType.TriangleList, 0, buffercount * 2);
//mxd. Render sprites //mxd. Render sprites
int selectionColor = General.Colors.Selection.ToInt(); int selectionColor = General.Colors.Selection.ToInt();
@ -1400,7 +1400,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetBufferSubdata(thingsvertices, 0, verts, 0, buffercount * 6); graphics.SetBufferSubdata(thingsvertices, 0, verts, 0, buffercount * 6);
// Draw! // Draw!
graphics.DrawPrimitives(PrimitiveType.TriangleList, 0, buffercount * 2); graphics.Draw(PrimitiveType.TriangleList, 0, buffercount * 2);
buffercount = 0; buffercount = 0;
@ -1413,7 +1413,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetBufferSubdata(thingsvertices, 0, verts, 0, buffercount * 6); graphics.SetBufferSubdata(thingsvertices, 0, verts, 0, buffercount * 6);
// Draw what's still remaining // Draw what's still remaining
if(buffercount > 0) graphics.DrawPrimitives(PrimitiveType.TriangleList, 0, buffercount * 2); if(buffercount > 0) graphics.Draw(PrimitiveType.TriangleList, 0, buffercount * 2);
} }
} }
@ -1444,7 +1444,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetBufferSubdata(thingsvertices, 0, verts, 0, buffercount * 6); graphics.SetBufferSubdata(thingsvertices, 0, verts, 0, buffercount * 6);
// Draw! // Draw!
graphics.DrawPrimitives(PrimitiveType.TriangleList, 0, buffercount * 2); graphics.Draw(PrimitiveType.TriangleList, 0, buffercount * 2);
buffercount = 0; buffercount = 0;
// Determine next lock size // Determine next lock size
@ -1457,7 +1457,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Draw what's still remaining // Draw what's still remaining
if(buffercount > 0) if(buffercount > 0)
graphics.DrawPrimitives(PrimitiveType.TriangleList, 0, buffercount * 2); graphics.Draw(PrimitiveType.TriangleList, 0, buffercount * 2);
//mxd. Render models //mxd. Render models
if(General.Settings.GZDrawModelsMode != ModelRenderMode.NONE) if(General.Settings.GZDrawModelsMode != ModelRenderMode.NONE)
@ -1627,7 +1627,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Shaders.SetDisplay2DSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear); graphics.Shaders.SetDisplay2DSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear);
// Draw // Draw
graphics.DrawUserPrimitives(PrimitiveType.TriangleList, 0, vertices.Length / 3, vertices); graphics.Draw(PrimitiveType.TriangleList, 0, vertices.Length / 3, vertices);
} }
} }
@ -1651,7 +1651,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Draw // Draw
graphics.SetVertexDeclaration(graphics.Shaders.FlatVertexDecl); graphics.SetVertexDeclaration(graphics.Shaders.FlatVertexDecl);
graphics.SetShader(ShaderName.things2d_fill); graphics.SetShader(ShaderName.things2d_fill);
graphics.DrawUserPrimitives(PrimitiveType.TriangleList, 0, vertices.Length / 3, vertices); graphics.Draw(PrimitiveType.TriangleList, 0, vertices.Length / 3, vertices);
} }
//mxd. This renders text (DB2 compatibility) //mxd. This renders text (DB2 compatibility)
@ -1680,7 +1680,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetVertexBuffer(0, label.VertexBuffer, 0, FlatVertex.Stride); graphics.SetVertexBuffer(0, label.VertexBuffer, 0, FlatVertex.Stride);
// Draw // Draw
graphics.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); graphics.Draw(PrimitiveType.TriangleStrip, 0, 2);
} }
//mxd. This renders text //mxd. This renders text
@ -1718,7 +1718,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetVertexBuffer(0, label.VertexBuffer, 0, FlatVertex.Stride); graphics.SetVertexBuffer(0, label.VertexBuffer, 0, FlatVertex.Stride);
// Draw // Draw
graphics.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); graphics.Draw(PrimitiveType.TriangleStrip, 0, 2);
} }
} }
} }
@ -1949,7 +1949,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Draw // Draw
graphics.SetVertexBuffer(0, vb, 0, FlatVertex.Stride); graphics.SetVertexBuffer(0, vb, 0, FlatVertex.Stride);
graphics.DrawPrimitives(PrimitiveType.LineList, 0, pointscount / 2); graphics.Draw(PrimitiveType.LineList, 0, pointscount / 2);
vb.Dispose(); vb.Dispose();
} }
@ -2001,7 +2001,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Shaders.SetDisplay2DSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear); graphics.Shaders.SetDisplay2DSettings(1f, 1f, 0f, 1f, General.Settings.ClassicBilinear);
// Draw // Draw
graphics.DrawUserPrimitives(PrimitiveType.TriangleStrip, 0, 2, verts); graphics.Draw(PrimitiveType.TriangleStrip, 0, 2, verts);
} }
#endregion #endregion

View file

@ -605,7 +605,7 @@ namespace CodeImp.DoomBuilder.Rendering
//Render cage //Render cage
graphics.SetVertexBuffer(0, t.CageBuffer, 0, WorldVertex.Stride); graphics.SetVertexBuffer(0, t.CageBuffer, 0, WorldVertex.Stride);
graphics.DrawPrimitives(PrimitiveType.LineList, 0, t.CageLength); graphics.Draw(PrimitiveType.LineList, 0, t.CageLength);
} }
// Done // Done
@ -645,7 +645,7 @@ namespace CodeImp.DoomBuilder.Rendering
//Commence drawing!!11 //Commence drawing!!11
graphics.SetVertexBuffer(0, v.CeilingVertex ? vertexhandle.Upper : vertexhandle.Lower, 0, WorldVertex.Stride); graphics.SetVertexBuffer(0, v.CeilingVertex ? vertexhandle.Upper : vertexhandle.Lower, 0, WorldVertex.Stride);
graphics.DrawPrimitives(PrimitiveType.LineList, 0, 8); graphics.Draw(PrimitiveType.LineList, 0, 8);
} }
// Done // Done
@ -724,7 +724,7 @@ namespace CodeImp.DoomBuilder.Rendering
//render //render
graphics.SetVertexBuffer(0, vb, 0, WorldVertex.Stride); graphics.SetVertexBuffer(0, vb, 0, WorldVertex.Stride);
graphics.DrawPrimitives(PrimitiveType.LineList, 0, pointscount / 2); graphics.Draw(PrimitiveType.LineList, 0, pointscount / 2);
// Done // Done
graphics.SetTextureFactor(-1); graphics.SetTextureFactor(-1);
@ -827,7 +827,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetUniform(UniformName.desaturation, sector.Sector.Desaturation); graphics.SetUniform(UniformName.desaturation, sector.Sector.Desaturation);
// Render! // Render!
graphics.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles); graphics.Draw(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles);
} }
} }
} }
@ -938,7 +938,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetVertexBuffer(0, t.GeometryBuffer, 0, WorldVertex.Stride); graphics.SetVertexBuffer(0, t.GeometryBuffer, 0, WorldVertex.Stride);
// Render! // Render!
graphics.DrawPrimitives(PrimitiveType.TriangleList, 0, t.Triangles); graphics.Draw(PrimitiveType.TriangleList, 0, t.Triangles);
} }
} }
@ -1101,7 +1101,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetUniform(UniformName.highlightcolor, CalculateHighlightColor((g == highlighted) && showhighlight, (g.Selected && showselection))); graphics.SetUniform(UniformName.highlightcolor, CalculateHighlightColor((g == highlighted) && showhighlight, (g.Selected && showselection)));
// Render! // Render!
graphics.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles); graphics.Draw(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles);
} }
else graphics.SetUniform(UniformName.desaturation, 0.0f); else graphics.SetUniform(UniformName.desaturation, 0.0f);
} }
@ -1246,7 +1246,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetVertexBuffer(0, t.GeometryBuffer, 0, WorldVertex.Stride); graphics.SetVertexBuffer(0, t.GeometryBuffer, 0, WorldVertex.Stride);
// Render! // Render!
graphics.DrawPrimitives(PrimitiveType.TriangleList, 0, t.Triangles); graphics.Draw(PrimitiveType.TriangleList, 0, t.Triangles);
} }
} }
@ -1358,7 +1358,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetUniform(UniformName.light2Radius, new Vector2(CosDeg(lights[i].LightSpotRadius1), CosDeg(lights[i].LightSpotRadius2))); graphics.SetUniform(UniformName.light2Radius, new Vector2(CosDeg(lights[i].LightSpotRadius1), CosDeg(lights[i].LightSpotRadius2)));
} }
else graphics.SetUniform(UniformName.spotLight, false); else graphics.SetUniform(UniformName.spotLight, false);
graphics.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles); graphics.Draw(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles);
} }
} }
} }
@ -1385,7 +1385,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetUniform(UniformName.light2Radius, new Vector2(CosDeg(lights[i].LightSpotRadius1), CosDeg(lights[i].LightSpotRadius2))); graphics.SetUniform(UniformName.light2Radius, new Vector2(CosDeg(lights[i].LightSpotRadius1), CosDeg(lights[i].LightSpotRadius2)));
} }
else graphics.SetUniform(UniformName.spotLight, false); else graphics.SetUniform(UniformName.spotLight, false);
graphics.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles); graphics.Draw(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles);
} }
} }
} }
@ -1412,7 +1412,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetUniform(UniformName.light2Radius, new Vector2(CosDeg(lights[i].LightSpotRadius1), CosDeg(lights[i].LightSpotRadius2))); graphics.SetUniform(UniformName.light2Radius, new Vector2(CosDeg(lights[i].LightSpotRadius1), CosDeg(lights[i].LightSpotRadius2)));
} }
else graphics.SetUniform(UniformName.spotLight, false); else graphics.SetUniform(UniformName.spotLight, false);
graphics.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles); graphics.Draw(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles);
} }
} }
} }
@ -1440,7 +1440,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.SetUniform(UniformName.light2Radius, new Vector2(CosDeg(lights[i].LightSpotRadius1), CosDeg(lights[i].LightSpotRadius2))); graphics.SetUniform(UniformName.light2Radius, new Vector2(CosDeg(lights[i].LightSpotRadius1), CosDeg(lights[i].LightSpotRadius2)));
} }
else graphics.SetUniform(UniformName.spotLight, false); else graphics.SetUniform(UniformName.spotLight, false);
graphics.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles); graphics.Draw(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles);
} }
} }
} }
@ -1784,7 +1784,7 @@ namespace CodeImp.DoomBuilder.Rendering
if(sector != null) if(sector != null)
{ {
graphics.SetUniform(UniformName.highlightcolor, CalculateHighlightColor((g == highlighted) && showhighlight, (g.Selected && showselection))); graphics.SetUniform(UniformName.highlightcolor, CalculateHighlightColor((g == highlighted) && showhighlight, (g.Selected && showselection)));
graphics.DrawPrimitives(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles); graphics.Draw(PrimitiveType.TriangleList, g.VertexOffset, g.Triangles);
} }
} }
} }
@ -2033,7 +2033,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Draw // Draw
graphics.Shaders.SetDisplay2DSettings(1.0f, 1.0f, 0.0f, 1.0f, true); graphics.Shaders.SetDisplay2DSettings(1.0f, 1.0f, 0.0f, 1.0f, true);
graphics.DrawUserPrimitives(PrimitiveType.TriangleStrip, 0, 2, crosshairverts); graphics.Draw(PrimitiveType.TriangleStrip, 0, 2, crosshairverts);
} }
// This switches fog on and off // This switches fog on and off

View file

@ -629,7 +629,7 @@ namespace CodeImp.DoomBuilder.Rendering
} }
// Draw // Draw
graphics.DrawPrimitives(PrimitiveType.TriangleList, entry.vertexoffset + (entry.numvertices * surfacevertexoffsetmul), entry.numvertices / 3); graphics.Draw(PrimitiveType.TriangleList, entry.vertexoffset + (entry.numvertices * surfacevertexoffsetmul), entry.numvertices / 3);
} }
} }
graphics.SetUniform(UniformName.desaturation, 0.0f); graphics.SetUniform(UniformName.desaturation, 0.0f);