bt -> b3 and BT -> B3 rename for content and filenames

This commit is contained in:
erwin coumans
2013-04-28 23:11:10 -07:00
parent 6bcb5b9d5f
commit 7366e262fd
178 changed files with 5218 additions and 5218 deletions

View File

@@ -30,7 +30,7 @@ Gwen::Controls::Canvas* pCanvas = NULL;
void MyMouseMoveCallback( float x, float y)
{
//btDefaultMouseCallback(button,state,x,y);
//b3DefaultMouseCallback(button,state,x,y);
static int m_lastmousepos[2] = {0,0};
static bool isInitialized = false;
@@ -48,7 +48,7 @@ void MyMouseMoveCallback( float x, float y)
void MyMouseButtonCallback(int button, int state, float x, float y)
{
//btDefaultMouseCallback(button,state,x,y);
//b3DefaultMouseCallback(button,state,x,y);
if (pCanvas)
{
@@ -219,8 +219,8 @@ int main()
float retinaScale = 1.f;
btgDefaultOpenGLWindow* window = new btgDefaultOpenGLWindow();
btgWindowConstructionInfo wci;
b3gDefaultOpenGLWindow* window = new b3gDefaultOpenGLWindow();
b3gWindowConstructionInfo wci;
wci.m_width = sWidth;
wci.m_height = sHeight;

View File

@@ -94,7 +94,7 @@ void loadBufferData(){
glBindBuffer(GL_ARRAY_BUFFER, sData.m_vertexBuffer);
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(Vertex), vertexData, GL_STATIC_DRAW);
GLuint err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
@@ -105,7 +105,7 @@ void loadBufferData(){
glEnableVertexAttribArray(sData.m_positionAttribute);
glEnableVertexAttribArray(sData.m_colourAttribute);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
glEnableVertexAttribArray(sData.m_textureAttribute);
@@ -113,7 +113,7 @@ void loadBufferData(){
glVertexAttribPointer(sData.m_colourAttribute , 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)sizeof(vec4));
glVertexAttribPointer(sData.m_textureAttribute , 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)(sizeof(vec4)+sizeof(vec4)));
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
}
@@ -123,15 +123,15 @@ void initTestTexture()
glGenTextures(1,(GLuint*)&sData.m_texturehandle);
GLint err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
glBindTexture(GL_TEXTURE_2D,sData.m_texturehandle);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
int width=256;
int height=256;
@@ -150,12 +150,12 @@ void initTestTexture()
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, width,height,0,GL_RED,GL_UNSIGNED_BYTE,image);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
glGenerateMipmap(GL_TEXTURE_2D);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
free(image);
@@ -206,19 +206,19 @@ void loadShader(){
sData.m_positionUniform = glGetUniformLocation(sData.m_shaderProg, "p");
if (sData.m_positionUniform < 0) {
btAssert(0);
b3Assert(0);
}
sData.m_colourAttribute = glGetAttribLocation(sData.m_shaderProg, "colour");
if (sData.m_colourAttribute < 0) {
btAssert(0);
b3Assert(0);
}
sData.m_positionAttribute = glGetAttribLocation(sData.m_shaderProg, "position");
if (sData.m_positionAttribute < 0) {
btAssert(0);
b3Assert(0);
}
sData.m_textureAttribute = glGetAttribLocation(sData.m_shaderProg,"texuv");
if (sData.m_textureAttribute < 0) {
btAssert(0);
b3Assert(0);
}
}
@@ -227,7 +227,7 @@ void display() {
GLint err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
const float timeScale = 0.008f;
@@ -236,30 +236,30 @@ void display() {
glBindVertexArray(sData.m_vertexArrayObject);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
// glBindTexture(GL_TEXTURE_2D,sData.m_texturehandle);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
vec2 p( 0.f,0.f);//?b?0.5f * sinf(timeValue), 0.5f * cosf(timeValue) );
glUniform2fv(sData.m_positionUniform, 1, (const GLfloat *)&p);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
glEnableVertexAttribArray(sData.m_positionAttribute);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
glEnableVertexAttribArray(sData.m_colourAttribute);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
glEnableVertexAttribArray(sData.m_textureAttribute);
@@ -267,18 +267,18 @@ void display() {
glVertexAttribPointer(sData.m_colourAttribute , 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)sizeof(vec4));
glVertexAttribPointer(sData.m_textureAttribute , 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)(sizeof(vec4)+sizeof(vec4)));
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, sData.m_indexBuffer);
//glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
int indexCount = 6;
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
// glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, 0);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
// glutSwapBuffers();
}
@@ -325,8 +325,8 @@ int main(int argc, char* argv[])
printf("\n");
btgDefaultOpenGLWindow* window = new btgDefaultOpenGLWindow();
window->createWindow(btgWindowConstructionInfo(width,height));
b3gDefaultOpenGLWindow* window = new b3gDefaultOpenGLWindow();
window->createWindow(b3gWindowConstructionInfo(width,height));
window->setWindowTitle("font test");
@@ -347,7 +347,7 @@ int main(int argc, char* argv[])
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
// render.InitShaders();
@@ -356,12 +356,12 @@ int main(int argc, char* argv[])
window->runMainLoop();
// window->setMouseCallback(btDefaultMouseCallback);
// window->setKeyboardCallback(btDefaultKeyboardCallback);
// window->setWheelCallback(btDefaultWheelCallback);
// window->setMouseCallback(b3DefaultMouseCallback);
// window->setKeyboardCallback(b3DefaultKeyboardCallback);
// window->setWheelCallback(b3DefaultWheelCallback);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
int done;
@@ -381,7 +381,7 @@ int main(int argc, char* argv[])
stash = sth_create(fontTextureWidth,fontTextureHeight,renderCallbacks);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
if (!stash)
{
@@ -404,9 +404,9 @@ int main(int argc, char* argv[])
#ifdef LOAD_FONT_FROM_FILE
unsigned char* data;
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
btAssert(fp);
b3Assert(fp);
if (fp)
{
fseek(fp, 0, SEEK_END);
@@ -415,7 +415,7 @@ int main(int argc, char* argv[])
data = (unsigned char*)malloc(datasize);
if (data == NULL)
{
btAssert(0);
b3Assert(0);
return -1;
}
else
@@ -425,18 +425,18 @@ int main(int argc, char* argv[])
}
if (!(droidRegular = sth_add_font_from_memory(stash, data)))
{
btAssert(0);
b3Assert(0);
return -1;
}
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
// Load the remaining truetype fonts directly.
sprintf(fullFontFileName,"%s%s",fontPath,"DroidSerif-Italic.ttf");
if (!(droidItalic = sth_add_font(stash,fullFontFileName)))
{
btAssert(0);
b3Assert(0);
return -1;
}
sprintf(fullFontFileName,"%s%s",fontPath,"DroidSerif-Bold.ttf");
@@ -444,20 +444,20 @@ int main(int argc, char* argv[])
if (!(droidBold = sth_add_font(stash,fullFontFileName)))
{
btAssert(0);
b3Assert(0);
return -1;
}
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
sprintf(fullFontFileName,"%s%s",fontPath,"DroidSansJapanese.ttf");
if (!(droidJapanese = sth_add_font(stash,fullFontFileName)))
{
btAssert(0);
b3Assert(0);
return -1;
}
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
#else//LOAD_FONT_FROM_FILE
char* data2 = OpenSansData;
unsigned char* data = (unsigned char*) data2;
@@ -473,17 +473,17 @@ int main(int argc, char* argv[])
{
CProfileManager::Reset();
GLint err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
// glClearColor(0.5f,0.5f,0.5f,1.f);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
window->startRendering();
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
glClearColor(1,1,1,1);//.4, .4, 0.4, 1.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
@@ -491,40 +491,40 @@ int main(int argc, char* argv[])
//display();
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
if (1)
{
BT_PROFILE("font stash rendering");
B3_PROFILE("font stash rendering");
// Update and render
glEnable(GL_BLEND);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
glDisable(GL_DEPTH_TEST);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
//glColor4ub(255,0,0,255);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
glEnable(GL_BLEND);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
sx = 0; sy = height;
@@ -548,7 +548,7 @@ int main(int argc, char* argv[])
}
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
if (0)
for (int i=0;i<1;i++)
@@ -558,7 +558,7 @@ int main(int argc, char* argv[])
{
//need to save this file as UTF-8 without signature, codepage 650001 in Visual Studio
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
//sth_draw_text(stash, droidJapanese,16.f, dx, dy-36, (const char*) "\xE7\xA7\x81\xE3\x81\xAF\xE3\x82\xAC\xE3\x83\xA9\xE3\x82\xB9\xE3\x82\x92\xE9\xA3\x9F\xE3\x81\xB9\xE3\x82\x89\xE3\x82\x8C\xE3\x81\xBE\xE3\x81\x99\xE3\x80\x82",&dx,
// width,height);//はabcdefghijlkmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_-+=?/\][{}.,<>`~@#$%^", &dx);
@@ -567,7 +567,7 @@ int main(int argc, char* argv[])
dx = sx;
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
sth_flush_draw(stash);
dx=0;
sth_draw_text(stash, droidRegular,14.f, dx, dy-80, "How does this OpenGL True Type font look? ", &dx,width,height);
@@ -590,7 +590,7 @@ int main(int argc, char* argv[])
sth_flush_draw(stash);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
} else
@@ -599,12 +599,12 @@ int main(int argc, char* argv[])
dy = height;
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
sth_draw_texture(stash, droidRegular, 16.f, 0, 0,width,height, "a", &dx);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
dumpTextureToPng(fontTextureWidth, fontTextureHeight,"newPic.png");
@@ -613,27 +613,27 @@ int main(int argc, char* argv[])
once++;
}
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
sth_end_draw(stash);
glEnable(GL_DEPTH_TEST);
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
//glFinish();
}
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
window->endRendering();
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
{
BT_PROFILE("glFinish");
B3_PROFILE("glFinish");
glFinish();
}
@@ -659,7 +659,7 @@ int main(int argc, char* argv[])
}
err = glGetError();
btAssert(err==GL_NO_ERROR);
b3Assert(err==GL_NO_ERROR);
}

View File

@@ -276,7 +276,7 @@ unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_l
stbi__sbpush(out, 0x78); // DEFLATE 32K window
stbi__sbpush(out, 0x5e); // FLEVEL = 1
stbi__zlib_add(1,1); // BFINAL = 1
stbi__zlib_add(1,2); // BTYPE = 1 -- fixed huffman
stbi__zlib_add(1,2); // B3YPE = 1 -- fixed huffman
for (i=0; i < stbi__ZHASH; ++i)
hash_table[i] = NULL;

View File

@@ -30,11 +30,11 @@ subject to the following restrictions:
//#include "../../opencl/gpu_rigidbody_pipeline/btGpuNarrowphaseAndSolver.h"//for m_maxNumObjectCapacity
//#include "../../opencl/gpu_rigidbody_pipeline/b3GpuNarrowphaseAndSolver.h"//for m_maxNumObjectCapacity
static InternalDataRenderer* sData2;
struct btGraphicsInstance
struct b3GraphicsInstance
{
GLuint m_cube_vao;
GLuint m_index_vbo;
@@ -49,7 +49,7 @@ struct btGraphicsInstance
int m_vertexArrayOffset;
int m_primitiveType;
btGraphicsInstance() :m_cube_vao(-1),m_index_vbo(-1),m_numIndices(-1),m_numVertices(-1),m_numGraphicsInstances(0),m_instanceOffset(0),m_vertexArrayOffset(0),m_primitiveType(BT_GL_TRIANGLES),m_texturehandle(0)
b3GraphicsInstance() :m_cube_vao(-1),m_index_vbo(-1),m_numIndices(-1),m_numVertices(-1),m_numGraphicsInstances(0),m_instanceOffset(0),m_vertexArrayOffset(0),m_primitiveType(B3_GL_TRIANGLES),m_texturehandle(0)
{
}
@@ -124,7 +124,7 @@ struct InternalDataRenderer : public GLInstanceRendererInternalData
{
if (!m_mouseButton)
{
if (btFabs(deltax)>btFabs(deltay))
if (b3Fabs(deltax)>b3Fabs(deltay))
{
m_azi -= deltax*0.1;
@@ -137,7 +137,7 @@ struct InternalDataRenderer : public GLInstanceRendererInternalData
}
} else
{
if (btFabs(deltax)>btFabs(deltay))
if (b3Fabs(deltax)>b3Fabs(deltay))
{
b3Vector3 fwd = m_cameraTargetPosition-m_cameraPosition;
b3Vector3 side = m_cameraUp.cross(fwd);
@@ -158,7 +158,7 @@ struct InternalDataRenderer : public GLInstanceRendererInternalData
{
float xDelta = x-m_mouseXpos;
float yDelta = y-m_mouseYpos;
// if (btFabs(xDelta)>btFabs(yDelta))
// if (b3Fabs(xDelta)>b3Fabs(yDelta))
// {
m_azi += xDelta*0.1;
// } else
@@ -191,23 +191,23 @@ struct GLInstanceRendererInternalData* GLInstancingRenderer::getInternalData()
return m_data;
}
void btDefaultWheelCallback(float deltax, float deltay)
void b3DefaultWheelCallback(float deltax, float deltay)
{
if (sData2)
sData2->wheelCallback(deltax,deltay);
}
void btDefaultMouseButtonCallback(int button, int state, float x, float y)
void b3DefaultMouseButtonCallback(int button, int state, float x, float y)
{
if (sData2)
sData2->mouseButtonCallback(button, state, x, y);
}
void btDefaultMouseMoveCallback( float x, float y)
void b3DefaultMouseMoveCallback( float x, float y)
{
if (sData2)
sData2->mouseMoveCallback( x, y);
}
void btDefaultKeyboardCallback(int key, int state)
void b3DefaultKeyboardCallback(int key, int state)
{
}
@@ -535,11 +535,11 @@ void GLInstancingRenderer::writeSingleInstanceTransformToGPU(float* position, fl
glFlush();
char* orgBase = (char*)glMapBuffer( GL_ARRAY_BUFFER,GL_READ_WRITE);
//btGraphicsInstance* gfxObj = m_graphicsInstances[k];
//b3GraphicsInstance* gfxObj = m_graphicsInstances[k];
int totalNumInstances= 0;
for (int k=0;k<m_graphicsInstances.size();k++)
{
btGraphicsInstance* gfxObj = m_graphicsInstances[k];
b3GraphicsInstance* gfxObj = m_graphicsInstances[k];
totalNumInstances+=gfxObj->m_numGraphicsInstances;
}
@@ -581,7 +581,7 @@ void GLInstancingRenderer::writeTransforms()
for (int k=0;k<m_graphicsInstances.size();k++)
{
btGraphicsInstance* gfxObj = m_graphicsInstances[k];
b3GraphicsInstance* gfxObj = m_graphicsInstances[k];
totalNumInstances+=gfxObj->m_numGraphicsInstances;
}
@@ -590,7 +590,7 @@ void GLInstancingRenderer::writeTransforms()
for (int k=0;k<m_graphicsInstances.size();k++)
{
//int k=0;
btGraphicsInstance* gfxObj = m_graphicsInstances[k];
b3GraphicsInstance* gfxObj = m_graphicsInstances[k];
@@ -654,10 +654,10 @@ void GLInstancingRenderer::writeTransforms()
int GLInstancingRenderer::registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling)
{
btAssert(shapeIndex == (m_graphicsInstances.size()-1));
btAssert(m_graphicsInstances.size()<m_maxNumObjectCapacity-1);
b3Assert(shapeIndex == (m_graphicsInstances.size()-1));
b3Assert(m_graphicsInstances.size()<m_maxNumObjectCapacity-1);
btGraphicsInstance* gfxObj = m_graphicsInstances[shapeIndex];
b3GraphicsInstance* gfxObj = m_graphicsInstances[shapeIndex];
int index = gfxObj->m_numGraphicsInstances + gfxObj->m_instanceOffset;
@@ -689,12 +689,12 @@ int GLInstancingRenderer::registerGraphicsInstance(int shapeIndex, const float*
int GLInstancingRenderer::registerShape(const float* vertices, int numvertices, const int* indices, int numIndices,int primitiveType)
{
btGraphicsInstance* gfxObj = new btGraphicsInstance;
b3GraphicsInstance* gfxObj = new b3GraphicsInstance;
gfxObj->m_primitiveType = primitiveType;
if (m_graphicsInstances.size())
{
btGraphicsInstance* prevObj = m_graphicsInstances[m_graphicsInstances.size()-1];
b3GraphicsInstance* prevObj = m_graphicsInstances[m_graphicsInstances.size()-1];
gfxObj->m_instanceOffset = prevObj->m_instanceOffset + prevObj->m_numGraphicsInstances;
gfxObj->m_vertexArrayOffset = prevObj->m_vertexArrayOffset + prevObj->m_numVertices;
} else
@@ -814,7 +814,7 @@ void GLInstancingRenderer::init()
assert(err==GL_NO_ERROR);
{
BT_PROFILE("texture");
B3_PROFILE("texture");
if(m_textureenabled)
{
if(!m_textureinitialized)
@@ -918,7 +918,7 @@ void GLInstancingRenderer::init()
}
void btCreateFrustum(
void b3CreateFrustum(
float left,
float right,
float bottom,
@@ -952,7 +952,7 @@ void btCreateFrustum(
void btCreateLookAt(const b3Vector3& eye, const b3Vector3& center,const b3Vector3& up, GLfloat result[16])
void b3CreateLookAt(const b3Vector3& eye, const b3Vector3& center,const b3Vector3& up, GLfloat result[16])
{
b3Vector3 f = (center - eye).normalized();
b3Vector3 u = up.normalized();
@@ -1049,13 +1049,13 @@ void GLInstancingRenderer::updateCamera()
if (m_glutScreenWidth > m_glutScreenHeight)
{
btCreateFrustum(-aspect * m_frustumZNear, aspect * m_frustumZNear, -m_frustumZNear, m_frustumZNear, m_frustumZNear, m_frustumZFar,projectionMatrix);
b3CreateFrustum(-aspect * m_frustumZNear, aspect * m_frustumZNear, -m_frustumZNear, m_frustumZNear, m_frustumZNear, m_frustumZFar,projectionMatrix);
} else
{
btCreateFrustum(-aspect * m_frustumZNear, aspect * m_frustumZNear, -m_frustumZNear, m_frustumZNear, m_frustumZNear, m_frustumZFar,projectionMatrix);
b3CreateFrustum(-aspect * m_frustumZNear, aspect * m_frustumZNear, -m_frustumZNear, m_frustumZNear, m_frustumZNear, m_frustumZFar,projectionMatrix);
}
btCreateLookAt(m_data->m_cameraPosition,m_data->m_cameraTargetPosition,m_data->m_cameraUp,modelviewMatrix);
b3CreateLookAt(m_data->m_cameraPosition,m_data->m_cameraTargetPosition,m_data->m_cameraUp,modelviewMatrix);
}
@@ -1108,7 +1108,7 @@ void GLInstancingRenderer::getMouseDirection(float* dir, int x, int y)
float bottom = -1.f;
float nearPlane = 1.f;
float tanFov = (top-bottom)*0.5f / nearPlane;
float fov = b3Scalar(2.0) * btAtan(tanFov);
float fov = b3Scalar(2.0) * b3Atan(tanFov);
b3Vector3 rayFrom = m_data->m_cameraPosition;
b3Vector3 rayForward = (m_data->m_cameraTargetPosition-m_data->m_cameraPosition);
@@ -1156,10 +1156,10 @@ void GLInstancingRenderer::getMouseDirection(float* dir, int x, int y)
void GLInstancingRenderer::RenderScene(void)
{
BT_PROFILE("GLInstancingRenderer::RenderScene");
B3_PROFILE("GLInstancingRenderer::RenderScene");
{
BT_PROFILE("init");
B3_PROFILE("init");
init();
}
@@ -1167,7 +1167,7 @@ void GLInstancingRenderer::RenderScene(void)
assert(err==GL_NO_ERROR);
{
BT_PROFILE("updateCamera");
B3_PROFILE("updateCamera");
updateCamera();
}
err = glGetError();
@@ -1200,7 +1200,7 @@ void GLInstancingRenderer::RenderScene(void)
// glBindBuffer(GL_ARRAY_BUFFER, 0);
{
BT_PROFILE("glFlush2");
B3_PROFILE("glFlush2");
glBindBuffer(GL_ARRAY_BUFFER, m_data->m_vbo);
glFlush();
@@ -1226,7 +1226,7 @@ void GLInstancingRenderer::RenderScene(void)
for (int i=0;i<m_graphicsInstances.size();i++)
{
btGraphicsInstance* gfxObj = m_graphicsInstances[i];
b3GraphicsInstance* gfxObj = m_graphicsInstances[i];
if (gfxObj->m_numGraphicsInstances)
{
// int myOffset = gfxObj->m_instanceOffset*4*sizeof(float);
@@ -1272,7 +1272,7 @@ void GLInstancingRenderer::RenderScene(void)
{
BT_PROFILE("glFlush");
B3_PROFILE("glFlush");
glFlush();
}
@@ -1281,9 +1281,9 @@ void GLInstancingRenderer::RenderScene(void)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, gfxObj->m_index_vbo);
{
BT_PROFILE("glDrawElementsInstanced");
B3_PROFILE("glDrawElementsInstanced");
if (gfxObj->m_primitiveType==BT_GL_POINTS)
if (gfxObj->m_primitiveType==B3_GL_POINTS)
{
glUseProgram(instancingShaderPointSprite);
glUniformMatrix4fv(ProjectionMatrixPointSprite, 1, false, &projectionMatrix[0]);
@@ -1321,7 +1321,7 @@ void GLInstancingRenderer::RenderScene(void)
err = glGetError();
assert(err==GL_NO_ERROR);
{
BT_PROFILE("glUseProgram(0);");
B3_PROFILE("glUseProgram(0);");
glUseProgram(0);
glBindBuffer(GL_ARRAY_BUFFER,0);
glBindVertexArray(0);

View File

@@ -18,21 +18,21 @@ subject to the following restrictions:
#include "Bullet3Common/b3AlignedObjectArray.h"
void btDefaultMouseButtonCallback( int button, int state, float x, float y);
void btDefaultMouseMoveCallback( float x, float y);
void btDefaultKeyboardCallback(int key, int state);
void btDefaultWheelCallback( float deltax, float deltay);
void b3DefaultMouseButtonCallback( int button, int state, float x, float y);
void b3DefaultMouseMoveCallback( float x, float y);
void b3DefaultKeyboardCallback(int key, int state);
void b3DefaultWheelCallback( float deltax, float deltay);
enum
{
BT_GL_TRIANGLES = 1,
BT_GL_POINTS
B3_GL_TRIANGLES = 1,
B3_GL_POINTS
};
class GLInstancingRenderer
{
b3AlignedObjectArray<struct btGraphicsInstance*> m_graphicsInstances;
b3AlignedObjectArray<struct b3GraphicsInstance*> m_graphicsInstances;
int m_maxNumObjectCapacity;
int m_maxShapeCapacityInBytes;
@@ -54,7 +54,7 @@ public:
void CleanupShaders();
///vertices must be in the format x,y,z, nx,ny,nz, u,v
int registerShape(const float* vertices, int numvertices, const int* indices, int numIndices, int primitiveType=BT_GL_TRIANGLES);
int registerShape(const float* vertices, int numvertices, const int* indices, int numIndices, int primitiveType=B3_GL_TRIANGLES);
///position x,y,z, quaternion x,y,z,w, color r,g,b,a, scaling x,y,z
int registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling);

View File

@@ -1,22 +1,22 @@
#ifndef MAC_OPENGL_WINDOW_H
#define MAC_OPENGL_WINDOW_H
#include "btgWindowInterface.h"
#include "b3gWindowInterface.h"
#define btgDefaultOpenGLWindow MacOpenGLWindow
#define b3gDefaultOpenGLWindow MacOpenGLWindow
class MacOpenGLWindow : public btgWindowInterface
class MacOpenGLWindow : public b3gWindowInterface
{
struct MacOpenGLWindowInternalData* m_internalData;
float m_mouseX;
float m_mouseY;
btMouseButtonCallback m_mouseButtonCallback;
btMouseMoveCallback m_mouseMoveCallback;
btWheelCallback m_wheelCallback;
btKeyboardCallback m_keyboardCallback;
btRenderCallback m_renderCallback;
b3MouseButtonCallback m_mouseButtonCallback;
b3MouseMoveCallback m_mouseMoveCallback;
b3WheelCallback m_wheelCallback;
b3KeyboardCallback m_keyboardCallback;
b3RenderCallback m_renderCallback;
float m_retinaScaleFactor;
public:
@@ -40,28 +40,28 @@ public:
void runMainLoop();
void setMouseButtonCallback(btMouseButtonCallback mouseCallback)
void setMouseButtonCallback(b3MouseButtonCallback mouseCallback)
{
m_mouseButtonCallback = mouseCallback;
}
void setMouseMoveCallback(btMouseMoveCallback mouseCallback)
void setMouseMoveCallback(b3MouseMoveCallback mouseCallback)
{
m_mouseMoveCallback = mouseCallback;
}
void setResizeCallback(btResizeCallback resizeCallback);
void setResizeCallback(b3ResizeCallback resizeCallback);
void setKeyboardCallback( btKeyboardCallback keyboardCallback)
void setKeyboardCallback( b3KeyboardCallback keyboardCallback)
{
m_keyboardCallback = keyboardCallback;
}
btKeyboardCallback getKeyboardCallback()
b3KeyboardCallback getKeyboardCallback()
{
return m_keyboardCallback;
}
void setWheelCallback (btWheelCallback wheelCallback)
void setWheelCallback (b3WheelCallback wheelCallback)
{
m_wheelCallback = wheelCallback;
}
@@ -71,13 +71,13 @@ public:
return m_retinaScaleFactor;
}
virtual void createWindow(const btgWindowConstructionInfo& ci);
virtual void createWindow(const b3gWindowConstructionInfo& ci);
virtual float getTimeInSeconds();
virtual void setRenderCallback( btRenderCallback renderCallback);
virtual void setRenderCallback( b3RenderCallback renderCallback);
virtual void setWindowTitle(const char* title);

View File

@@ -26,11 +26,11 @@ struct InternalData2
int m_mouseXpos;
int m_mouseYpos;
btWheelCallback m_wheelCallback;
btMouseMoveCallback m_mouseMoveCallback;
btMouseButtonCallback m_mouseButtonCallback;
btResizeCallback m_resizeCallback;
btKeyboardCallback m_keyboardCallback;
b3WheelCallback m_wheelCallback;
b3MouseMoveCallback m_mouseMoveCallback;
b3MouseButtonCallback m_mouseButtonCallback;
b3ResizeCallback m_resizeCallback;
b3KeyboardCallback m_keyboardCallback;

View File

@@ -77,7 +77,7 @@ void Win32OpenGLWindow::disableOpenGL()
void Win32OpenGLWindow::createWindow(const btgWindowConstructionInfo& ci)
void Win32OpenGLWindow::createWindow(const b3gWindowConstructionInfo& ci)
{
Win32Window::createWindow(ci);

View File

@@ -21,7 +21,7 @@ subject to the following restrictions:
#include "Win32Window.h"
#define btgDefaultOpenGLWindow Win32OpenGLWindow
#define b3gDefaultOpenGLWindow Win32OpenGLWindow
class Win32OpenGLWindow : public Win32Window
{
@@ -40,7 +40,7 @@ public:
virtual ~Win32OpenGLWindow();
virtual void createWindow(const btgWindowConstructionInfo& ci);
virtual void createWindow(const b3gWindowConstructionInfo& ci);
virtual void closeWindow();

View File

@@ -57,31 +57,31 @@ int getAsciiCodeFromVirtualKeycode(int virtualKeyCode)
int keycode = 0xffffffff;
switch (virtualKeyCode)
{
case VK_F1: {keycode = BTG_F1; break;}
case VK_F2: {keycode = BTG_F2; break;}
case VK_F3: {keycode = BTG_F3; break;}
case VK_F4: {keycode = BTG_F4; break;}
case VK_F5: {keycode = BTG_F5; break;}
case VK_F6: {keycode = BTG_F6; break;}
case VK_F7: {keycode = BTG_F7; break;}
case VK_F8: {keycode = BTG_F8; break;}
case VK_F9: {keycode = BTG_F9; break;}
case VK_F10: {keycode= BTG_F10; break;}
case VK_F1: {keycode = B3G_F1; break;}
case VK_F2: {keycode = B3G_F2; break;}
case VK_F3: {keycode = B3G_F3; break;}
case VK_F4: {keycode = B3G_F4; break;}
case VK_F5: {keycode = B3G_F5; break;}
case VK_F6: {keycode = B3G_F6; break;}
case VK_F7: {keycode = B3G_F7; break;}
case VK_F8: {keycode = B3G_F8; break;}
case VK_F9: {keycode = B3G_F9; break;}
case VK_F10: {keycode= B3G_F10; break;}
case VK_SPACE: {keycode= ' '; break;}
case VK_NEXT: {keycode= BTG_PAGE_DOWN; break;}
case VK_PRIOR: {keycode= BTG_PAGE_UP; break;}
case VK_NEXT: {keycode= B3G_PAGE_DOWN; break;}
case VK_PRIOR: {keycode= B3G_PAGE_UP; break;}
case VK_INSERT: {keycode= BTG_INSERT; break;}
case VK_DELETE: {keycode= BTG_DELETE; break;}
case VK_INSERT: {keycode= B3G_INSERT; break;}
case VK_DELETE: {keycode= B3G_DELETE; break;}
case VK_END:{keycode= BTG_END; break;}
case VK_HOME:{keycode= BTG_HOME; break;}
case VK_LEFT:{keycode= BTG_LEFT_ARROW; break;}
case VK_UP:{keycode= BTG_UP_ARROW; break;}
case VK_RIGHT:{keycode= BTG_RIGHT_ARROW; break;}
case VK_DOWN:{keycode= BTG_DOWN_ARROW; break;}
case VK_END:{keycode= B3G_END; break;}
case VK_HOME:{keycode= B3G_HOME; break;}
case VK_LEFT:{keycode= B3G_LEFT_ARROW; break;}
case VK_UP:{keycode= B3G_UP_ARROW; break;}
case VK_RIGHT:{keycode= B3G_RIGHT_ARROW; break;}
case VK_DOWN:{keycode= B3G_DOWN_ARROW; break;}
default:
{
keycode = MapVirtualKey( virtualKeyCode, MAPVK_VK_TO_CHAR ) & 0x0000FFFF;
@@ -332,7 +332,7 @@ void Win32Window::setWindowTitle(const char* titleChar)
#endif
}
void Win32Window::createWindow(const btgWindowConstructionInfo& ci)
void Win32Window::createWindow(const b3gWindowConstructionInfo& ci)
{
int oglViewportWidth = ci.m_width;
int oglViewportHeight = ci.m_height;
@@ -570,7 +570,7 @@ Win32Window::~Win32Window()
}
void Win32Window::setRenderCallback( btRenderCallback renderCallback)
void Win32Window::setRenderCallback( b3RenderCallback renderCallback)
{
}
@@ -643,35 +643,35 @@ bool Win32Window::requestedExit() const
return m_data->m_quit;
}
void Win32Window::setWheelCallback(btWheelCallback wheelCallback)
void Win32Window::setWheelCallback(b3WheelCallback wheelCallback)
{
m_data->m_wheelCallback = wheelCallback;
}
void Win32Window::setMouseMoveCallback(btMouseMoveCallback mouseCallback)
void Win32Window::setMouseMoveCallback(b3MouseMoveCallback mouseCallback)
{
m_data->m_mouseMoveCallback = mouseCallback;
}
void Win32Window::setMouseButtonCallback(btMouseButtonCallback mouseCallback)
void Win32Window::setMouseButtonCallback(b3MouseButtonCallback mouseCallback)
{
m_data->m_mouseButtonCallback = mouseCallback;
}
void Win32Window::setResizeCallback(btResizeCallback resizeCallback)
void Win32Window::setResizeCallback(b3ResizeCallback resizeCallback)
{
m_data->m_resizeCallback = resizeCallback;
if (m_data->m_resizeCallback)
(*m_data->m_resizeCallback)(m_data->m_openglViewportWidth,m_data->m_openglViewportHeight);
}
void Win32Window::setKeyboardCallback( btKeyboardCallback keyboardCallback)
void Win32Window::setKeyboardCallback( b3KeyboardCallback keyboardCallback)
{
m_data->m_keyboardCallback = keyboardCallback;
}
btKeyboardCallback Win32Window::getKeyboardCallback()
b3KeyboardCallback Win32Window::getKeyboardCallback()
{
return m_data->m_keyboardCallback;
}

View File

@@ -21,9 +21,9 @@ subject to the following restrictions:
struct InternalData2;
#include "btgWindowInterface.h"
#include "b3gWindowInterface.h"
class Win32Window : public btgWindowInterface
class Win32Window : public b3gWindowInterface
{
protected:
@@ -40,7 +40,7 @@ public:
virtual ~Win32Window();
virtual void createWindow(const btgWindowConstructionInfo& ci);
virtual void createWindow(const b3gWindowConstructionInfo& ci);
virtual void switchFullScreen(bool fullscreen,int width=0,int height=0,int colorBitsPerPixel=0);
@@ -64,15 +64,15 @@ public:
virtual void getMouseCoordinates(int& x, int& y);
virtual void setMouseMoveCallback(btMouseMoveCallback mouseCallback);
virtual void setMouseButtonCallback(btMouseButtonCallback mouseCallback);
virtual void setResizeCallback(btResizeCallback resizeCallback);
virtual void setWheelCallback(btWheelCallback wheelCallback);
virtual void setKeyboardCallback( btKeyboardCallback keyboardCallback);
virtual void setMouseMoveCallback(b3MouseMoveCallback mouseCallback);
virtual void setMouseButtonCallback(b3MouseButtonCallback mouseCallback);
virtual void setResizeCallback(b3ResizeCallback resizeCallback);
virtual void setWheelCallback(b3WheelCallback wheelCallback);
virtual void setKeyboardCallback( b3KeyboardCallback keyboardCallback);
virtual btKeyboardCallback getKeyboardCallback();
virtual b3KeyboardCallback getKeyboardCallback();
virtual void setRenderCallback( btRenderCallback renderCallback);
virtual void setRenderCallback( b3RenderCallback renderCallback);
virtual void setWindowTitle(const char* title);
};

View File

@@ -23,11 +23,11 @@ struct InternalData2
XWindowAttributes m_gwa;
XEvent m_xev;
btWheelCallback m_wheelCallback;
btMouseMoveCallback m_mouseMoveCallback;
btMouseButtonCallback m_mouseButtonCallback;
btResizeCallback m_resizeCallback;
btKeyboardCallback m_keyboardCallback;
b3WheelCallback m_wheelCallback;
b3MouseMoveCallback m_mouseMoveCallback;
b3MouseButtonCallback m_mouseButtonCallback;
b3ResizeCallback m_resizeCallback;
b3KeyboardCallback m_keyboardCallback;
InternalData2()
:m_dpy(0),
@@ -89,7 +89,7 @@ void X11OpenGLWindow::disableOpenGL()
}
void X11OpenGLWindow::createWindow(const btgWindowConstructionInfo& ci)
void X11OpenGLWindow::createWindow(const b3gWindowConstructionInfo& ci)
{
m_data->m_dpy = XOpenDisplay(NULL);
@@ -139,23 +139,23 @@ int X11OpenGLWindow::getAsciiCodeFromVirtualKeycode(int keycode)
key = XKeycodeToKeysym( m_data->m_dpy, keycode, 0 );
switch( key )
{
case XK_Escape: return BTG_ESCAPE;
case XK_Escape: return B3G_ESCAPE;
case XK_F1: return BTG_F1;
case XK_F2: return BTG_F2;
case XK_F3: return BTG_F3;
case XK_F4: return BTG_F4;
case XK_F5: return BTG_F5;
case XK_F6: return BTG_F6;
case XK_F7: return BTG_F7;
case XK_F8: return BTG_F8;
case XK_F9: return BTG_F9;
case XK_F10: return BTG_F10;
case XK_F11: return BTG_F11;
case XK_F12: return BTG_F12;
case XK_F13: return BTG_F13;
case XK_F14: return BTG_F14;
case XK_F15: return BTG_F15;
case XK_F1: return B3G_F1;
case XK_F2: return B3G_F2;
case XK_F3: return B3G_F3;
case XK_F4: return B3G_F4;
case XK_F5: return B3G_F5;
case XK_F6: return B3G_F6;
case XK_F7: return B3G_F7;
case XK_F8: return B3G_F8;
case XK_F9: return B3G_F9;
case XK_F10: return B3G_F10;
case XK_F11: return B3G_F11;
case XK_F12: return B3G_F12;
case XK_F13: return B3G_F13;
case XK_F14: return B3G_F14;
case XK_F15: return B3G_F15;
default:
// Make uppercase
XConvertCase( key, &key_lc, &key_uc );
@@ -377,7 +377,7 @@ void X11OpenGLWindow::setRequestExit()
}
void X11OpenGLWindow::setRenderCallback( btRenderCallback renderCallback)
void X11OpenGLWindow::setRenderCallback( b3RenderCallback renderCallback)
{
}
@@ -388,27 +388,27 @@ void X11OpenGLWindow::setWindowTitle(const char* title)
}
void X11OpenGLWindow::setWheelCallback(btWheelCallback wheelCallback)
void X11OpenGLWindow::setWheelCallback(b3WheelCallback wheelCallback)
{
m_data->m_wheelCallback = wheelCallback;
}
void X11OpenGLWindow::setMouseMoveCallback(btMouseMoveCallback mouseCallback)
void X11OpenGLWindow::setMouseMoveCallback(b3MouseMoveCallback mouseCallback)
{
m_data->m_mouseMoveCallback = mouseCallback;
}
void X11OpenGLWindow::setMouseButtonCallback(btMouseButtonCallback mouseCallback)
void X11OpenGLWindow::setMouseButtonCallback(b3MouseButtonCallback mouseCallback)
{
m_data->m_mouseButtonCallback = mouseCallback;
}
void X11OpenGLWindow::setResizeCallback(btResizeCallback resizeCallback)
void X11OpenGLWindow::setResizeCallback(b3ResizeCallback resizeCallback)
{
m_data->m_resizeCallback = resizeCallback;
}
void X11OpenGLWindow::setKeyboardCallback( btKeyboardCallback keyboardCallback)
void X11OpenGLWindow::setKeyboardCallback( b3KeyboardCallback keyboardCallback)
{
m_data->m_keyboardCallback = keyboardCallback;

View File

@@ -1,11 +1,11 @@
#ifndef X11_OPENGL_WINDOW_H
#define X11_OPENGL_WINDOW_H
#define btgDefaultOpenGLWindow X11OpenGLWindow
#define b3gDefaultOpenGLWindow X11OpenGLWindow
#include "btgWindowInterface.h"
#include "b3gWindowInterface.h"
class X11OpenGLWindow : public btgWindowInterface
class X11OpenGLWindow : public b3gWindowInterface
{
struct InternalData2* m_data;
@@ -27,7 +27,7 @@ public:
virtual ~X11OpenGLWindow();
virtual void createWindow(const btgWindowConstructionInfo& ci);
virtual void createWindow(const b3gWindowConstructionInfo& ci);
virtual void closeWindow();
@@ -47,13 +47,13 @@ public:
virtual void setRequestExit() ;
virtual void setMouseMoveCallback(btMouseMoveCallback mouseCallback);
virtual void setMouseButtonCallback(btMouseButtonCallback mouseCallback);
virtual void setResizeCallback(btResizeCallback resizeCallback);
virtual void setWheelCallback(btWheelCallback wheelCallback);
virtual void setKeyboardCallback( btKeyboardCallback keyboardCallback);
virtual void setMouseMoveCallback(b3MouseMoveCallback mouseCallback);
virtual void setMouseButtonCallback(b3MouseButtonCallback mouseCallback);
virtual void setResizeCallback(b3ResizeCallback resizeCallback);
virtual void setWheelCallback(b3WheelCallback wheelCallback);
virtual void setKeyboardCallback( b3KeyboardCallback keyboardCallback);
virtual void setRenderCallback( btRenderCallback renderCallback);
virtual void setRenderCallback( b3RenderCallback renderCallback);
virtual void setWindowTitle(const char* title);

View File

@@ -0,0 +1,109 @@
#ifndef B3G_WINDOW_INTERFACE_H
#define B3G_WINDOW_INTERFACE_H
typedef void (*b3WheelCallback)(float deltax, float deltay);
typedef void (*b3ResizeCallback)( float width, float height);
typedef void (*b3MouseMoveCallback)( float x, float y);
typedef void (*b3MouseButtonCallback)(int button, int state, float x, float y);
typedef void (*b3KeyboardCallback)(int keycode, int state);
typedef void (*b3RenderCallback) ();
enum {
B3G_ESCAPE = 27,
B3G_F1 = 0xff00,
B3G_F2,
B3G_F3,
B3G_F4,
B3G_F5,
B3G_F6,
B3G_F7,
B3G_F8,
B3G_F9,
B3G_F10,
B3G_F11,
B3G_F12,
B3G_F13,
B3G_F14,
B3G_F15,
B3G_LEFT_ARROW,
B3G_RIGHT_ARROW,
B3G_UP_ARROW,
B3G_DOWN_ARROW,
B3G_PAGE_UP,
B3G_PAGE_DOWN,
B3G_END,
B3G_HOME,
B3G_INSERT,
B3G_DELETE
};
struct b3gWindowConstructionInfo
{
int m_width;
int m_height;
bool m_fullscreen;
int m_colorBitsPerPixel;
void* m_windowHandle;
const char* m_title;
int m_openglVersion;
b3gWindowConstructionInfo(int width=1024, int height=768)
:m_width(width),
m_height(height),
m_fullscreen(false),
m_colorBitsPerPixel(32),
m_windowHandle(0),
m_title("title"),
m_openglVersion(3)
{
}
};
class b3gWindowInterface
{
public:
virtual ~b3gWindowInterface()
{
}
virtual void createDefaultWindow(int width, int height, const char* title)
{
b3gWindowConstructionInfo ci(width,height);
ci.m_title = title;
createWindow(ci);
}
virtual void createWindow(const b3gWindowConstructionInfo& ci)=0;
virtual void closeWindow()=0;
virtual void runMainLoop()=0;
virtual float getTimeInSeconds()=0;
virtual bool requestedExit() const = 0;
virtual void setRequestExit() = 0;
virtual void startRendering()=0;
virtual void endRendering()=0;
virtual void setMouseMoveCallback(b3MouseMoveCallback mouseCallback)=0;
virtual void setMouseButtonCallback(b3MouseButtonCallback mouseCallback)=0;
virtual void setResizeCallback(b3ResizeCallback resizeCallback)=0;
virtual void setWheelCallback(b3WheelCallback wheelCallback)=0;
virtual void setKeyboardCallback( b3KeyboardCallback keyboardCallback)=0;
virtual b3KeyboardCallback getKeyboardCallback()=0;
virtual void setRenderCallback( b3RenderCallback renderCallback) = 0;
virtual void setWindowTitle(const char* title)=0;
virtual float getRetinaScale() const =0;
};
#endif //B3G_WINDOW_INTERFACE_H

View File

@@ -1,109 +0,0 @@
#ifndef BTG_WINDOW_INTERFACE_H
#define BTG_WINDOW_INTERFACE_H
typedef void (*btWheelCallback)(float deltax, float deltay);
typedef void (*btResizeCallback)( float width, float height);
typedef void (*btMouseMoveCallback)( float x, float y);
typedef void (*btMouseButtonCallback)(int button, int state, float x, float y);
typedef void (*btKeyboardCallback)(int keycode, int state);
typedef void (*btRenderCallback) ();
enum {
BTG_ESCAPE = 27,
BTG_F1 = 0xff00,
BTG_F2,
BTG_F3,
BTG_F4,
BTG_F5,
BTG_F6,
BTG_F7,
BTG_F8,
BTG_F9,
BTG_F10,
BTG_F11,
BTG_F12,
BTG_F13,
BTG_F14,
BTG_F15,
BTG_LEFT_ARROW,
BTG_RIGHT_ARROW,
BTG_UP_ARROW,
BTG_DOWN_ARROW,
BTG_PAGE_UP,
BTG_PAGE_DOWN,
BTG_END,
BTG_HOME,
BTG_INSERT,
BTG_DELETE
};
struct btgWindowConstructionInfo
{
int m_width;
int m_height;
bool m_fullscreen;
int m_colorBitsPerPixel;
void* m_windowHandle;
const char* m_title;
int m_openglVersion;
btgWindowConstructionInfo(int width=1024, int height=768)
:m_width(width),
m_height(height),
m_fullscreen(false),
m_colorBitsPerPixel(32),
m_windowHandle(0),
m_title("title"),
m_openglVersion(3)
{
}
};
class btgWindowInterface
{
public:
virtual ~btgWindowInterface()
{
}
virtual void createDefaultWindow(int width, int height, const char* title)
{
btgWindowConstructionInfo ci(width,height);
ci.m_title = title;
createWindow(ci);
}
virtual void createWindow(const btgWindowConstructionInfo& ci)=0;
virtual void closeWindow()=0;
virtual void runMainLoop()=0;
virtual float getTimeInSeconds()=0;
virtual bool requestedExit() const = 0;
virtual void setRequestExit() = 0;
virtual void startRendering()=0;
virtual void endRendering()=0;
virtual void setMouseMoveCallback(btMouseMoveCallback mouseCallback)=0;
virtual void setMouseButtonCallback(btMouseButtonCallback mouseCallback)=0;
virtual void setResizeCallback(btResizeCallback resizeCallback)=0;
virtual void setWheelCallback(btWheelCallback wheelCallback)=0;
virtual void setKeyboardCallback( btKeyboardCallback keyboardCallback)=0;
virtual btKeyboardCallback getKeyboardCallback()=0;
virtual void setRenderCallback( btRenderCallback renderCallback) = 0;
virtual void setWindowTitle(const char* title)=0;
virtual float getRetinaScale() const =0;
};
#endif //BTG_WINDOW_INTERFACE_H

View File

@@ -72,7 +72,7 @@ void Usage()
void MyMouseButtonCallback(int button, int state, float x, float y)
{
//btDefaultMouseCallback(button,state,x,y);
//b3DefaultMouseCallback(button,state,x,y);
if (pCanvas)
{
@@ -106,7 +106,7 @@ void MyResizeCallback(float width, float height)
void MyMouseMoveCallback( float x, float y)
{
//btDefaultMouseCallback(button,state,x,y);
//b3DefaultMouseCallback(button,state,x,y);
static int m_lastmousepos[2] = {0,0};
static bool isInitialized = false;
@@ -278,8 +278,8 @@ int main(int argc, char* argv[])
printf("\n");
btgDefaultOpenGLWindow* window = new btgDefaultOpenGLWindow();
btgWindowConstructionInfo wci;
b3gDefaultOpenGLWindow* window = new b3gDefaultOpenGLWindow();
b3gWindowConstructionInfo wci;
wci.m_width = g_OpenGLWidth;
wci.m_height = g_OpenGLHeight;
@@ -320,8 +320,8 @@ int main(int argc, char* argv[])
window->setMouseButtonCallback(MyMouseButtonCallback);
window->setMouseMoveCallback(MyMouseMoveCallback);
window->setResizeCallback(MyResizeCallback);
window->setKeyboardCallback(btDefaultKeyboardCallback);
window->setWheelCallback(btDefaultWheelCallback);
window->setKeyboardCallback(b3DefaultKeyboardCallback);
window->setWheelCallback(b3DefaultWheelCallback);
//GLPrimitiveRenderer* pprender = new GLPrimitiveRenderer(g_OpenGLWidth,g_OpenGLHeight);
@@ -350,13 +350,13 @@ int main(int argc, char* argv[])
CProfileManager::Reset();
{
BT_PROFILE("loop");
B3_PROFILE("loop");
{
BT_PROFILE("startRendering");
B3_PROFILE("startRendering");
window->startRendering();
}
render.RenderScene();
@@ -371,7 +371,7 @@ int main(int argc, char* argv[])
float dx=0;
if (1)
{
BT_PROFILE("font sth_draw_text");
B3_PROFILE("font sth_draw_text");
glEnable(GL_BLEND);
GLint err = glGetError();
@@ -400,7 +400,7 @@ int main(int argc, char* argv[])
if (1)
{
BT_PROFILE("gwen RenderCanvas");
B3_PROFILE("gwen RenderCanvas");
if (pCanvas)
{
@@ -488,7 +488,7 @@ int main(int argc, char* argv[])
{
count = 100;
{
//BT_PROFILE("processProfileData");
//B3_PROFILE("processProfileData");
processProfileData(m_profileIterator,false);
}
//CProfileManager::dumpAll();

View File

@@ -46,7 +46,7 @@ struct GraphicsShape
struct InstanceGroup
{
// Bullet::btCollisionShapeData* m_shape;
// Bullet::b3CollisionShapeData* m_shape;
int m_collisionShapeIndex;
// b3AlignedObjectArray<bParse::bStructHandle*> m_rigidBodies;