mirror of
https://github.com/aap/librw.git
synced 2025-12-19 17:09:51 +00:00
added imguizmo; subraster handling etc
This commit is contained in:
@@ -425,6 +425,7 @@ beginUpdate(Camera *cam)
|
||||
view[13] = inv.pos.y;
|
||||
view[14] = inv.pos.z;
|
||||
view[15] = 1.0f;
|
||||
memcpy(&cam->devView, &view, sizeof(RawMatrix));
|
||||
setViewMatrix(view);
|
||||
|
||||
// Projection Matrix
|
||||
@@ -459,6 +460,7 @@ beginUpdate(Camera *cam)
|
||||
proj[14] = -2.0f*invz;
|
||||
proj[15] = 1.0f;
|
||||
}
|
||||
memcpy(&cam->devProj, &proj, sizeof(RawMatrix));
|
||||
setProjectionMatrix(proj);
|
||||
|
||||
if(uniformState.fogStart != cam->fogPlane){
|
||||
@@ -490,7 +492,7 @@ openGLFW(EngineStartParams *startparams)
|
||||
RWERROR((ERR_GENERAL, "glfwInit() failed"));
|
||||
return 0;
|
||||
}
|
||||
glfwWindowHint(GLFW_SAMPLES, 4);
|
||||
glfwWindowHint(GLFW_SAMPLES, 0);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||
|
||||
@@ -23,10 +23,21 @@ int32 nativeRasterOffset;
|
||||
void
|
||||
rasterCreate(Raster *raster)
|
||||
{
|
||||
// Dummy to use as subraster
|
||||
if(raster->width == 0 || raster->height == 0){
|
||||
raster->flags |= Raster::DONTALLOCATE;
|
||||
raster->stride = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
switch(raster->type){
|
||||
case Raster::CAMERA:
|
||||
// TODO: set/check width, height, depth, format?
|
||||
raster->flags |= Raster::DONTALLOCATE;
|
||||
raster->originalWidth = raster->width;
|
||||
raster->originalHeight = raster->height;
|
||||
raster->stride = 0;
|
||||
raster->pixels = nil;
|
||||
break;
|
||||
case Raster::ZBUFFER:
|
||||
// TODO: set/check width, height, depth, format?
|
||||
|
||||
@@ -80,6 +80,10 @@ struct InstanceDataHeader : rw::InstanceDataHeader
|
||||
|
||||
#ifdef RW_GL3
|
||||
|
||||
struct Shader;
|
||||
|
||||
extern Shader *simpleShader;
|
||||
|
||||
struct Im3DVertex
|
||||
{
|
||||
V3d position;
|
||||
|
||||
@@ -3,7 +3,6 @@ namespace gl3 {
|
||||
|
||||
#ifdef RW_OPENGL
|
||||
|
||||
extern Shader *simpleShader;
|
||||
extern uint32 im2DVbo, im2DIbo;
|
||||
void openIm2D(void);
|
||||
void closeIm2D(void);
|
||||
|
||||
@@ -25,9 +25,8 @@ int32 findBlock(const char *name);
|
||||
|
||||
extern UniformRegistry uniformRegistry;
|
||||
|
||||
class Shader
|
||||
struct Shader
|
||||
{
|
||||
public:
|
||||
GLuint program;
|
||||
// same number of elements as UniformRegistry::numUniforms
|
||||
GLint *uniformLocations;
|
||||
|
||||
@@ -34,7 +34,7 @@ void
|
||||
main(void)
|
||||
{
|
||||
vec4 V = u_world * vec4(in_pos, 1.0);
|
||||
vec4 cV = u_view * V;
|
||||
vec4 cV = u_view * V;
|
||||
gl_Position = u_proj * cV;
|
||||
v_color = in_color;
|
||||
v_tex0 = in_tex0;
|
||||
|
||||
@@ -49,10 +49,8 @@ out float v_fog;
|
||||
void
|
||||
main(void)
|
||||
{
|
||||
vec3 lightdir = vec3(1.0, 1.0, -1.0);
|
||||
|
||||
vec4 V = u_world * vec4(in_pos, 1.0);
|
||||
vec4 cV = u_view * V;
|
||||
vec4 cV = u_view * V;
|
||||
gl_Position = u_proj * cV;
|
||||
vec3 N = mat3(u_world) * in_normal;
|
||||
|
||||
@@ -66,5 +64,5 @@ main(void)
|
||||
|
||||
v_tex0 = in_tex0;
|
||||
|
||||
v_fog = clamp((cV.z - u_fogEnd)/(u_fogStart - u_fogEnd), 0.0, 1.0);
|
||||
v_fog = clamp((cV.z - u_fogEnd)/(u_fogStart - u_fogEnd), 0.0, 1.0);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ main(void)
|
||||
mat4 world = u_world * m;
|
||||
|
||||
vec4 V = world * vec4(in_pos, 1.0);
|
||||
vec4 cV = u_view * V;
|
||||
vec4 cV = u_view * V;
|
||||
gl_Position = u_proj * cV;
|
||||
vec3 N = mat3(world) * in_normal;
|
||||
|
||||
@@ -74,5 +74,5 @@ main(void)
|
||||
|
||||
v_tex0 = in_tex0;
|
||||
|
||||
v_fog = clamp((cV.z - u_fogEnd)/(u_fogStart - u_fogEnd), 0.0, 1.0);
|
||||
v_fog = clamp((cV.z - u_fogEnd)/(u_fogStart - u_fogEnd), 0.0, 1.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user