mirror of
https://github.com/aap/librw.git
synced 2025-12-18 16:39:51 +00:00
fixed bug in im3d; worked on resizing windows
This commit is contained in:
@@ -344,8 +344,7 @@ Camera::clear(RGBA *col, uint32 mode)
|
||||
void
|
||||
Camera::showRaster(void)
|
||||
{
|
||||
// TODO: camera raster
|
||||
engine->device.showRaster(nil);
|
||||
engine->device.showRaster(this->frameBuffer);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -420,6 +419,7 @@ Camera::frustumTestSphere(Sphere *s)
|
||||
return SPHEREOUTSIDE;
|
||||
if(s->radius > -dist)
|
||||
res = SPHEREBOUNDARY;
|
||||
p++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -480,6 +480,9 @@ static void
|
||||
showRaster(Raster *raster)
|
||||
{
|
||||
// TODO: do this properly!
|
||||
|
||||
// not used but we want cameras to have rasters
|
||||
assert(raster);
|
||||
d3ddevice->Present(nil, nil, 0, nil);
|
||||
}
|
||||
|
||||
|
||||
@@ -167,6 +167,7 @@ im3DRenderIndexed(PrimitiveType primType, void *indices, int32 numIndices)
|
||||
memcpy(lockedindices, indices, numIndices*sizeof(uint16));
|
||||
unlockIndices(im3dindbuf);
|
||||
|
||||
d3ddevice->SetIndices(im3dindbuf);
|
||||
d3d::setTexture(0, engine->imtexture);
|
||||
d3d::flushCache();
|
||||
|
||||
|
||||
@@ -21,6 +21,12 @@
|
||||
namespace rw {
|
||||
namespace gl3 {
|
||||
|
||||
struct GlGlobals
|
||||
{
|
||||
GLFWwindow *window;
|
||||
int presentWidth, presentHeight;
|
||||
} glGlobals;
|
||||
|
||||
struct UniformState
|
||||
{
|
||||
int32 alphaFunc;
|
||||
@@ -387,13 +393,11 @@ clearCamera(Camera *cam, RGBA *col, uint32 mode)
|
||||
glClear(mask);
|
||||
}
|
||||
|
||||
static GLFWwindow *glfwwindow;
|
||||
|
||||
static void
|
||||
showRaster(Raster *raster)
|
||||
{
|
||||
// TODO: do this properly!
|
||||
glfwSwapBuffers(glfwwindow);
|
||||
glfwSwapBuffers(glGlobals.window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -465,6 +469,14 @@ beginUpdate(Camera *cam)
|
||||
uniformState.fogEnd = cam->farPlane;
|
||||
stateDirty = 1;
|
||||
}
|
||||
|
||||
int w, h;
|
||||
glfwGetWindowSize(glGlobals.window, &w, &h);
|
||||
if(w != glGlobals.presentWidth || h != glGlobals.presentHeight){
|
||||
glViewport(0, 0, w, h);
|
||||
glGlobals.presentWidth = w;
|
||||
glGlobals.presentHeight = h;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -507,7 +519,7 @@ openGLFW(EngineStartParams *startparams)
|
||||
glfwTerminate();
|
||||
return 0;
|
||||
}
|
||||
glfwwindow = win;
|
||||
glGlobals.window = win;
|
||||
*startparams->window = win;
|
||||
return 1;
|
||||
}
|
||||
@@ -515,7 +527,7 @@ openGLFW(EngineStartParams *startparams)
|
||||
static int
|
||||
closeGLFW(void)
|
||||
{
|
||||
glfwDestroyWindow(glfwwindow);
|
||||
glfwDestroyWindow(glGlobals.window);
|
||||
glfwTerminate();
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user