forked from mirrors/0ad
Removes low-level GL calls from graphics and geometrics primitives and adds DebugRenderer.
Tested By: Freagarach Differential Revision: https://code.wildfiregames.com/D3857 This was SVN commit r25269.
This commit is contained in:
@@ -392,69 +392,3 @@ void CCamera::LookAlong(const CVector3D& camera, CVector3D orientation, CVector3
|
||||
m_Orientation._31 = -s.Z; m_Orientation._32 = up.Z; m_Orientation._33 = orientation.Z; m_Orientation._34 = camera.Z;
|
||||
m_Orientation._41 = 0.0f; m_Orientation._42 = 0.0f; m_Orientation._43 = 0.0f; m_Orientation._44 = 1.0f;
|
||||
}
|
||||
|
||||
// Render the camera's frustum
|
||||
void CCamera::Render(int intermediates) const
|
||||
{
|
||||
#if CONFIG2_GLES
|
||||
#warning TODO: implement camera frustum for GLES
|
||||
#else
|
||||
Quad nearPoints;
|
||||
Quad farPoints;
|
||||
|
||||
GetViewQuad(m_NearPlane, nearPoints);
|
||||
GetViewQuad(m_FarPlane, farPoints);
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
nearPoints[i] = m_Orientation.Transform(nearPoints[i]);
|
||||
farPoints[i] = m_Orientation.Transform(farPoints[i]);
|
||||
}
|
||||
|
||||
// near plane
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex3fv(&nearPoints[0].X);
|
||||
glVertex3fv(&nearPoints[1].X);
|
||||
glVertex3fv(&nearPoints[2].X);
|
||||
glVertex3fv(&nearPoints[3].X);
|
||||
glEnd();
|
||||
|
||||
// far plane
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex3fv(&farPoints[0].X);
|
||||
glVertex3fv(&farPoints[1].X);
|
||||
glVertex3fv(&farPoints[2].X);
|
||||
glVertex3fv(&farPoints[3].X);
|
||||
glEnd();
|
||||
|
||||
// connection lines
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
glVertex3fv(&nearPoints[0].X);
|
||||
glVertex3fv(&farPoints[0].X);
|
||||
glVertex3fv(&nearPoints[1].X);
|
||||
glVertex3fv(&farPoints[1].X);
|
||||
glVertex3fv(&nearPoints[2].X);
|
||||
glVertex3fv(&farPoints[2].X);
|
||||
glVertex3fv(&nearPoints[3].X);
|
||||
glVertex3fv(&farPoints[3].X);
|
||||
glVertex3fv(&nearPoints[0].X);
|
||||
glVertex3fv(&farPoints[0].X);
|
||||
glEnd();
|
||||
|
||||
// intermediate planes
|
||||
CVector3D intermediatePoints[4];
|
||||
for(int i = 0; i < intermediates; ++i)
|
||||
{
|
||||
float t = (i+1.0)/(intermediates+1.0);
|
||||
|
||||
for(int j = 0; j < 4; ++j)
|
||||
intermediatePoints[j] = nearPoints[j]*t + farPoints[j]*(1.0-t);
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex3fv(&intermediatePoints[0].X);
|
||||
glVertex3fv(&intermediatePoints[1].X);
|
||||
glVertex3fv(&intermediatePoints[2].X);
|
||||
glVertex3fv(&intermediatePoints[3].X);
|
||||
glEnd();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user