Added DrawPrimitives() for drawing multiple primitives (not optimized for now)
parent
37a69e5737
commit
d82b5ef746
|
@ -361,6 +361,18 @@ public:
|
||||||
//! Renders primitive composed of vertices with solid color
|
//! Renders primitive composed of vertices with solid color
|
||||||
virtual void DrawPrimitive(PrimitiveType type, const VertexCol *vertices , int vertexCount) = 0;
|
virtual void DrawPrimitive(PrimitiveType type, const VertexCol *vertices , int vertexCount) = 0;
|
||||||
|
|
||||||
|
//! Renders primitives composed of lists of vertices with single texture
|
||||||
|
virtual void DrawPrimitives(PrimitiveType type, const Vertex *vertices,
|
||||||
|
int first[], int count[], int drawCount,
|
||||||
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) = 0;
|
||||||
|
//! Renders primitives composed of lists of vertices with multitexturing (2 textures)
|
||||||
|
virtual void DrawPrimitives(PrimitiveType type, const VertexTex2 *vertices,
|
||||||
|
int first[], int count[], int drawCount,
|
||||||
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) = 0;
|
||||||
|
//! Renders primitives composed of lists of vertices with solid color
|
||||||
|
virtual void DrawPrimitives(PrimitiveType type, const VertexCol *vertices,
|
||||||
|
int first[], int count[], int drawCount) = 0;
|
||||||
|
|
||||||
//! Creates a static buffer composed of given primitives with single texture vertices
|
//! Creates a static buffer composed of given primitives with single texture vertices
|
||||||
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) = 0;
|
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) = 0;
|
||||||
|
|
||||||
|
|
|
@ -162,6 +162,21 @@ void CNullDevice::DrawPrimitive(PrimitiveType type, const VertexCol *vertices, i
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CNullDevice::DrawPrimitives(PrimitiveType type, const Vertex *vertices,
|
||||||
|
int first[], int count[], int drawCount, Color color)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::DrawPrimitives(PrimitiveType type, const VertexTex2 *vertices,
|
||||||
|
int first[], int count[], int drawCount, Color color)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::DrawPrimitives(PrimitiveType type, const VertexCol *vertices,
|
||||||
|
int first[], int count[], int drawCount)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int CNullDevice::CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount)
|
unsigned int CNullDevice::CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -85,7 +85,16 @@ public:
|
||||||
|
|
||||||
void DrawPrimitive(PrimitiveType type, const Vertex* vertices, int vertexCount, Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
void DrawPrimitive(PrimitiveType type, const Vertex* vertices, int vertexCount, Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
void DrawPrimitive(PrimitiveType type, const VertexTex2* vertices, int vertexCount, Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
void DrawPrimitive(PrimitiveType type, const VertexTex2* vertices, int vertexCount, Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
void DrawPrimitive(PrimitiveType type, const VertexCol *vertices , int vertexCount) override;
|
void DrawPrimitive(PrimitiveType type, const VertexCol *vertices, int vertexCount) override;
|
||||||
|
|
||||||
|
void DrawPrimitives(PrimitiveType type, const Vertex *vertices,
|
||||||
|
int first[], int count[], int drawCount,
|
||||||
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
|
void DrawPrimitives(PrimitiveType type, const VertexTex2 *vertices,
|
||||||
|
int first[], int count[], int drawCount,
|
||||||
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
|
void DrawPrimitives(PrimitiveType type, const VertexCol *vertices,
|
||||||
|
int first[], int count[], int drawCount) override;
|
||||||
|
|
||||||
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) override;
|
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) override;
|
||||||
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) override;
|
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) override;
|
||||||
|
|
|
@ -1250,6 +1250,39 @@ void CGL21Device::DrawPrimitive(PrimitiveType type, const VertexCol *vertices, i
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGL21Device::DrawPrimitives(PrimitiveType type, const Vertex *vertices,
|
||||||
|
int first[], int count[], int drawCount, Color color)
|
||||||
|
{
|
||||||
|
// TODO: use glMultiDrawArrays()
|
||||||
|
|
||||||
|
for (int i = 0; i < drawCount; i++)
|
||||||
|
{
|
||||||
|
DrawPrimitive(type, vertices + first[i], count[i], color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGL21Device::DrawPrimitives(PrimitiveType type, const VertexTex2 *vertices,
|
||||||
|
int first[], int count[], int drawCount, Color color)
|
||||||
|
{
|
||||||
|
// TODO: use glMultiDrawArrays()
|
||||||
|
|
||||||
|
for (int i = 0; i < drawCount; i++)
|
||||||
|
{
|
||||||
|
DrawPrimitive(type, vertices + first[i], count[i], color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGL21Device::DrawPrimitives(PrimitiveType type, const VertexCol *vertices,
|
||||||
|
int first[], int count[], int drawCount)
|
||||||
|
{
|
||||||
|
// TODO: use glMultiDrawArrays()
|
||||||
|
|
||||||
|
for (int i = 0; i < drawCount; i++)
|
||||||
|
{
|
||||||
|
DrawPrimitive(type, vertices + first[i], count[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int CGL21Device::CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount)
|
unsigned int CGL21Device::CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount)
|
||||||
{
|
{
|
||||||
unsigned int id = ++m_lastVboId;
|
unsigned int id = ++m_lastVboId;
|
||||||
|
|
|
@ -100,7 +100,16 @@ public:
|
||||||
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
virtual void DrawPrimitive(PrimitiveType type, const VertexTex2 *vertices, int vertexCount,
|
virtual void DrawPrimitive(PrimitiveType type, const VertexTex2 *vertices, int vertexCount,
|
||||||
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
void DrawPrimitive(PrimitiveType type, const VertexCol *vertices , int vertexCount) override;
|
virtual void DrawPrimitive(PrimitiveType type, const VertexCol *vertices, int vertexCount) override;
|
||||||
|
|
||||||
|
virtual void DrawPrimitives(PrimitiveType type, const Vertex *vertices,
|
||||||
|
int first[], int count[], int drawCount,
|
||||||
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
|
virtual void DrawPrimitives(PrimitiveType type, const VertexTex2 *vertices,
|
||||||
|
int first[], int count[], int drawCount,
|
||||||
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
|
virtual void DrawPrimitives(PrimitiveType type, const VertexCol *vertices,
|
||||||
|
int first[], int count[], int drawCount) override;
|
||||||
|
|
||||||
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) override;
|
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) override;
|
||||||
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) override;
|
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) override;
|
||||||
|
|
|
@ -1328,6 +1328,39 @@ void CGL33Device::DrawPrimitive(PrimitiveType type, const VertexCol *vertices, i
|
||||||
glDrawArrays(TranslateGfxPrimitive(type), 0, vertexCount);
|
glDrawArrays(TranslateGfxPrimitive(type), 0, vertexCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGL33Device::DrawPrimitives(PrimitiveType type, const Vertex *vertices,
|
||||||
|
int first[], int count[], int drawCount, Color color)
|
||||||
|
{
|
||||||
|
// TODO: use glMultiDrawArrays()
|
||||||
|
|
||||||
|
for (int i = 0; i < drawCount; i++)
|
||||||
|
{
|
||||||
|
DrawPrimitive(type, vertices + first[i], count[i], color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGL33Device::DrawPrimitives(PrimitiveType type, const VertexTex2 *vertices,
|
||||||
|
int first[], int count[], int drawCount, Color color)
|
||||||
|
{
|
||||||
|
// TODO: use glMultiDrawArrays()
|
||||||
|
|
||||||
|
for (int i = 0; i < drawCount; i++)
|
||||||
|
{
|
||||||
|
DrawPrimitive(type, vertices + first[i], count[i], color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGL33Device::DrawPrimitives(PrimitiveType type, const VertexCol *vertices,
|
||||||
|
int first[], int count[], int drawCount)
|
||||||
|
{
|
||||||
|
// TODO: use glMultiDrawArrays()
|
||||||
|
|
||||||
|
for (int i = 0; i < drawCount; i++)
|
||||||
|
{
|
||||||
|
DrawPrimitive(type, vertices + first[i], count[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int CGL33Device::CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount)
|
unsigned int CGL33Device::CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount)
|
||||||
{
|
{
|
||||||
unsigned int id = 0;
|
unsigned int id = 0;
|
||||||
|
|
|
@ -102,7 +102,16 @@ public:
|
||||||
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
virtual void DrawPrimitive(PrimitiveType type, const VertexTex2 *vertices, int vertexCount,
|
virtual void DrawPrimitive(PrimitiveType type, const VertexTex2 *vertices, int vertexCount,
|
||||||
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
void DrawPrimitive(PrimitiveType type, const VertexCol *vertices , int vertexCount) override;
|
virtual void DrawPrimitive(PrimitiveType type, const VertexCol *vertices , int vertexCount) override;
|
||||||
|
|
||||||
|
virtual void DrawPrimitives(PrimitiveType type, const Vertex *vertices,
|
||||||
|
int first[], int count[], int drawCount,
|
||||||
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
|
virtual void DrawPrimitives(PrimitiveType type, const VertexTex2 *vertices,
|
||||||
|
int first[], int count[], int drawCount,
|
||||||
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
|
virtual void DrawPrimitives(PrimitiveType type, const VertexCol *vertices,
|
||||||
|
int first[], int count[], int drawCount) override;
|
||||||
|
|
||||||
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) override;
|
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) override;
|
||||||
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) override;
|
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) override;
|
||||||
|
|
|
@ -1273,6 +1273,39 @@ void CGLDevice::DrawPrimitive(PrimitiveType type, const VertexCol *vertices, int
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGLDevice::DrawPrimitives(PrimitiveType type, const Vertex *vertices,
|
||||||
|
int first[], int count[], int drawCount, Color color)
|
||||||
|
{
|
||||||
|
// TODO: use glMultiDrawArrays() for OpenGL 1.4+
|
||||||
|
|
||||||
|
for (int i = 0; i < drawCount; i++)
|
||||||
|
{
|
||||||
|
DrawPrimitive(type, vertices + first[i], count[i], color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGLDevice::DrawPrimitives(PrimitiveType type, const VertexTex2 *vertices,
|
||||||
|
int first[], int count[], int drawCount, Color color)
|
||||||
|
{
|
||||||
|
// TODO: use glMultiDrawArrays() for OpenGL 1.4+
|
||||||
|
|
||||||
|
for (int i = 0; i < drawCount; i++)
|
||||||
|
{
|
||||||
|
DrawPrimitive(type, vertices + first[i], count[i], color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGLDevice::DrawPrimitives(PrimitiveType type, const VertexCol *vertices,
|
||||||
|
int first[], int count[], int drawCount)
|
||||||
|
{
|
||||||
|
// TODO: use glMultiDrawArrays() for OpenGL 1.4+
|
||||||
|
|
||||||
|
for (int i = 0; i < drawCount; i++)
|
||||||
|
{
|
||||||
|
DrawPrimitive(type, vertices + first[i], count[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int CGLDevice::CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount)
|
unsigned int CGLDevice::CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount)
|
||||||
{
|
{
|
||||||
unsigned int id = 0;
|
unsigned int id = 0;
|
||||||
|
|
|
@ -119,7 +119,16 @@ public:
|
||||||
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
virtual void DrawPrimitive(PrimitiveType type, const VertexTex2 *vertices, int vertexCount,
|
virtual void DrawPrimitive(PrimitiveType type, const VertexTex2 *vertices, int vertexCount,
|
||||||
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
void DrawPrimitive(PrimitiveType type, const VertexCol *vertices , int vertexCount) override;
|
virtual void DrawPrimitive(PrimitiveType type, const VertexCol *vertices, int vertexCount) override;
|
||||||
|
|
||||||
|
virtual void DrawPrimitives(PrimitiveType type, const Vertex *vertices,
|
||||||
|
int first[], int count[], int drawCount,
|
||||||
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
|
virtual void DrawPrimitives(PrimitiveType type, const VertexTex2 *vertices,
|
||||||
|
int first[], int count[], int drawCount,
|
||||||
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||||
|
virtual void DrawPrimitives(PrimitiveType type, const VertexCol *vertices,
|
||||||
|
int first[], int count[], int drawCount) override;
|
||||||
|
|
||||||
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) override;
|
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) override;
|
||||||
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) override;
|
unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) override;
|
||||||
|
|
Loading…
Reference in New Issue