refactor to allow various gfx backends (work-in-progress)
This commit is contained in:
@@ -951,7 +951,7 @@ void GLInstancingRenderer::init()
|
||||
}
|
||||
|
||||
|
||||
void b3CreateFrustum(
|
||||
static void b3CreateFrustum(
|
||||
float left,
|
||||
float right,
|
||||
float bottom,
|
||||
@@ -984,14 +984,14 @@ void b3CreateFrustum(
|
||||
}
|
||||
|
||||
|
||||
void b3Matrix4x4Mul(GLfloat aIn[4][4], GLfloat bIn[4][4], GLfloat result[4][4])
|
||||
static void b3Matrix4x4Mul(GLfloat aIn[4][4], GLfloat bIn[4][4], GLfloat result[4][4])
|
||||
{
|
||||
for (int j=0;j<4;j++)
|
||||
for (int i=0;i<4;i++)
|
||||
result[j][i] = aIn[0][i] * bIn[j][0] + aIn[1][i] * bIn[j][1] + aIn[2][i] * bIn[j][2] + aIn[3][i] * bIn[j][3];
|
||||
}
|
||||
|
||||
void b3Matrix4x4Mul16(GLfloat aIn[16], GLfloat bIn[16], GLfloat result[16])
|
||||
static void b3Matrix4x4Mul16(GLfloat aIn[16], GLfloat bIn[16], GLfloat result[16])
|
||||
{
|
||||
for (int j=0;j<4;j++)
|
||||
for (int i=0;i<4;i++)
|
||||
@@ -999,7 +999,7 @@ void b3Matrix4x4Mul16(GLfloat aIn[16], GLfloat bIn[16], GLfloat result[16])
|
||||
}
|
||||
|
||||
|
||||
void b3CreateDiagonalMatrix(GLfloat value, GLfloat result[4][4])
|
||||
static void b3CreateDiagonalMatrix(GLfloat value, GLfloat result[4][4])
|
||||
{
|
||||
for (int i=0;i<4;i++)
|
||||
{
|
||||
@@ -1016,7 +1016,7 @@ void b3CreateDiagonalMatrix(GLfloat value, GLfloat result[4][4])
|
||||
}
|
||||
}
|
||||
|
||||
void b3CreateOrtho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar, GLfloat result[4][4])
|
||||
static void b3CreateOrtho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar, GLfloat result[4][4])
|
||||
{
|
||||
b3CreateDiagonalMatrix(1.f,result);
|
||||
|
||||
@@ -1028,7 +1028,7 @@ void b3CreateOrtho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLf
|
||||
result[3][2] = - (zFar + zNear) / (zFar - zNear);
|
||||
}
|
||||
|
||||
void b3CreateLookAt(const b3Vector3& eye, const b3Vector3& center,const b3Vector3& up, GLfloat result[16])
|
||||
static void b3CreateLookAt(const b3Vector3& eye, const b3Vector3& center,const b3Vector3& up, GLfloat result[16])
|
||||
{
|
||||
b3Vector3 f = (center - eye).normalized();
|
||||
b3Vector3 u = up.normalized();
|
||||
@@ -1172,9 +1172,13 @@ float GLInstancingRenderer::getCameraPitch() const
|
||||
return m_data->m_azi;
|
||||
}
|
||||
|
||||
void GLInstancingRenderer::setCameraTargetPosition(float x, float y, float z)
|
||||
{
|
||||
m_data->m_cameraTargetPosition = b3MakeVector3(x,y,z);
|
||||
}
|
||||
void GLInstancingRenderer::setCameraTargetPosition(float cameraPos[4])
|
||||
{
|
||||
m_data->m_cameraTargetPosition = b3MakeVector3(cameraPos[0],cameraPos[1],cameraPos[2]);
|
||||
setCameraTargetPosition(cameraPos[0],cameraPos[1],cameraPos[2]);
|
||||
}
|
||||
|
||||
void GLInstancingRenderer::getCameraTargetPosition(float cameraPos[4]) const
|
||||
|
||||
Reference in New Issue
Block a user