From b617c5d7b5283ad260a77f01e42e6170cabbc03d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 6 Jun 2010 07:02:45 +0000 Subject: [PATCH] Style update: add spaces around assignment operators --- source/arb_shader_objects.cpp | 156 ++++++++--------- source/arb_vertex_buffer_object.cpp | 44 ++--- source/arb_vertex_program.cpp | 248 ++++++++++++++-------------- source/arb_vertex_shader.cpp | 12 +- source/batch.cpp | 6 +- source/bindable.h | 2 +- source/bloom.cpp | 34 ++-- source/buffer.cpp | 10 +- source/clip.cpp | 8 +- source/ext_framebuffer_object.cpp | 68 ++++---- source/extension.cpp | 22 +-- source/font.cpp | 56 +++---- source/framebuffer.cpp | 32 ++-- source/light.cpp | 38 ++--- source/lighting.cpp | 12 +- source/material.cpp | 24 +-- source/matrix.h | 6 +- source/mesh.cpp | 16 +- source/meshbuilder.cpp | 4 +- source/object.cpp | 24 +-- source/object.h | 8 +- source/objectinstance.h | 2 +- source/pipeline.cpp | 14 +- source/pipeline.h | 2 +- source/pixelformat.cpp | 26 +-- source/primitivebuilder.cpp | 6 +- source/primitivetype.cpp | 20 +-- source/program.cpp | 18 +- source/programdata.cpp | 8 +- source/projection.cpp | 2 +- source/renderable.h | 2 +- source/renderbuffer.cpp | 4 +- source/rendermode.cpp | 2 +- source/renderpass.cpp | 30 ++-- source/scene.cpp | 6 +- source/scene.h | 2 +- source/select.cpp | 12 +- source/shader.cpp | 8 +- source/shadowmap.cpp | 80 ++++----- source/tag.cpp | 4 +- source/technique.cpp | 6 +- source/texenv.cpp | 4 +- source/texture.cpp | 16 +- source/texture2d.cpp | 18 +- source/texture3d.cpp | 28 ++-- source/texture3d.h | 2 +- source/texunit.cpp | 12 +- source/uniform.cpp | 18 +- source/version_1_2.cpp | 152 ++++++++--------- source/version_1_3.cpp | 184 ++++++++++----------- source/vertexarray.cpp | 38 ++--- source/vertexarraybuilder.cpp | 56 +++---- source/vertexbuilder.cpp | 10 +- source/vertexbuilder.h | 6 +- source/vertexformat.cpp | 84 +++++----- source/vertexformat.h | 12 +- 56 files changed, 862 insertions(+), 862 deletions(-) diff --git a/source/arb_shader_objects.cpp b/source/arb_shader_objects.cpp index 39253810..18ea5482 100644 --- a/source/arb_shader_objects.cpp +++ b/source/arb_shader_objects.cpp @@ -4,87 +4,87 @@ namespace Msp { namespace GL { -PFNGLDELETEOBJECTARBPROC glDeleteObjectARB=0; -PFNGLGETHANDLEARBPROC glGetHandleARB=0; -PFNGLDETACHOBJECTARBPROC glDetachObjectARB=0; -PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB=0; -PFNGLSHADERSOURCEARBPROC glShaderSourceARB=0; -PFNGLCOMPILESHADERARBPROC glCompileShaderARB=0; -PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB=0; -PFNGLATTACHOBJECTARBPROC glAttachObjectARB=0; -PFNGLLINKPROGRAMARBPROC glLinkProgramARB=0; -PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB=0; -PFNGLVALIDATEPROGRAMARBPROC glValidateProgramARB=0; -PFNGLUNIFORM1FARBPROC glUniform1fARB=0; -PFNGLUNIFORM2FARBPROC glUniform2fARB=0; -PFNGLUNIFORM3FARBPROC glUniform3fARB=0; -PFNGLUNIFORM4FARBPROC glUniform4fARB=0; -PFNGLUNIFORM1IARBPROC glUniform1iARB=0; -PFNGLUNIFORM2IARBPROC glUniform2iARB=0; -PFNGLUNIFORM3IARBPROC glUniform3iARB=0; -PFNGLUNIFORM4IARBPROC glUniform4iARB=0; -PFNGLUNIFORM1FVARBPROC glUniform1fvARB=0; -PFNGLUNIFORM2FVARBPROC glUniform2fvARB=0; -PFNGLUNIFORM3FVARBPROC glUniform3fvARB=0; -PFNGLUNIFORM4FVARBPROC glUniform4fvARB=0; -PFNGLUNIFORM1IVARBPROC glUniform1ivARB=0; -PFNGLUNIFORM2IVARBPROC glUniform2ivARB=0; -PFNGLUNIFORM3IVARBPROC glUniform3ivARB=0; -PFNGLUNIFORM4IVARBPROC glUniform4ivARB=0; -PFNGLUNIFORMMATRIX2FVARBPROC glUniformMatrix2fvARB=0; -PFNGLUNIFORMMATRIX3FVARBPROC glUniformMatrix3fvARB=0; -PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB=0; -PFNGLGETOBJECTPARAMETERFVARBPROC glGetObjectParameterfvARB=0; -PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB=0; -PFNGLGETINFOLOGARBPROC glGetInfoLogARB=0; -PFNGLGETATTACHEDOBJECTSARBPROC glGetAttachedObjectsARB=0; -PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB=0; -PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB=0; -PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB=0; -PFNGLGETUNIFORMIVARBPROC glGetUniformivARB=0; -PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB=0; +PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = 0; +PFNGLGETHANDLEARBPROC glGetHandleARB = 0; +PFNGLDETACHOBJECTARBPROC glDetachObjectARB = 0; +PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = 0; +PFNGLSHADERSOURCEARBPROC glShaderSourceARB = 0; +PFNGLCOMPILESHADERARBPROC glCompileShaderARB = 0; +PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = 0; +PFNGLATTACHOBJECTARBPROC glAttachObjectARB = 0; +PFNGLLINKPROGRAMARBPROC glLinkProgramARB = 0; +PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = 0; +PFNGLVALIDATEPROGRAMARBPROC glValidateProgramARB = 0; +PFNGLUNIFORM1FARBPROC glUniform1fARB = 0; +PFNGLUNIFORM2FARBPROC glUniform2fARB = 0; +PFNGLUNIFORM3FARBPROC glUniform3fARB = 0; +PFNGLUNIFORM4FARBPROC glUniform4fARB = 0; +PFNGLUNIFORM1IARBPROC glUniform1iARB = 0; +PFNGLUNIFORM2IARBPROC glUniform2iARB = 0; +PFNGLUNIFORM3IARBPROC glUniform3iARB = 0; +PFNGLUNIFORM4IARBPROC glUniform4iARB = 0; +PFNGLUNIFORM1FVARBPROC glUniform1fvARB = 0; +PFNGLUNIFORM2FVARBPROC glUniform2fvARB = 0; +PFNGLUNIFORM3FVARBPROC glUniform3fvARB = 0; +PFNGLUNIFORM4FVARBPROC glUniform4fvARB = 0; +PFNGLUNIFORM1IVARBPROC glUniform1ivARB = 0; +PFNGLUNIFORM2IVARBPROC glUniform2ivARB = 0; +PFNGLUNIFORM3IVARBPROC glUniform3ivARB = 0; +PFNGLUNIFORM4IVARBPROC glUniform4ivARB = 0; +PFNGLUNIFORMMATRIX2FVARBPROC glUniformMatrix2fvARB = 0; +PFNGLUNIFORMMATRIX3FVARBPROC glUniformMatrix3fvARB = 0; +PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB = 0; +PFNGLGETOBJECTPARAMETERFVARBPROC glGetObjectParameterfvARB = 0; +PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB = 0; +PFNGLGETINFOLOGARBPROC glGetInfoLogARB = 0; +PFNGLGETATTACHEDOBJECTSARBPROC glGetAttachedObjectsARB = 0; +PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = 0; +PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB = 0; +PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB = 0; +PFNGLGETUNIFORMIVARBPROC glGetUniformivARB = 0; +PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB = 0; void init_arb_shader_objects() { - glDeleteObjectARB=reinterpret_cast(get_proc_address("glDeleteObjectARB")); - glGetHandleARB=reinterpret_cast(get_proc_address("glGetHandleARB")); - glDetachObjectARB=reinterpret_cast(get_proc_address("glDetachObjectARB")); - glCreateShaderObjectARB=reinterpret_cast(get_proc_address("glCreateShaderObjectARB")); - glShaderSourceARB=reinterpret_cast(get_proc_address("glShaderSourceARB")); - glCompileShaderARB=reinterpret_cast(get_proc_address("glCompileShaderARB")); - glCreateProgramObjectARB=reinterpret_cast(get_proc_address("glCreateProgramObjectARB")); - glAttachObjectARB=reinterpret_cast(get_proc_address("glAttachObjectARB")); - glLinkProgramARB=reinterpret_cast(get_proc_address("glLinkProgramARB")); - glUseProgramObjectARB=reinterpret_cast(get_proc_address("glUseProgramObjectARB")); - glValidateProgramARB=reinterpret_cast(get_proc_address("glValidateProgramARB")); - glUniform1fARB=reinterpret_cast(get_proc_address("glUniform1fARB")); - glUniform2fARB=reinterpret_cast(get_proc_address("glUniform2fARB")); - glUniform3fARB=reinterpret_cast(get_proc_address("glUniform3fARB")); - glUniform4fARB=reinterpret_cast(get_proc_address("glUniform4fARB")); - glUniform1iARB=reinterpret_cast(get_proc_address("glUniform1iARB")); - glUniform2iARB=reinterpret_cast(get_proc_address("glUniform2iARB")); - glUniform3iARB=reinterpret_cast(get_proc_address("glUniform3iARB")); - glUniform4iARB=reinterpret_cast(get_proc_address("glUniform4iARB")); - glUniform1fvARB=reinterpret_cast(get_proc_address("glUniform1fvARB")); - glUniform2fvARB=reinterpret_cast(get_proc_address("glUniform2fvARB")); - glUniform3fvARB=reinterpret_cast(get_proc_address("glUniform3fvARB")); - glUniform4fvARB=reinterpret_cast(get_proc_address("glUniform4fvARB")); - glUniform1ivARB=reinterpret_cast(get_proc_address("glUniform1ivARB")); - glUniform2ivARB=reinterpret_cast(get_proc_address("glUniform2ivARB")); - glUniform3ivARB=reinterpret_cast(get_proc_address("glUniform3ivARB")); - glUniform4ivARB=reinterpret_cast(get_proc_address("glUniform4ivARB")); - glUniformMatrix2fvARB=reinterpret_cast(get_proc_address("glUniformMatrix2fvARB")); - glUniformMatrix3fvARB=reinterpret_cast(get_proc_address("glUniformMatrix3fvARB")); - glUniformMatrix4fvARB=reinterpret_cast(get_proc_address("glUniformMatrix4fvARB")); - glGetObjectParameterfvARB=reinterpret_cast(get_proc_address("glGetObjectParameterfvARB")); - glGetObjectParameterivARB=reinterpret_cast(get_proc_address("glGetObjectParameterivARB")); - glGetInfoLogARB=reinterpret_cast(get_proc_address("glGetInfoLogARB")); - glGetAttachedObjectsARB=reinterpret_cast(get_proc_address("glGetAttachedObjectsARB")); - glGetUniformLocationARB=reinterpret_cast(get_proc_address("glGetUniformLocationARB")); - glGetActiveUniformARB=reinterpret_cast(get_proc_address("glGetActiveUniformARB")); - glGetUniformfvARB=reinterpret_cast(get_proc_address("glGetUniformfvARB")); - glGetUniformivARB=reinterpret_cast(get_proc_address("glGetUniformivARB")); - glGetShaderSourceARB=reinterpret_cast(get_proc_address("glGetShaderSourceARB")); + glDeleteObjectARB = reinterpret_cast(get_proc_address("glDeleteObjectARB")); + glGetHandleARB = reinterpret_cast(get_proc_address("glGetHandleARB")); + glDetachObjectARB = reinterpret_cast(get_proc_address("glDetachObjectARB")); + glCreateShaderObjectARB = reinterpret_cast(get_proc_address("glCreateShaderObjectARB")); + glShaderSourceARB = reinterpret_cast(get_proc_address("glShaderSourceARB")); + glCompileShaderARB = reinterpret_cast(get_proc_address("glCompileShaderARB")); + glCreateProgramObjectARB = reinterpret_cast(get_proc_address("glCreateProgramObjectARB")); + glAttachObjectARB = reinterpret_cast(get_proc_address("glAttachObjectARB")); + glLinkProgramARB = reinterpret_cast(get_proc_address("glLinkProgramARB")); + glUseProgramObjectARB = reinterpret_cast(get_proc_address("glUseProgramObjectARB")); + glValidateProgramARB = reinterpret_cast(get_proc_address("glValidateProgramARB")); + glUniform1fARB = reinterpret_cast(get_proc_address("glUniform1fARB")); + glUniform2fARB = reinterpret_cast(get_proc_address("glUniform2fARB")); + glUniform3fARB = reinterpret_cast(get_proc_address("glUniform3fARB")); + glUniform4fARB = reinterpret_cast(get_proc_address("glUniform4fARB")); + glUniform1iARB = reinterpret_cast(get_proc_address("glUniform1iARB")); + glUniform2iARB = reinterpret_cast(get_proc_address("glUniform2iARB")); + glUniform3iARB = reinterpret_cast(get_proc_address("glUniform3iARB")); + glUniform4iARB = reinterpret_cast(get_proc_address("glUniform4iARB")); + glUniform1fvARB = reinterpret_cast(get_proc_address("glUniform1fvARB")); + glUniform2fvARB = reinterpret_cast(get_proc_address("glUniform2fvARB")); + glUniform3fvARB = reinterpret_cast(get_proc_address("glUniform3fvARB")); + glUniform4fvARB = reinterpret_cast(get_proc_address("glUniform4fvARB")); + glUniform1ivARB = reinterpret_cast(get_proc_address("glUniform1ivARB")); + glUniform2ivARB = reinterpret_cast(get_proc_address("glUniform2ivARB")); + glUniform3ivARB = reinterpret_cast(get_proc_address("glUniform3ivARB")); + glUniform4ivARB = reinterpret_cast(get_proc_address("glUniform4ivARB")); + glUniformMatrix2fvARB = reinterpret_cast(get_proc_address("glUniformMatrix2fvARB")); + glUniformMatrix3fvARB = reinterpret_cast(get_proc_address("glUniformMatrix3fvARB")); + glUniformMatrix4fvARB = reinterpret_cast(get_proc_address("glUniformMatrix4fvARB")); + glGetObjectParameterfvARB = reinterpret_cast(get_proc_address("glGetObjectParameterfvARB")); + glGetObjectParameterivARB = reinterpret_cast(get_proc_address("glGetObjectParameterivARB")); + glGetInfoLogARB = reinterpret_cast(get_proc_address("glGetInfoLogARB")); + glGetAttachedObjectsARB = reinterpret_cast(get_proc_address("glGetAttachedObjectsARB")); + glGetUniformLocationARB = reinterpret_cast(get_proc_address("glGetUniformLocationARB")); + glGetActiveUniformARB = reinterpret_cast(get_proc_address("glGetActiveUniformARB")); + glGetUniformfvARB = reinterpret_cast(get_proc_address("glGetUniformfvARB")); + glGetUniformivARB = reinterpret_cast(get_proc_address("glGetUniformivARB")); + glGetShaderSourceARB = reinterpret_cast(get_proc_address("glGetShaderSourceARB")); } } // namespace GL diff --git a/source/arb_vertex_buffer_object.cpp b/source/arb_vertex_buffer_object.cpp index 6e98fef0..66ef40e5 100644 --- a/source/arb_vertex_buffer_object.cpp +++ b/source/arb_vertex_buffer_object.cpp @@ -4,31 +4,31 @@ namespace Msp { namespace GL { -PFNGLBINDBUFFERARBPROC glBindBufferARB=0; -PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB=0; -PFNGLGENBUFFERSARBPROC glGenBuffersARB=0; -PFNGLISBUFFERARBPROC glIsBufferARB=0; -PFNGLBUFFERDATAARBPROC glBufferDataARB=0; -PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB=0; -PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB=0; -PFNGLMAPBUFFERARBPROC glMapBufferARB=0; -PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB=0; -PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB=0; -PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB=0; +PFNGLBINDBUFFERARBPROC glBindBufferARB = 0; +PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB = 0; +PFNGLGENBUFFERSARBPROC glGenBuffersARB = 0; +PFNGLISBUFFERARBPROC glIsBufferARB = 0; +PFNGLBUFFERDATAARBPROC glBufferDataARB = 0; +PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB = 0; +PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubDataARB = 0; +PFNGLMAPBUFFERARBPROC glMapBufferARB = 0; +PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB = 0; +PFNGLGETBUFFERPARAMETERIVARBPROC glGetBufferParameterivARB = 0; +PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointervARB = 0; void init_arb_vertex_buffer_object() { - glBindBufferARB=reinterpret_cast(get_proc_address("glBindBufferARB")); - glDeleteBuffersARB=reinterpret_cast(get_proc_address("glDeleteBuffersARB")); - glGenBuffersARB=reinterpret_cast(get_proc_address("glGenBuffersARB")); - glIsBufferARB=reinterpret_cast(get_proc_address("glIsBufferARB")); - glBufferDataARB=reinterpret_cast(get_proc_address("glBufferDataARB")); - glBufferSubDataARB=reinterpret_cast(get_proc_address("glBufferSubDataARB")); - glGetBufferSubDataARB=reinterpret_cast(get_proc_address("glGetBufferSubDataARB")); - glMapBufferARB=reinterpret_cast(get_proc_address("glMapBufferARB")); - glUnmapBufferARB=reinterpret_cast(get_proc_address("glUnmapBufferARB")); - glGetBufferParameterivARB=reinterpret_cast(get_proc_address("glGetBufferParameterivARB")); - glGetBufferPointervARB=reinterpret_cast(get_proc_address("glGetBufferPointervARB")); + glBindBufferARB = reinterpret_cast(get_proc_address("glBindBufferARB")); + glDeleteBuffersARB = reinterpret_cast(get_proc_address("glDeleteBuffersARB")); + glGenBuffersARB = reinterpret_cast(get_proc_address("glGenBuffersARB")); + glIsBufferARB = reinterpret_cast(get_proc_address("glIsBufferARB")); + glBufferDataARB = reinterpret_cast(get_proc_address("glBufferDataARB")); + glBufferSubDataARB = reinterpret_cast(get_proc_address("glBufferSubDataARB")); + glGetBufferSubDataARB = reinterpret_cast(get_proc_address("glGetBufferSubDataARB")); + glMapBufferARB = reinterpret_cast(get_proc_address("glMapBufferARB")); + glUnmapBufferARB = reinterpret_cast(get_proc_address("glUnmapBufferARB")); + glGetBufferParameterivARB = reinterpret_cast(get_proc_address("glGetBufferParameterivARB")); + glGetBufferPointervARB = reinterpret_cast(get_proc_address("glGetBufferPointervARB")); } } // namespace GL diff --git a/source/arb_vertex_program.cpp b/source/arb_vertex_program.cpp index c68da2b9..41adaee6 100644 --- a/source/arb_vertex_program.cpp +++ b/source/arb_vertex_program.cpp @@ -4,133 +4,133 @@ namespace Msp { namespace GL { -PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB=0; -PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB=0; -PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB=0; -PFNGLVERTEXATTRIB1FVARBPROC glVertexAttrib1fvARB=0; -PFNGLVERTEXATTRIB1SARBPROC glVertexAttrib1sARB=0; -PFNGLVERTEXATTRIB1SVARBPROC glVertexAttrib1svARB=0; -PFNGLVERTEXATTRIB2DARBPROC glVertexAttrib2dARB=0; -PFNGLVERTEXATTRIB2DVARBPROC glVertexAttrib2dvARB=0; -PFNGLVERTEXATTRIB2FARBPROC glVertexAttrib2fARB=0; -PFNGLVERTEXATTRIB2FVARBPROC glVertexAttrib2fvARB=0; -PFNGLVERTEXATTRIB2SARBPROC glVertexAttrib2sARB=0; -PFNGLVERTEXATTRIB2SVARBPROC glVertexAttrib2svARB=0; -PFNGLVERTEXATTRIB3DARBPROC glVertexAttrib3dARB=0; -PFNGLVERTEXATTRIB3DVARBPROC glVertexAttrib3dvARB=0; -PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB=0; -PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB=0; -PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB=0; -PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB=0; -PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4NbvARB=0; -PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4NivARB=0; -PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4NsvARB=0; -PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4NubARB=0; -PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4NubvARB=0; -PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4NuivARB=0; -PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4NusvARB=0; -PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB=0; -PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB=0; -PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB=0; -PFNGLVERTEXATTRIB4FARBPROC glVertexAttrib4fARB=0; -PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB=0; -PFNGLVERTEXATTRIB4IVARBPROC glVertexAttrib4ivARB=0; -PFNGLVERTEXATTRIB4SARBPROC glVertexAttrib4sARB=0; -PFNGLVERTEXATTRIB4SVARBPROC glVertexAttrib4svARB=0; -PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB=0; -PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB=0; -PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB=0; -PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB=0; -PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB=0; -PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB=0; -PFNGLPROGRAMSTRINGARBPROC glProgramStringARB=0; -PFNGLBINDPROGRAMARBPROC glBindProgramARB=0; -PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB=0; -PFNGLGENPROGRAMSARBPROC glGenProgramsARB=0; -PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB=0; -PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB=0; -PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB=0; -PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB=0; -PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB=0; -PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB=0; -PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB=0; -PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB=0; -PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB=0; -PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetProgramEnvParameterfvARB=0; -PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB=0; -PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB=0; -PFNGLGETPROGRAMIVARBPROC glGetProgramivARB=0; -PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB=0; -PFNGLGETVERTEXATTRIBDVARBPROC glGetVertexAttribdvARB=0; -PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB=0; -PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB=0; -PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB=0; -PFNGLISPROGRAMARBPROC glIsProgramARB=0; +PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1dARB = 0; +PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dvARB = 0; +PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB = 0; +PFNGLVERTEXATTRIB1FVARBPROC glVertexAttrib1fvARB = 0; +PFNGLVERTEXATTRIB1SARBPROC glVertexAttrib1sARB = 0; +PFNGLVERTEXATTRIB1SVARBPROC glVertexAttrib1svARB = 0; +PFNGLVERTEXATTRIB2DARBPROC glVertexAttrib2dARB = 0; +PFNGLVERTEXATTRIB2DVARBPROC glVertexAttrib2dvARB = 0; +PFNGLVERTEXATTRIB2FARBPROC glVertexAttrib2fARB = 0; +PFNGLVERTEXATTRIB2FVARBPROC glVertexAttrib2fvARB = 0; +PFNGLVERTEXATTRIB2SARBPROC glVertexAttrib2sARB = 0; +PFNGLVERTEXATTRIB2SVARBPROC glVertexAttrib2svARB = 0; +PFNGLVERTEXATTRIB3DARBPROC glVertexAttrib3dARB = 0; +PFNGLVERTEXATTRIB3DVARBPROC glVertexAttrib3dvARB = 0; +PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3fARB = 0; +PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fvARB = 0; +PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3sARB = 0; +PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3svARB = 0; +PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4NbvARB = 0; +PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4NivARB = 0; +PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4NsvARB = 0; +PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4NubARB = 0; +PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4NubvARB = 0; +PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4NuivARB = 0; +PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4NusvARB = 0; +PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bvARB = 0; +PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4dARB = 0; +PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dvARB = 0; +PFNGLVERTEXATTRIB4FARBPROC glVertexAttrib4fARB = 0; +PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fvARB = 0; +PFNGLVERTEXATTRIB4IVARBPROC glVertexAttrib4ivARB = 0; +PFNGLVERTEXATTRIB4SARBPROC glVertexAttrib4sARB = 0; +PFNGLVERTEXATTRIB4SVARBPROC glVertexAttrib4svARB = 0; +PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubvARB = 0; +PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uivARB = 0; +PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usvARB = 0; +PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARB = 0; +PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARB = 0; +PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARB = 0; +PFNGLPROGRAMSTRINGARBPROC glProgramStringARB = 0; +PFNGLBINDPROGRAMARBPROC glBindProgramARB = 0; +PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB = 0; +PFNGLGENPROGRAMSARBPROC glGenProgramsARB = 0; +PFNGLPROGRAMENVPARAMETER4DARBPROC glProgramEnvParameter4dARB = 0; +PFNGLPROGRAMENVPARAMETER4DVARBPROC glProgramEnvParameter4dvARB = 0; +PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB = 0; +PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fvARB = 0; +PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB = 0; +PFNGLPROGRAMLOCALPARAMETER4DVARBPROC glProgramLocalParameter4dvARB = 0; +PFNGLPROGRAMLOCALPARAMETER4FARBPROC glProgramLocalParameter4fARB = 0; +PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB = 0; +PFNGLGETPROGRAMENVPARAMETERDVARBPROC glGetProgramEnvParameterdvARB = 0; +PFNGLGETPROGRAMENVPARAMETERFVARBPROC glGetProgramEnvParameterfvARB = 0; +PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB = 0; +PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC glGetProgramLocalParameterfvARB = 0; +PFNGLGETPROGRAMIVARBPROC glGetProgramivARB = 0; +PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB = 0; +PFNGLGETVERTEXATTRIBDVARBPROC glGetVertexAttribdvARB = 0; +PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfvARB = 0; +PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribivARB = 0; +PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointervARB = 0; +PFNGLISPROGRAMARBPROC glIsProgramARB = 0; void init_arb_vertex_program() { - glVertexAttrib1dARB=reinterpret_cast(get_proc_address("glVertexAttrib1dARB")); - glVertexAttrib1dvARB=reinterpret_cast(get_proc_address("glVertexAttrib1dvARB")); - glVertexAttrib1fARB=reinterpret_cast(get_proc_address("glVertexAttrib1fARB")); - glVertexAttrib1fvARB=reinterpret_cast(get_proc_address("glVertexAttrib1fvARB")); - glVertexAttrib1sARB=reinterpret_cast(get_proc_address("glVertexAttrib1sARB")); - glVertexAttrib1svARB=reinterpret_cast(get_proc_address("glVertexAttrib1svARB")); - glVertexAttrib2dARB=reinterpret_cast(get_proc_address("glVertexAttrib2dARB")); - glVertexAttrib2dvARB=reinterpret_cast(get_proc_address("glVertexAttrib2dvARB")); - glVertexAttrib2fARB=reinterpret_cast(get_proc_address("glVertexAttrib2fARB")); - glVertexAttrib2fvARB=reinterpret_cast(get_proc_address("glVertexAttrib2fvARB")); - glVertexAttrib2sARB=reinterpret_cast(get_proc_address("glVertexAttrib2sARB")); - glVertexAttrib2svARB=reinterpret_cast(get_proc_address("glVertexAttrib2svARB")); - glVertexAttrib3dARB=reinterpret_cast(get_proc_address("glVertexAttrib3dARB")); - glVertexAttrib3dvARB=reinterpret_cast(get_proc_address("glVertexAttrib3dvARB")); - glVertexAttrib3fARB=reinterpret_cast(get_proc_address("glVertexAttrib3fARB")); - glVertexAttrib3fvARB=reinterpret_cast(get_proc_address("glVertexAttrib3fvARB")); - glVertexAttrib3sARB=reinterpret_cast(get_proc_address("glVertexAttrib3sARB")); - glVertexAttrib3svARB=reinterpret_cast(get_proc_address("glVertexAttrib3svARB")); - glVertexAttrib4NbvARB=reinterpret_cast(get_proc_address("glVertexAttrib4NbvARB")); - glVertexAttrib4NivARB=reinterpret_cast(get_proc_address("glVertexAttrib4NivARB")); - glVertexAttrib4NsvARB=reinterpret_cast(get_proc_address("glVertexAttrib4NsvARB")); - glVertexAttrib4NubARB=reinterpret_cast(get_proc_address("glVertexAttrib4NubARB")); - glVertexAttrib4NubvARB=reinterpret_cast(get_proc_address("glVertexAttrib4NubvARB")); - glVertexAttrib4NuivARB=reinterpret_cast(get_proc_address("glVertexAttrib4NuivARB")); - glVertexAttrib4NusvARB=reinterpret_cast(get_proc_address("glVertexAttrib4NusvARB")); - glVertexAttrib4bvARB=reinterpret_cast(get_proc_address("glVertexAttrib4bvARB")); - glVertexAttrib4dARB=reinterpret_cast(get_proc_address("glVertexAttrib4dARB")); - glVertexAttrib4dvARB=reinterpret_cast(get_proc_address("glVertexAttrib4dvARB")); - glVertexAttrib4fARB=reinterpret_cast(get_proc_address("glVertexAttrib4fARB")); - glVertexAttrib4fvARB=reinterpret_cast(get_proc_address("glVertexAttrib4fvARB")); - glVertexAttrib4ivARB=reinterpret_cast(get_proc_address("glVertexAttrib4ivARB")); - glVertexAttrib4sARB=reinterpret_cast(get_proc_address("glVertexAttrib4sARB")); - glVertexAttrib4svARB=reinterpret_cast(get_proc_address("glVertexAttrib4svARB")); - glVertexAttrib4ubvARB=reinterpret_cast(get_proc_address("glVertexAttrib4ubvARB")); - glVertexAttrib4uivARB=reinterpret_cast(get_proc_address("glVertexAttrib4uivARB")); - glVertexAttrib4usvARB=reinterpret_cast(get_proc_address("glVertexAttrib4usvARB")); - glVertexAttribPointerARB=reinterpret_cast(get_proc_address("glVertexAttribPointerARB")); - glEnableVertexAttribArrayARB=reinterpret_cast(get_proc_address("glEnableVertexAttribArrayARB")); - glDisableVertexAttribArrayARB=reinterpret_cast(get_proc_address("glDisableVertexAttribArrayARB")); - glProgramStringARB=reinterpret_cast(get_proc_address("glProgramStringARB")); - glBindProgramARB=reinterpret_cast(get_proc_address("glBindProgramARB")); - glDeleteProgramsARB=reinterpret_cast(get_proc_address("glDeleteProgramsARB")); - glGenProgramsARB=reinterpret_cast(get_proc_address("glGenProgramsARB")); - glProgramEnvParameter4dARB=reinterpret_cast(get_proc_address("glProgramEnvParameter4dARB")); - glProgramEnvParameter4dvARB=reinterpret_cast(get_proc_address("glProgramEnvParameter4dvARB")); - glProgramEnvParameter4fARB=reinterpret_cast(get_proc_address("glProgramEnvParameter4fARB")); - glProgramEnvParameter4fvARB=reinterpret_cast(get_proc_address("glProgramEnvParameter4fvARB")); - glProgramLocalParameter4dARB=reinterpret_cast(get_proc_address("glProgramLocalParameter4dARB")); - glProgramLocalParameter4dvARB=reinterpret_cast(get_proc_address("glProgramLocalParameter4dvARB")); - glProgramLocalParameter4fARB=reinterpret_cast(get_proc_address("glProgramLocalParameter4fARB")); - glProgramLocalParameter4fvARB=reinterpret_cast(get_proc_address("glProgramLocalParameter4fvARB")); - glGetProgramEnvParameterdvARB=reinterpret_cast(get_proc_address("glGetProgramEnvParameterdvARB")); - glGetProgramEnvParameterfvARB=reinterpret_cast(get_proc_address("glGetProgramEnvParameterfvARB")); - glGetProgramLocalParameterdvARB=reinterpret_cast(get_proc_address("glGetProgramLocalParameterdvARB")); - glGetProgramLocalParameterfvARB=reinterpret_cast(get_proc_address("glGetProgramLocalParameterfvARB")); - glGetProgramivARB=reinterpret_cast(get_proc_address("glGetProgramivARB")); - glGetProgramStringARB=reinterpret_cast(get_proc_address("glGetProgramStringARB")); - glGetVertexAttribdvARB=reinterpret_cast(get_proc_address("glGetVertexAttribdvARB")); - glGetVertexAttribfvARB=reinterpret_cast(get_proc_address("glGetVertexAttribfvARB")); - glGetVertexAttribivARB=reinterpret_cast(get_proc_address("glGetVertexAttribivARB")); - glGetVertexAttribPointervARB=reinterpret_cast(get_proc_address("glGetVertexAttribPointervARB")); - glIsProgramARB=reinterpret_cast(get_proc_address("glIsProgramARB")); + glVertexAttrib1dARB = reinterpret_cast(get_proc_address("glVertexAttrib1dARB")); + glVertexAttrib1dvARB = reinterpret_cast(get_proc_address("glVertexAttrib1dvARB")); + glVertexAttrib1fARB = reinterpret_cast(get_proc_address("glVertexAttrib1fARB")); + glVertexAttrib1fvARB = reinterpret_cast(get_proc_address("glVertexAttrib1fvARB")); + glVertexAttrib1sARB = reinterpret_cast(get_proc_address("glVertexAttrib1sARB")); + glVertexAttrib1svARB = reinterpret_cast(get_proc_address("glVertexAttrib1svARB")); + glVertexAttrib2dARB = reinterpret_cast(get_proc_address("glVertexAttrib2dARB")); + glVertexAttrib2dvARB = reinterpret_cast(get_proc_address("glVertexAttrib2dvARB")); + glVertexAttrib2fARB = reinterpret_cast(get_proc_address("glVertexAttrib2fARB")); + glVertexAttrib2fvARB = reinterpret_cast(get_proc_address("glVertexAttrib2fvARB")); + glVertexAttrib2sARB = reinterpret_cast(get_proc_address("glVertexAttrib2sARB")); + glVertexAttrib2svARB = reinterpret_cast(get_proc_address("glVertexAttrib2svARB")); + glVertexAttrib3dARB = reinterpret_cast(get_proc_address("glVertexAttrib3dARB")); + glVertexAttrib3dvARB = reinterpret_cast(get_proc_address("glVertexAttrib3dvARB")); + glVertexAttrib3fARB = reinterpret_cast(get_proc_address("glVertexAttrib3fARB")); + glVertexAttrib3fvARB = reinterpret_cast(get_proc_address("glVertexAttrib3fvARB")); + glVertexAttrib3sARB = reinterpret_cast(get_proc_address("glVertexAttrib3sARB")); + glVertexAttrib3svARB = reinterpret_cast(get_proc_address("glVertexAttrib3svARB")); + glVertexAttrib4NbvARB = reinterpret_cast(get_proc_address("glVertexAttrib4NbvARB")); + glVertexAttrib4NivARB = reinterpret_cast(get_proc_address("glVertexAttrib4NivARB")); + glVertexAttrib4NsvARB = reinterpret_cast(get_proc_address("glVertexAttrib4NsvARB")); + glVertexAttrib4NubARB = reinterpret_cast(get_proc_address("glVertexAttrib4NubARB")); + glVertexAttrib4NubvARB = reinterpret_cast(get_proc_address("glVertexAttrib4NubvARB")); + glVertexAttrib4NuivARB = reinterpret_cast(get_proc_address("glVertexAttrib4NuivARB")); + glVertexAttrib4NusvARB = reinterpret_cast(get_proc_address("glVertexAttrib4NusvARB")); + glVertexAttrib4bvARB = reinterpret_cast(get_proc_address("glVertexAttrib4bvARB")); + glVertexAttrib4dARB = reinterpret_cast(get_proc_address("glVertexAttrib4dARB")); + glVertexAttrib4dvARB = reinterpret_cast(get_proc_address("glVertexAttrib4dvARB")); + glVertexAttrib4fARB = reinterpret_cast(get_proc_address("glVertexAttrib4fARB")); + glVertexAttrib4fvARB = reinterpret_cast(get_proc_address("glVertexAttrib4fvARB")); + glVertexAttrib4ivARB = reinterpret_cast(get_proc_address("glVertexAttrib4ivARB")); + glVertexAttrib4sARB = reinterpret_cast(get_proc_address("glVertexAttrib4sARB")); + glVertexAttrib4svARB = reinterpret_cast(get_proc_address("glVertexAttrib4svARB")); + glVertexAttrib4ubvARB = reinterpret_cast(get_proc_address("glVertexAttrib4ubvARB")); + glVertexAttrib4uivARB = reinterpret_cast(get_proc_address("glVertexAttrib4uivARB")); + glVertexAttrib4usvARB = reinterpret_cast(get_proc_address("glVertexAttrib4usvARB")); + glVertexAttribPointerARB = reinterpret_cast(get_proc_address("glVertexAttribPointerARB")); + glEnableVertexAttribArrayARB = reinterpret_cast(get_proc_address("glEnableVertexAttribArrayARB")); + glDisableVertexAttribArrayARB = reinterpret_cast(get_proc_address("glDisableVertexAttribArrayARB")); + glProgramStringARB = reinterpret_cast(get_proc_address("glProgramStringARB")); + glBindProgramARB = reinterpret_cast(get_proc_address("glBindProgramARB")); + glDeleteProgramsARB = reinterpret_cast(get_proc_address("glDeleteProgramsARB")); + glGenProgramsARB = reinterpret_cast(get_proc_address("glGenProgramsARB")); + glProgramEnvParameter4dARB = reinterpret_cast(get_proc_address("glProgramEnvParameter4dARB")); + glProgramEnvParameter4dvARB = reinterpret_cast(get_proc_address("glProgramEnvParameter4dvARB")); + glProgramEnvParameter4fARB = reinterpret_cast(get_proc_address("glProgramEnvParameter4fARB")); + glProgramEnvParameter4fvARB = reinterpret_cast(get_proc_address("glProgramEnvParameter4fvARB")); + glProgramLocalParameter4dARB = reinterpret_cast(get_proc_address("glProgramLocalParameter4dARB")); + glProgramLocalParameter4dvARB = reinterpret_cast(get_proc_address("glProgramLocalParameter4dvARB")); + glProgramLocalParameter4fARB = reinterpret_cast(get_proc_address("glProgramLocalParameter4fARB")); + glProgramLocalParameter4fvARB = reinterpret_cast(get_proc_address("glProgramLocalParameter4fvARB")); + glGetProgramEnvParameterdvARB = reinterpret_cast(get_proc_address("glGetProgramEnvParameterdvARB")); + glGetProgramEnvParameterfvARB = reinterpret_cast(get_proc_address("glGetProgramEnvParameterfvARB")); + glGetProgramLocalParameterdvARB = reinterpret_cast(get_proc_address("glGetProgramLocalParameterdvARB")); + glGetProgramLocalParameterfvARB = reinterpret_cast(get_proc_address("glGetProgramLocalParameterfvARB")); + glGetProgramivARB = reinterpret_cast(get_proc_address("glGetProgramivARB")); + glGetProgramStringARB = reinterpret_cast(get_proc_address("glGetProgramStringARB")); + glGetVertexAttribdvARB = reinterpret_cast(get_proc_address("glGetVertexAttribdvARB")); + glGetVertexAttribfvARB = reinterpret_cast(get_proc_address("glGetVertexAttribfvARB")); + glGetVertexAttribivARB = reinterpret_cast(get_proc_address("glGetVertexAttribivARB")); + glGetVertexAttribPointervARB = reinterpret_cast(get_proc_address("glGetVertexAttribPointervARB")); + glIsProgramARB = reinterpret_cast(get_proc_address("glIsProgramARB")); } } // namespace GL diff --git a/source/arb_vertex_shader.cpp b/source/arb_vertex_shader.cpp index 9c9dc3d7..612c5033 100644 --- a/source/arb_vertex_shader.cpp +++ b/source/arb_vertex_shader.cpp @@ -4,15 +4,15 @@ namespace Msp { namespace GL { -PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB=0; -PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB=0; -PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB=0; +PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB = 0; +PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = 0; +PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = 0; void init_arb_vertex_shader() { - glBindAttribLocationARB=reinterpret_cast(get_proc_address("glBindAttribLocationARB")); - glGetActiveAttribARB=reinterpret_cast(get_proc_address("glGetActiveAttribARB")); - glGetAttribLocationARB=reinterpret_cast(get_proc_address("glGetAttribLocationARB")); + glBindAttribLocationARB = reinterpret_cast(get_proc_address("glBindAttribLocationARB")); + glGetActiveAttribARB = reinterpret_cast(get_proc_address("glGetActiveAttribARB")); + glGetAttribLocationARB = reinterpret_cast(get_proc_address("glGetAttribLocationARB")); } } // namespace GL diff --git a/source/batch.cpp b/source/batch.cpp index 9ed20a1f..86ad9435 100644 --- a/source/batch.cpp +++ b/source/batch.cpp @@ -23,11 +23,11 @@ Batch::Batch(PrimitiveType t): Batch &Batch::append(unsigned i) { if(indices.empty()) - min_index=max_index=i; + min_index = max_index = i; else { - min_index=min(min_index, i); - max_index=max(max_index, i); + min_index = min(min_index, i); + max_index = max(max_index, i); } indices.push_back(i); diff --git a/source/bindable.h b/source/bindable.h index cd012fbb..e26840fa 100644 --- a/source/bindable.h +++ b/source/bindable.h @@ -24,7 +24,7 @@ protected: if(obj==cur_obj) return false; - cur_obj=obj; + cur_obj = obj; return true; } diff --git a/source/bloom.cpp b/source/bloom.cpp index b74bde80..5f2adc85 100644 --- a/source/bloom.cpp +++ b/source/bloom.cpp @@ -22,8 +22,8 @@ static const char blur_vs[]= "varying vec2 texcoord;\n" "void main()\n" "{\n" - " gl_Position=vec4(gl_Vertex.xy*2.0-1.0, 0.0, 1.0);\n" - " texcoord=gl_Vertex.xy;\n" + " gl_Position = vec4(gl_Vertex.xy*2.0-1.0, 0.0, 1.0);\n" + " texcoord = gl_Vertex.xy;\n" "}"; static const char blur_fs[]= @@ -34,17 +34,17 @@ static const char blur_fs[]= "varying vec2 texcoord;\n" "void main()\n" "{\n" - " gl_FragColor=vec4(0.0, 0.0, 0.0, 0.0);\n" + " gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n" " for(int i=-size; i<=size; ++i)\n" - " gl_FragColor+=texture2D(source, texcoord+delta*i)*factors[i+size];\n" + " gl_FragColor += texture2D(source, texcoord+delta*i)*factors[i+size];\n" "}"; static const char combine_vs[]= "varying vec2 texcoord;\n" "void main()\n" "{\n" - " gl_Position=vec4(gl_Vertex.xy*2.0-1.0, 0.0, 1.0);\n" - " texcoord=gl_Vertex.xy;\n" + " gl_Position = vec4(gl_Vertex.xy*2.0-1.0, 0.0, 1.0);\n" + " texcoord = gl_Vertex.xy;\n" "}"; static const char combine_fs[]= @@ -54,7 +54,7 @@ static const char combine_fs[]= "varying vec2 texcoord;\n" "void main()\n" "{\n" - " gl_FragColor=mix(texture2D(source, texcoord), texture2D(blurred, texcoord), strength);\n" + " gl_FragColor = mix(texture2D(source, texcoord), texture2D(blurred, texcoord), strength);\n" "}"; } @@ -67,11 +67,11 @@ Bloom::Bloom(unsigned w, unsigned h): combine_shader(combine_vs, combine_fs), quad(VERTEX2) { - int loc=blur_shader.get_uniform_location("delta"); + int loc = blur_shader.get_uniform_location("delta"); blur_shdata[0].uniform(loc, 1.0f/w, 0.0f); blur_shdata[1].uniform(loc, 0.0f, 1.0f/h); - loc=blur_shader.get_uniform_location("source"); + loc = blur_shader.get_uniform_location("source"); for(unsigned i=0; i<2; ++i) { blur_shdata[i].uniform(loc, 0); @@ -100,21 +100,21 @@ void Bloom::set_radius(float r) if(r<=0.0f) throw InvalidParameterValue("Radius must be positive"); - int size=min(static_cast(r*3.0f), 9); - int loc=blur_shader.get_uniform_location("size"); + int size = min(static_cast(r*3.0f), 9); + int loc = blur_shader.get_uniform_location("size"); blur_shdata[0].uniform(loc, size); blur_shdata[1].uniform(loc, size); vector factors(size*2+1); - float sum=0.0f; - r=2*r*r; + float sum = 0.0f; + r = 2*r*r; for(int i=-size; i<=size; ++i) - sum+=(factors[size+i]=exp(-i*i/r)); + sum += (factors[size+i] = exp(-i*i/r)); for(int i=0; i<=size*2; ++i) { - loc=blur_shader.get_uniform_location(format("factors[%d]", i)); - float f=factors[i]/sum; + loc = blur_shader.get_uniform_location(format("factors[%d]", i)); + float f = factors[i]/sum; blur_shdata[0].uniform(loc, f); blur_shdata[1].uniform(loc, f); } @@ -129,7 +129,7 @@ void Bloom::set_strength(float s) void Bloom::render(const Texture2D &src) { - const Framebuffer *dest=Framebuffer::current(); + const Framebuffer *dest = Framebuffer::current(); blur_shader.bind(); fbo.bind(); src.bind_to(0); diff --git a/source/buffer.cpp b/source/buffer.cpp index b4b71c3a..17ae494f 100644 --- a/source/buffer.cpp +++ b/source/buffer.cpp @@ -31,7 +31,7 @@ Buffer::~Buffer() void Buffer::bind(BufferType t) const { glBindBufferARB(t, id); - binding(t)=this; + binding(t) = this; } void Buffer::maybe_bind() const @@ -42,7 +42,7 @@ void Buffer::maybe_bind() const void Buffer::set_usage(BufferUsage u) { - usage=u; + usage = u; } void Buffer::data(unsigned size, const void *d) @@ -59,11 +59,11 @@ void Buffer::sub_data(unsigned offset, unsigned size, const void *d) void Buffer::unbind(BufferType type) { - const Buffer *&ptr=binding(type); + const Buffer *&ptr = binding(type); if(ptr) { glBindBufferARB(type, 0); - ptr=0; + ptr = 0; } } @@ -79,7 +79,7 @@ const Buffer *&Buffer::binding(BufferType type) } } -const Buffer *Buffer::bound[4]={ 0, 0, 0, 0 }; +const Buffer *Buffer::bound[4] = { 0, 0, 0, 0 }; } // namespace GL } // namespace Msp diff --git a/source/clip.cpp b/source/clip.cpp index ca1b7420..96f5bd41 100644 --- a/source/clip.cpp +++ b/source/clip.cpp @@ -13,10 +13,10 @@ namespace GL { ClipPlane::ClipPlane(double a, double b, double c, double d) { - eq[0]=a; - eq[1]=b; - eq[2]=c; - eq[3]=d; + eq[0] = a; + eq[1] = b; + eq[2] = c; + eq[3] = d; } void ClipPlane::apply_to(unsigned n) diff --git a/source/ext_framebuffer_object.cpp b/source/ext_framebuffer_object.cpp index 80da8283..ab5048d6 100644 --- a/source/ext_framebuffer_object.cpp +++ b/source/ext_framebuffer_object.cpp @@ -4,43 +4,43 @@ namespace Msp { namespace GL { -PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT=0; -PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT=0; -PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT=0; -PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT=0; -PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT=0; -PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT=0; -PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT=0; -PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT=0; -PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT=0; -PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT=0; -PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT=0; -PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT=0; -PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT=0; -PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT=0; -PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT=0; -PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT=0; -PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT=0; +PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT = 0; +PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = 0; +PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = 0; +PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT = 0; +PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT = 0; +PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT = 0; +PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT = 0; +PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT = 0; +PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT = 0; +PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT = 0; +PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT = 0; +PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT = 0; +PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT = 0; +PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT = 0; +PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = 0; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT = 0; +PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = 0; void init_ext_framebuffer_object() { - glIsRenderbufferEXT=reinterpret_cast(get_proc_address("glIsRenderbufferEXT")); - glBindRenderbufferEXT=reinterpret_cast(get_proc_address("glBindRenderbufferEXT")); - glDeleteRenderbuffersEXT=reinterpret_cast(get_proc_address("glDeleteRenderbuffersEXT")); - glGenRenderbuffersEXT=reinterpret_cast(get_proc_address("glGenRenderbuffersEXT")); - glRenderbufferStorageEXT=reinterpret_cast(get_proc_address("glRenderbufferStorageEXT")); - glGetRenderbufferParameterivEXT=reinterpret_cast(get_proc_address("glGetRenderbufferParameterivEXT")); - glIsFramebufferEXT=reinterpret_cast(get_proc_address("glIsFramebufferEXT")); - glBindFramebufferEXT=reinterpret_cast(get_proc_address("glBindFramebufferEXT")); - glDeleteFramebuffersEXT=reinterpret_cast(get_proc_address("glDeleteFramebuffersEXT")); - glGenFramebuffersEXT=reinterpret_cast(get_proc_address("glGenFramebuffersEXT")); - glCheckFramebufferStatusEXT=reinterpret_cast(get_proc_address("glCheckFramebufferStatusEXT")); - glFramebufferTexture1DEXT=reinterpret_cast(get_proc_address("glFramebufferTexture1DEXT")); - glFramebufferTexture2DEXT=reinterpret_cast(get_proc_address("glFramebufferTexture2DEXT")); - glFramebufferTexture3DEXT=reinterpret_cast(get_proc_address("glFramebufferTexture3DEXT")); - glFramebufferRenderbufferEXT=reinterpret_cast(get_proc_address("glFramebufferRenderbufferEXT")); - glGetFramebufferAttachmentParameterivEXT=reinterpret_cast(get_proc_address("glGetFramebufferAttachmentParameterivEXT")); - glGenerateMipmapEXT=reinterpret_cast(get_proc_address("glGenerateMipmapEXT")); + glIsRenderbufferEXT = reinterpret_cast(get_proc_address("glIsRenderbufferEXT")); + glBindRenderbufferEXT = reinterpret_cast(get_proc_address("glBindRenderbufferEXT")); + glDeleteRenderbuffersEXT = reinterpret_cast(get_proc_address("glDeleteRenderbuffersEXT")); + glGenRenderbuffersEXT = reinterpret_cast(get_proc_address("glGenRenderbuffersEXT")); + glRenderbufferStorageEXT = reinterpret_cast(get_proc_address("glRenderbufferStorageEXT")); + glGetRenderbufferParameterivEXT = reinterpret_cast(get_proc_address("glGetRenderbufferParameterivEXT")); + glIsFramebufferEXT = reinterpret_cast(get_proc_address("glIsFramebufferEXT")); + glBindFramebufferEXT = reinterpret_cast(get_proc_address("glBindFramebufferEXT")); + glDeleteFramebuffersEXT = reinterpret_cast(get_proc_address("glDeleteFramebuffersEXT")); + glGenFramebuffersEXT = reinterpret_cast(get_proc_address("glGenFramebuffersEXT")); + glCheckFramebufferStatusEXT = reinterpret_cast(get_proc_address("glCheckFramebufferStatusEXT")); + glFramebufferTexture1DEXT = reinterpret_cast(get_proc_address("glFramebufferTexture1DEXT")); + glFramebufferTexture2DEXT = reinterpret_cast(get_proc_address("glFramebufferTexture2DEXT")); + glFramebufferTexture3DEXT = reinterpret_cast(get_proc_address("glFramebufferTexture3DEXT")); + glFramebufferRenderbufferEXT = reinterpret_cast(get_proc_address("glFramebufferRenderbufferEXT")); + glGetFramebufferAttachmentParameterivEXT = reinterpret_cast(get_proc_address("glGetFramebufferAttachmentParameterivEXT")); + glGenerateMipmapEXT = reinterpret_cast(get_proc_address("glGenerateMipmapEXT")); } } // namespace GL diff --git a/source/extension.cpp b/source/extension.cpp index 6b00ceb6..9ed17779 100644 --- a/source/extension.cpp +++ b/source/extension.cpp @@ -31,13 +31,13 @@ namespace GL { bool is_supported(const string &ext) { static set extensions; - static bool init_done=false; + static bool init_done = false; if(!init_done) { - if(const char *gl_ext=reinterpret_cast(glGetString(GL_EXTENSIONS))) + if(const char *gl_ext = reinterpret_cast(glGetString(GL_EXTENSIONS))) { - vector exts=split(gl_ext); + vector exts = split(gl_ext); extensions.insert(exts.begin(), exts.end()); } @@ -54,7 +54,7 @@ bool is_supported(const string &ext) if(extensions.count("GL_ARB_vertex_buffer_object")) init_arb_vertex_buffer_object(); - init_done=true; + init_done = true; } return extensions.count(ext); @@ -63,16 +63,16 @@ bool is_supported(const string &ext) const Version &get_gl_version() { static Version version; - static bool init_done=false; + static bool init_done = false; if(!init_done) { - string gl_ver=reinterpret_cast(glGetString(GL_VERSION)); - vector parts=split(gl_ver.substr(0, gl_ver.find(' ')), '.'); - version.major=lexical_cast(parts[0]); - version.minor=lexical_cast(parts[1]); + string gl_ver = reinterpret_cast(glGetString(GL_VERSION)); + vector parts = split(gl_ver.substr(0, gl_ver.find(' ')), '.'); + version.major = lexical_cast(parts[0]); + version.minor = lexical_cast(parts[1]); - unsigned combined=version.major*0x100+version.minor; + unsigned combined = version.major*0x100+version.minor; if(combined>=0x102) init_version_1_2(); if(combined>=0x103) @@ -92,7 +92,7 @@ void require_extension(const string &ext) void require_version(unsigned a, unsigned b) { - const Version &ver=get_gl_version(); + const Version &ver = get_gl_version(); if(ver.majorbind(); - float x=0; - unsigned count=0; + float x = 0; + unsigned count = 0; pbuilder.begin(QUADS); for(string::const_iterator i=str.begin(); i!=str.end();) { - GlyphMap::const_iterator j=glyphs.find(dec.decode_char(str, i)); + GlyphMap::const_iterator j = glyphs.find(dec.decode_char(str, i)); if(j==glyphs.end()) continue; create_glyph_vertices(j->second, pbuilder, x); - x+=j->second.advance; - count+=4; + x += j->second.advance; + count += 4; } pbuilder.end(); } @@ -117,7 +117,7 @@ void Font::create_glyph_vertices(const Glyph &glyph, VertexBuilder &vbuilder, fl float Font::get_glyph_advance(unsigned code) const { - GlyphMap::const_iterator i=glyphs.find(code); + GlyphMap::const_iterator i = glyphs.find(code); if(i==glyphs.end()) return 0; @@ -150,17 +150,17 @@ void Font::Loader::init() void Font::Loader::glyph(unsigned c) { Glyph gl; - gl.code=c; + gl.code = c; load_sub(gl); obj.glyphs.insert(GlyphMap::value_type(c, gl)); } void Font::Loader::texture_inline() { - RefPtr tex=new Texture2D; + RefPtr tex = new Texture2D; load_sub(*tex); - obj.tex=tex.release(); - obj.own_tex=true; + obj.tex = tex.release(); + obj.own_tex = true; } @@ -175,10 +175,10 @@ Font::Glyph::Loader::Loader(Glyph &g): void Font::Glyph::Loader::texcoords(float x1, float y1, float x2, float y2) { - obj.x1=x1; - obj.y1=y1; - obj.x2=x2; - obj.y2=y2; + obj.x1 = x1; + obj.y1 = y1; + obj.x2 = x2; + obj.y2 = y2; } } // namespace GL diff --git a/source/framebuffer.cpp b/source/framebuffer.cpp index 229c7f0a..6941c034 100644 --- a/source/framebuffer.cpp +++ b/source/framebuffer.cpp @@ -37,7 +37,7 @@ void Framebuffer::bind() const if(!cur_fbo) get(GL_VIEWPORT, sys_viewport); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, id); - cur_fbo=this; + cur_fbo = this; if(width && height) viewport(0, 0, width, height); } @@ -46,7 +46,7 @@ void Framebuffer::attach(FramebufferAttachment attch, Renderbuffer &rbuf) { maybe_bind(); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, attch, GL_RENDERBUFFER_EXT, rbuf.get_id()); - get_or_create_attachment(attch)=rbuf; + get_or_create_attachment(attch) = rbuf; check_size(); } @@ -54,7 +54,7 @@ void Framebuffer::attach(FramebufferAttachment attch, Texture2D &tex, int level) { maybe_bind(); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attch, tex.get_target(), tex.get_id(), level); - get_or_create_attachment(attch)=tex; + get_or_create_attachment(attch) = tex; check_size(); } @@ -90,7 +90,7 @@ void Framebuffer::unbind() if(cur_fbo) { glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - cur_fbo=0; + cur_fbo = 0; viewport(sys_viewport[0], sys_viewport[1], sys_viewport[2], sys_viewport[3]); } } @@ -114,25 +114,25 @@ void Framebuffer::check_size() { if(!attachments.empty()) { - const Attachment &attch=attachments.front(); + const Attachment &attch = attachments.front(); if(attch.type==GL_RENDERBUFFER_EXT) { - width=attch.rbuf->get_width(); - height=attch.rbuf->get_height(); + width = attch.rbuf->get_width(); + height = attch.rbuf->get_height(); } else if(attch.type==GL_TEXTURE_2D) { - Texture2D *tex=static_cast(attch.tex); - width=tex->get_width(); - height=tex->get_height(); + Texture2D *tex = static_cast(attch.tex); + width = tex->get_width(); + height = tex->get_height(); } if(cur_fbo==this) viewport(0, 0, width, height); } } -const Framebuffer *Framebuffer::cur_fbo=0; -int Framebuffer::sys_viewport[4]={ 0, 0, 1, 1 }; +const Framebuffer *Framebuffer::cur_fbo = 0; +int Framebuffer::sys_viewport[4] = { 0, 0, 1, 1 }; Framebuffer::Attachment::Attachment(FramebufferAttachment a): @@ -142,15 +142,15 @@ Framebuffer::Attachment::Attachment(FramebufferAttachment a): Framebuffer::Attachment &Framebuffer::Attachment::operator=(Renderbuffer &r) { - type=GL_RENDERBUFFER_EXT; - rbuf=&r; + type = GL_RENDERBUFFER_EXT; + rbuf = &r; return *this; } Framebuffer::Attachment &Framebuffer::Attachment::operator=(Texture &t) { - type=t.get_target(); - tex=&t; + type = t.get_target(); + tex = &t; return *this; } diff --git a/source/light.cpp b/source/light.cpp index b523fe36..26cc8963 100644 --- a/source/light.cpp +++ b/source/light.cpp @@ -23,58 +23,58 @@ Light::Light(): spot_exp(0), spot_cutoff(180) { - attenuation[0]=1; - attenuation[1]=0; - attenuation[2]=0; + attenuation[0] = 1; + attenuation[1] = 0; + attenuation[2] = 0; } void Light::set_ambient(const Color &c) { - ambient=c; + ambient = c; } void Light::set_diffuse(const Color &c) { - diffuse=c; + diffuse = c; } void Light::set_specular(const Color &c) { - specular=c; + specular = c; } void Light::set_position(const Vector4 &p) { - position=p; + position = p; } void Light::set_spot_direction(const Vector3 &d) { - spot_dir=d; + spot_dir = d; } void Light::set_spot_exponent(float e) { - spot_exp=e; + spot_exp = e; } void Light::set_spot_cutoff(float c) { - spot_cutoff=c; + spot_cutoff = c; } void Light::set_attenuation(float c, float l, float q) { - attenuation[0]=c; - attenuation[1]=l; - attenuation[2]=q; + attenuation[0] = c; + attenuation[1] = l; + attenuation[2] = q; } void Light::bind() const { if(current_lights[current_unit]!=this) { - GLenum l=GL_LIGHT0+current_unit; + GLenum l = GL_LIGHT0+current_unit; enable(l); glLightfv(l, GL_AMBIENT, &ambient.r); glLightfv(l, GL_DIFFUSE, &diffuse.r); @@ -86,7 +86,7 @@ void Light::bind() const glLightf(l, GL_CONSTANT_ATTENUATION, attenuation[0]); glLightf(l, GL_LINEAR_ATTENUATION, attenuation[1]); glLightf(l, GL_QUADRATIC_ATTENUATION, attenuation[2]); - current_lights[current_unit]=this; + current_lights[current_unit] = this; } } @@ -98,7 +98,7 @@ void Light::bind_to(unsigned i) const void Light::activate(unsigned i) { - static unsigned max_lights=get_i(GL_MAX_LIGHTS); + static unsigned max_lights = get_i(GL_MAX_LIGHTS); if(i>=max_lights) throw InvalidParameterValue("Light unit index out of range"); @@ -106,7 +106,7 @@ void Light::activate(unsigned i) if(i>=current_lights.size()) current_lights.resize(i+1); - current_unit=i; + current_unit = i; } void Light::unbind() @@ -114,11 +114,11 @@ void Light::unbind() if(current_lights[current_unit]) { disable(GL_LIGHT0+current_unit); - current_lights[current_unit]=0; + current_lights[current_unit] = 0; } } -unsigned Light::current_unit=0; +unsigned Light::current_unit = 0; vector Light::current_lights(1); } // namespace GL diff --git a/source/lighting.cpp b/source/lighting.cpp index 6b6af57c..0d6e7dc4 100644 --- a/source/lighting.cpp +++ b/source/lighting.cpp @@ -18,7 +18,7 @@ Lighting::Lighting(): void Lighting::set_ambient(const Color &a) { - ambient=a; + ambient = a; } void Lighting::attach(unsigned i, const Light &l) @@ -26,7 +26,7 @@ void Lighting::attach(unsigned i, const Light &l) if(i>=lights.size()) lights.resize(i+1); - lights[i]=&l; + lights[i] = &l; } void Lighting::detach(unsigned i) @@ -34,7 +34,7 @@ void Lighting::detach(unsigned i) if(i>=lights.size()) return; - lights[i]=0; + lights[i] = 0; } void Lighting::bind() const @@ -46,7 +46,7 @@ void Lighting::bind() const for(unsigned i=0; ibind_to(i); - current=this; + current = this; } } @@ -61,11 +61,11 @@ void Lighting::unbind() Light::unbind(); } disable(LIGHTING); - current=0; + current = 0; } } -const Lighting *Lighting::current=0; +const Lighting *Lighting::current = 0; } // namespace GL } // namespace Msp diff --git a/source/material.cpp b/source/material.cpp index b5ec6a5c..eee1ebc6 100644 --- a/source/material.cpp +++ b/source/material.cpp @@ -21,27 +21,27 @@ Material::Material(): void Material::set_ambient(const Color &a) { - ambient=a; + ambient = a; } void Material::set_diffuse(const Color &d) { - diffuse=d; + diffuse = d; } void Material::set_specular(const Color &s) { - specular=s; + specular = s; } void Material::set_emission(const Color &e) { - emission=e; + emission = e; } void Material::set_shininess(float s) { - shininess=s; + shininess = s; } void Material::bind() const @@ -53,16 +53,16 @@ void Material::bind() const glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, &emission.r); glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess); - current=this; + current = this; } } void Material::unbind() { - current=0; + current = 0; } -const Material *Material::current=0; +const Material *Material::current = 0; Material::Loader::Loader(Material &m): @@ -77,22 +77,22 @@ Material::Loader::Loader(Material &m): void Material::Loader::ambient(float r, float g, float b, float a) { - obj.ambient=GL::Color(r, g, b, a); + obj.ambient = GL::Color(r, g, b, a); } void Material::Loader::diffuse(float r, float g, float b, float a) { - obj.diffuse=GL::Color(r, g, b, a); + obj.diffuse = GL::Color(r, g, b, a); } void Material::Loader::specular(float r, float g, float b, float a) { - obj.specular=GL::Color(r, g, b, a); + obj.specular = GL::Color(r, g, b, a); } void Material::Loader::emission(float r, float g, float b, float a) { - obj.emission=GL::Color(r, g, b, a); + obj.emission = GL::Color(r, g, b, a); } } // namespace GL diff --git a/source/matrix.h b/source/matrix.h index 79d330a3..b574c735 100644 --- a/source/matrix.h +++ b/source/matrix.h @@ -15,9 +15,9 @@ namespace GL { enum MatrixMode { - MODELVIEW=GL_MODELVIEW, - PROJECTION=GL_PROJECTION, - TEXTURE=GL_TEXTURE + MODELVIEW = GL_MODELVIEW, + PROJECTION = GL_PROJECTION, + TEXTURE = GL_TEXTURE }; void matrix_mode(MatrixMode); diff --git a/source/mesh.cpp b/source/mesh.cpp index 2ca040e6..d421769a 100644 --- a/source/mesh.cpp +++ b/source/mesh.cpp @@ -29,14 +29,14 @@ void Mesh::use_vertex_buffer(bool b) { vertices.use_vertex_buffer(); if(!ibuf) - ibuf=new Buffer(ELEMENT_ARRAY_BUFFER); + ibuf = new Buffer(ELEMENT_ARRAY_BUFFER); update_index_buffer(); } else { vertices.use_vertex_buffer(0); delete ibuf; - ibuf=0; + ibuf = 0; } } @@ -63,11 +63,11 @@ void Mesh::draw() const if(ibuf) { ibuf->bind(); - unsigned offset=0; + unsigned offset = 0; for(list::const_iterator i=batches.begin(); i!=batches.end(); ++i) { i->draw_with_buffer(offset); - offset+=i->size(); + offset += i->size(); } ibuf->unbind(); } @@ -83,16 +83,16 @@ void Mesh::update_index_buffer() if(!ibuf) return; - unsigned total=0; + unsigned total = 0; for(list::const_iterator i=batches.begin(); i!=batches.end(); ++i) - total+=i->size(); + total += i->size(); ibuf->data(total*sizeof(unsigned), 0); - unsigned offset=0; + unsigned offset = 0; for(list::const_iterator i=batches.begin(); i!=batches.end(); ++i) { ibuf->sub_data(offset*sizeof(unsigned), i->size()*sizeof(unsigned), &i->get_indices()[0]); - offset+=i->size(); + offset += i->size(); } ibuf->unbind(); } diff --git a/source/meshbuilder.cpp b/source/meshbuilder.cpp index 025bced1..b238ae63 100644 --- a/source/meshbuilder.cpp +++ b/source/meshbuilder.cpp @@ -19,14 +19,14 @@ MeshBuilder::MeshBuilder(Mesh &m): void MeshBuilder::begin_() { - batch=new Batch(type); + batch = new Batch(type); } void MeshBuilder::end_() { mesh.add_batch(*batch); delete batch; - batch=0; + batch = 0; } void MeshBuilder::element_(unsigned i) diff --git a/source/object.cpp b/source/object.cpp index 2423fcda..938e83f9 100644 --- a/source/object.cpp +++ b/source/object.cpp @@ -40,7 +40,7 @@ Object::~Object() void Object::render(const Tag &tag) const { - const RenderPass *pass=get_pass(tag); + const RenderPass *pass = get_pass(tag); if(!pass) return; @@ -50,7 +50,7 @@ void Object::render(const Tag &tag) const void Object::render(const ObjectInstance &inst, const Tag &tag) const { - const RenderPass *pass=get_pass(tag); + const RenderPass *pass = get_pass(tag); if(!pass) return; @@ -69,7 +69,7 @@ const RenderPass *Object::get_pass(const Tag &tag) const void Object::render_instance(const ObjectInstance &inst, const Tag &tag) const { inst.setup_render(tag); - unsigned lod=min(inst.get_level_of_detail(), meshes.size()-1); + unsigned lod = min(inst.get_level_of_detail(), meshes.size()-1); meshes[lod]->draw(); inst.finish_render(tag); } @@ -89,7 +89,7 @@ Object::Loader::Loader(Object &o, Collection &c): void Object::Loader::init() { - allow_pointer_reload=false; + allow_pointer_reload = false; add("lod_mesh", &Loader::lod_mesh); add("mesh", static_cast(&Loader::mesh)); @@ -101,7 +101,7 @@ void Object::Loader::init() void Object::Loader::lod_mesh(unsigned l, const string &n) { obj.meshes.resize(l+1, 0); - obj.meshes[l]=get_collection().get(n); + obj.meshes[l] = get_collection().get(n); } void Object::Loader::mesh() @@ -109,10 +109,10 @@ void Object::Loader::mesh() if(obj.meshes[0]) throw InvalidState("A mesh is already loaded"); - RefPtr msh=new Mesh; + RefPtr msh = new Mesh; load_sub(*msh); - obj.meshes[0]=msh.release(); - obj.own_mesh=true; + obj.meshes[0] = msh.release(); + obj.own_mesh = true; } void Object::Loader::mesh(const std::string &n) @@ -120,18 +120,18 @@ void Object::Loader::mesh(const std::string &n) if(obj.meshes[0]) throw InvalidState("A mesh is already loaded"); - obj.meshes[0]=get_collection().get(n); + obj.meshes[0] = get_collection().get(n); } void Object::Loader::technique() { - RefPtr tech=new Technique; + RefPtr tech = new Technique; if(coll) load_sub(*tech, get_collection()); else load_sub(*tech); - obj.technique=tech.release(); - obj.own_technique=true; + obj.technique = tech.release(); + obj.own_technique = true; } } // namespace GL diff --git a/source/object.h b/source/object.h index 0b53d63c..bff41bf1 100644 --- a/source/object.h +++ b/source/object.h @@ -60,14 +60,14 @@ public: /** Renders the object. A tag can be provided to render a non-default pass. */ - virtual void render(const Tag &tag=Tag()) const; + virtual void render(const Tag &tag = Tag()) const; /** Renders the object with an instance. The instance's hook functions are called before and after drawing the mesh. A tag may also be given to render a non-default pass. */ - virtual void render(const ObjectInstance &, const Tag &tag=Tag()) const; + virtual void render(const ObjectInstance &, const Tag &tag = Tag()) const; /** Renders multiple instances of the object in one go. This may improve @@ -76,9 +76,9 @@ public: mesh. */ template - void render(Iter begin, Iter end, const Tag &tag=Tag()) const + void render(Iter begin, Iter end, const Tag &tag = Tag()) const { - const RenderPass *pass=get_pass(tag); + const RenderPass *pass = get_pass(tag); if(!pass) return; diff --git a/source/objectinstance.h b/source/objectinstance.h index 602cbc24..61ad55d3 100644 --- a/source/objectinstance.h +++ b/source/objectinstance.h @@ -35,7 +35,7 @@ public: const Object &get_object() const { return object; } - virtual void render(const Tag &tag=Tag()) const; + virtual void render(const Tag &tag = Tag()) const; /** Hook function, called from Object just before rendering the mesh. diff --git a/source/pipeline.cpp b/source/pipeline.cpp index 97c45265..54ef25a1 100644 --- a/source/pipeline.cpp +++ b/source/pipeline.cpp @@ -49,14 +49,14 @@ PipelinePass &Pipeline::add_pass(const Tag &tag) if(passes.count(tag)) throw KeyError("Pass already exists"); - PipelinePass &pass=passes[tag]; + PipelinePass &pass = passes[tag]; pass_order.push_back(tag); return pass; } PipelinePass &Pipeline::get_pass(const Tag &tag) { - PassMap::iterator i=passes.find(tag); + PassMap::iterator i = passes.find(tag); if(i==passes.end()) throw KeyError("Unknown pass"); return i->second; @@ -64,7 +64,7 @@ PipelinePass &Pipeline::get_pass(const Tag &tag) const PipelinePass &Pipeline::get_pass(const Tag &tag) const { - PassMap::const_iterator i=passes.find(tag); + PassMap::const_iterator i = passes.find(tag); if(i==passes.end()) throw KeyError("Unknown pass"); return i->second; @@ -85,14 +85,14 @@ void Pipeline::add_postprocessor(PostProcessor &pp) postproc.push_back(&pp); if(!fbo) { - fbo=new Framebuffer; - color_buf=new Texture2D; + fbo = new Framebuffer; + color_buf = new Texture2D; color_buf->set_min_filter(NEAREST); color_buf->set_mag_filter(NEAREST); color_buf->storage((hdr ? RGB16F : RGB), width, height, 0); color_buf->image(0, RGB, UNSIGNED_BYTE, 0); fbo->attach(COLOR_ATTACHMENT0, *color_buf, 0); - depth_buf=new Renderbuffer; + depth_buf = new Renderbuffer; depth_buf->storage(DEPTH_COMPONENT, width, height); fbo->attach(DEPTH_ATTACHMENT, *depth_buf); Framebuffer::unbind(); @@ -101,7 +101,7 @@ void Pipeline::add_postprocessor(PostProcessor &pp) void Pipeline::render(const Tag &tag) const { - const PipelinePass &pass=get_pass(tag); + const PipelinePass &pass = get_pass(tag); Bind bind_depth_test(pass.depth_test); Bind bind_blend(pass.blend); diff --git a/source/pipeline.h b/source/pipeline.h index 592c3cae..5da9a7b3 100644 --- a/source/pipeline.h +++ b/source/pipeline.h @@ -54,7 +54,7 @@ public: void add_effect(Effect &); void add_postprocessor(PostProcessor &); - virtual void render(const Tag &tag=Tag()) const; + virtual void render(const Tag &tag = Tag()) const; void render_all() const; }; diff --git a/source/pixelformat.cpp b/source/pixelformat.cpp index d968917b..27a814e2 100644 --- a/source/pixelformat.cpp +++ b/source/pixelformat.cpp @@ -19,31 +19,31 @@ istream &operator>>(istream &in, PixelFormat &fmt) in>>word; if(word=="COLOR_INDEX") - fmt=COLOR_INDEX; + fmt = COLOR_INDEX; else if(word=="STENCIL_INDEX") - fmt=STENCIL_INDEX; + fmt = STENCIL_INDEX; else if(word=="DEPTH_COMPONENT") - fmt=DEPTH_COMPONENT; + fmt = DEPTH_COMPONENT; else if(word=="RED") - fmt=RED; + fmt = RED; else if(word=="GREEN") - fmt=GREEN; + fmt = GREEN; else if(word=="BLUE") - fmt=BLUE; + fmt = BLUE; else if(word=="ALPHA") - fmt=ALPHA; + fmt = ALPHA; else if(word=="RGB") - fmt=RGB; + fmt = RGB; else if(word=="RGBA") - fmt=RGBA; + fmt = RGBA; else if(word=="BGR") - fmt=BGR; + fmt = BGR; else if(word=="BGRA") - fmt=BGRA; + fmt = BGRA; else if(word=="LUMINANCE") - fmt=LUMINANCE; + fmt = LUMINANCE; else if(word=="LUMINANCE_ALPHA") - fmt=LUMINANCE_ALPHA; + fmt = LUMINANCE_ALPHA; else in.setstate(ios_base::failbit); diff --git a/source/primitivebuilder.cpp b/source/primitivebuilder.cpp index 95faa3fb..e032a441 100644 --- a/source/primitivebuilder.cpp +++ b/source/primitivebuilder.cpp @@ -21,8 +21,8 @@ void PrimitiveBuilder::begin(PrimitiveType t) if(in_batch) throw InvalidState("begin() already called"); - type=t; - in_batch=true; + type = t; + in_batch = true; begin_(); } @@ -32,7 +32,7 @@ void PrimitiveBuilder::end() if(!in_batch) throw InvalidState("end() called without begin()"); - in_batch=false; + in_batch = false; end_(); } diff --git a/source/primitivetype.cpp b/source/primitivetype.cpp index c11a59f7..0872f776 100644 --- a/source/primitivetype.cpp +++ b/source/primitivetype.cpp @@ -16,25 +16,25 @@ std::istream &operator>>(std::istream &in, PrimitiveType &pt) in>>str; if(str=="POINTS") - pt=POINTS; + pt = POINTS; else if(str=="LINES") - pt=LINES; + pt = LINES; else if(str=="LINE_LOOP") - pt=LINE_LOOP; + pt = LINE_LOOP; else if(str=="LINE_STRIP") - pt=LINE_STRIP; + pt = LINE_STRIP; else if(str=="TRIANGLES") - pt=TRIANGLES; + pt = TRIANGLES; else if(str=="TRIANGLE_STRIP") - pt=TRIANGLE_STRIP; + pt = TRIANGLE_STRIP; else if(str=="TRIANGLE_FAN") - pt=TRIANGLE_FAN; + pt = TRIANGLE_FAN; else if(str=="QUADS") - pt=QUADS; + pt = QUADS; else if(str=="QUAD_STRIP") - pt=QUAD_STRIP; + pt = QUAD_STRIP; else if(str=="POLYGON") - pt=POLYGON; + pt = POLYGON; else in.setstate(std::ios_base::failbit); diff --git a/source/program.cpp b/source/program.cpp index b3773a63..ef1f4c8a 100644 --- a/source/program.cpp +++ b/source/program.cpp @@ -38,8 +38,8 @@ void Program::init() { static RequireExtension _ext("GL_ARB_shader_objects"); - linked=false; - id=glCreateProgramObjectARB(); + linked = false; + id = glCreateProgramObjectARB(); } Program::~Program() @@ -63,7 +63,7 @@ void Program::attach_shader(Shader &shader) void Program::detach_shader(Shader &shader) { - list::iterator i=remove(shaders.begin(), shaders.end(), &shader); + list::iterator i = remove(shaders.begin(), shaders.end(), &shader); if(i!=shaders.end()) { shaders.erase(i, shaders.end()); @@ -73,7 +73,7 @@ void Program::detach_shader(Shader &shader) void Program::set_del_shaders(bool ds) { - del_shaders=ds; + del_shaders = ds; } void Program::bind_attribute(unsigned index, const string &name) @@ -89,7 +89,7 @@ void Program::link() (*i)->compile(); glLinkProgramARB(id); - if(!(linked=get_param(GL_LINK_STATUS))) + if(!(linked = get_param(GL_LINK_STATUS))) throw CompileError(get_info_log()); } @@ -102,7 +102,7 @@ int Program::get_param(GLenum param) const string Program::get_info_log() const { - GLsizei len=get_param(GL_INFO_LOG_LENGTH); + GLsizei len = get_param(GL_INFO_LOG_LENGTH); char log[len+1]; glGetInfoLogARB(id, len+1, &len, log); return string(log, len); @@ -114,7 +114,7 @@ void Program::bind() const throw InvalidState("Program is not linked"); glUseProgramObjectARB(id); - cur_prog=this; + cur_prog = this; } int Program::get_uniform_location(const string &n) const @@ -127,7 +127,7 @@ void Program::unbind() if(cur_prog) { glUseProgramObjectARB(0); - cur_prog=0; + cur_prog = 0; } } @@ -137,7 +137,7 @@ void Program::maybe_bind() bind(); } -const Program *Program::cur_prog=0; +const Program *Program::cur_prog = 0; Program::Loader::Loader(Program &p): diff --git a/source/programdata.cpp b/source/programdata.cpp index cc75f28d..9ab0731d 100644 --- a/source/programdata.cpp +++ b/source/programdata.cpp @@ -24,7 +24,7 @@ ProgramData::ProgramData(const ProgramData &other): data(other.data) { for(map::iterator i=data.begin(); i!=data.end(); ++i) - i->second=i->second->clone(); + i->second = i->second->clone(); } ProgramData::~ProgramData() @@ -41,14 +41,14 @@ void ProgramData::uniform(int index, Uniform *uni) return; } - map::iterator i=data.find(index); + map::iterator i = data.find(index); if(i!=data.end()) { delete i->second; - i->second=uni; + i->second = uni; } else - data[index]=uni; + data[index] = uni; } void ProgramData::uniform(int index, int v) diff --git a/source/projection.cpp b/source/projection.cpp index 2c234525..2cc2833f 100644 --- a/source/projection.cpp +++ b/source/projection.cpp @@ -44,7 +44,7 @@ void frustum_centered(double width, double height, double nearr, double farr) void perspective(double fov_y, double aspect, double nearr, double farr) { - double hh=tan(fov_y*M_PI/360)*nearr; + double hh = tan(fov_y*M_PI/360)*nearr; frustum(-hh*aspect, hh*aspect, -hh, hh, nearr, farr); } diff --git a/source/renderable.h b/source/renderable.h index 6e433d3e..44b3c257 100644 --- a/source/renderable.h +++ b/source/renderable.h @@ -21,7 +21,7 @@ protected: public: virtual ~Renderable() { } - virtual void render(const Tag &tag=Tag()) const =0; + virtual void render(const Tag &tag = Tag()) const =0; }; } // namespace Msp diff --git a/source/renderbuffer.cpp b/source/renderbuffer.cpp index 40d58cef..31a623ea 100644 --- a/source/renderbuffer.cpp +++ b/source/renderbuffer.cpp @@ -33,8 +33,8 @@ void Renderbuffer::bind() const void Renderbuffer::storage(PixelFormat fmt, unsigned w, unsigned h) { bind(); - width=w; - height=h; + width = w; + height = h; glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, fmt, width, height); } diff --git a/source/rendermode.cpp b/source/rendermode.cpp index e7efd0c3..0c8cb0c4 100644 --- a/source/rendermode.cpp +++ b/source/rendermode.cpp @@ -16,7 +16,7 @@ int render_mode(RenderMode rm) int old_rm; glGetIntegerv(GL_RENDER_MODE, &old_rm); - int result=glRenderMode(rm); + int result = glRenderMode(rm); if(old_rm==SELECT) _parse_internal_select_records(result); diff --git a/source/renderpass.cpp b/source/renderpass.cpp index 06726086..4aa41dba 100644 --- a/source/renderpass.cpp +++ b/source/renderpass.cpp @@ -19,7 +19,7 @@ using namespace std; namespace Msp { namespace GL { -const RenderPass *RenderPass::current=0; +const RenderPass *RenderPass::current = 0; RenderPass::RenderPass(): shprog(0), @@ -45,7 +45,7 @@ RenderPass::~RenderPass() void RenderPass::set_material(const Material *mat) { - material=mat; + material = mat; } unsigned RenderPass::get_texture_index(const string &slot) const @@ -59,7 +59,7 @@ unsigned RenderPass::get_texture_index(const string &slot) const void RenderPass::set_texture(const string &slot, const Texture *tex) { - textures[get_texture_index(slot)]=tex; + textures[get_texture_index(slot)] = tex; } void RenderPass::bind() const @@ -67,8 +67,8 @@ void RenderPass::bind() const if(this==current) return; - const RenderPass *old=current; - current=this; + const RenderPass *old = current; + current = this; if(shprog) { @@ -106,7 +106,7 @@ void RenderPass::unbind() for(unsigned i=current->textures.size(); i--; ) GL::Texture::unbind_from(i); - current=0; + current = 0; } } @@ -125,7 +125,7 @@ RenderPass::Loader::Loader(RenderPass &p, Collection &c): void RenderPass::Loader::init() { - allow_pointer_reload=false; + allow_pointer_reload = false; add("shader", &RenderPass::shprog); add("material", &Loader::material); @@ -139,11 +139,11 @@ void RenderPass::Loader::finish() if(obj.shprog) { if(!obj.shdata) - obj.shdata=new ProgramData; + obj.shdata = new ProgramData; for(unsigned i=0; iget_uniform_location(obj.textures[i].name); + unsigned loc = obj.shprog->get_uniform_location(obj.textures[i].name); obj.shdata->uniform(loc, static_cast(i)); } } @@ -154,17 +154,17 @@ void RenderPass::Loader::material() if(obj.material) throw InvalidState("A material is already loaded"); - RefPtr mat=new Material; + RefPtr mat = new Material; load_sub(*mat); - obj.material=mat.release(); - obj.own_material=true; + obj.material = mat.release(); + obj.own_material = true; } void RenderPass::Loader::texture(const string &n) { - const Texture *tex=(n.empty() ? 0 : get_collection().get(n)); + const Texture *tex = (n.empty() ? 0 : get_collection().get(n)); TextureSlot slot(tex); - slot.name=(obj.textures.empty() ? "texture" : format("texture%d", obj.textures.size())); + slot.name = (obj.textures.empty() ? "texture" : format("texture%d", obj.textures.size())); load_sub(slot); obj.textures.push_back(slot); } @@ -174,7 +174,7 @@ void RenderPass::Loader::uniforms() if(!obj.shprog) throw InvalidState("Can't load uniforms without a shader program"); if(!obj.shdata) - obj.shdata=new ProgramData; + obj.shdata = new ProgramData; load_sub(*obj.shdata, *obj.shprog); } diff --git a/source/scene.cpp b/source/scene.cpp index 28b794b0..1e72d5dc 100644 --- a/source/scene.cpp +++ b/source/scene.cpp @@ -14,7 +14,7 @@ namespace GL { void Scene::add(const Renderable &r) { - if(const ObjectInstance *oi=dynamic_cast(&r)) + if(const ObjectInstance *oi = dynamic_cast(&r)) objects[&oi->get_object()].insert(oi); else renderables.insert(&r); @@ -22,9 +22,9 @@ void Scene::add(const Renderable &r) void Scene::remove(const Renderable &r) { - if(const ObjectInstance *oi=dynamic_cast(&r)) + if(const ObjectInstance *oi = dynamic_cast(&r)) { - ObjectMap::iterator i=objects.find(&oi->get_object()); + ObjectMap::iterator i = objects.find(&oi->get_object()); if(i!=objects.end()) { i->second.erase(oi); diff --git a/source/scene.h b/source/scene.h index 6a4be91d..329099ea 100644 --- a/source/scene.h +++ b/source/scene.h @@ -32,7 +32,7 @@ public: void add(const Renderable &); void remove(const Renderable &); - virtual void render(const Tag &tag=Tag()) const; + virtual void render(const Tag &tag = Tag()) const; }; } // namespace GL diff --git a/source/select.cpp b/source/select.cpp index e905729d..65ce6ce6 100644 --- a/source/select.cpp +++ b/source/select.cpp @@ -13,7 +13,7 @@ using namespace std; namespace { -vector *select_buf=0; +vector *select_buf = 0; vector select_buf_int; } @@ -25,7 +25,7 @@ void select_buffer(vector &buf) { select_buf_int.resize(1024); glSelectBuffer(select_buf_int.size(), &select_buf_int[0]); - select_buf=&buf; + select_buf = &buf; } void init_names() @@ -50,14 +50,14 @@ void load_name(unsigned n) void parse_select_records(const unsigned *buf, unsigned count, vector &tbuf) { - unsigned i=0; + unsigned i = 0; while(count--) { SelectRecord record; - unsigned n_names=buf[i++]; - record.min_depth=buf[i++]; - record.max_depth=buf[i++]; + unsigned n_names = buf[i++]; + record.min_depth = buf[i++]; + record.max_depth = buf[i++]; record.names.reserve(n_names); while(n_names--) diff --git a/source/shader.cpp b/source/shader.cpp index e32919bc..5ff2eb36 100644 --- a/source/shader.cpp +++ b/source/shader.cpp @@ -30,14 +30,14 @@ Shader::Shader(ShaderType t, const string &src) void Shader::init(ShaderType t) { - compiled=false; + compiled = false; if(t==FRAGMENT_SHADER) static RequireExtension _ext("GL_ARB_fragment_shader"); else if(t==VERTEX_SHADER) static RequireExtension _ext("GL_ARB_vertex_shader"); - id=glCreateShaderObjectARB(t); + id = glCreateShaderObjectARB(t); } Shader::~Shader() @@ -63,7 +63,7 @@ void Shader::source(const char *str, int len) void Shader::compile() { glCompileShaderARB(id); - if(!(compiled=get_param(GL_COMPILE_STATUS))) + if(!(compiled = get_param(GL_COMPILE_STATUS))) throw CompileError(get_info_log()); } @@ -76,7 +76,7 @@ int Shader::get_param(GLenum param) const string Shader::get_info_log() const { - GLsizei len=get_param(GL_INFO_LOG_LENGTH); + GLsizei len = get_param(GL_INFO_LOG_LENGTH); char log[len+1]; glGetInfoLogARB(id, len+1, &len, log); return string(log, len); diff --git a/source/shadowmap.cpp b/source/shadowmap.cpp index 9dadb8fe..7a761e7a 100644 --- a/source/shadowmap.cpp +++ b/source/shadowmap.cpp @@ -43,64 +43,64 @@ ShadowMap::ShadowMap(unsigned s, const Scene &c, const Light &l): void ShadowMap::set_target(const Vector3 &t, float r) { - target=t; - radius=r; + target = t; + radius = r; } void ShadowMap::set_texture_unit(unsigned u) { - unit=u; + unit = u; } void ShadowMap::prepare() { - Vector4 lpos=light.get_position(); + Vector4 lpos = light.get_position(); if(lpos.w) { /* XXX Not really proper way to support positional lights, but good enough when the light source is far away */ - lpos.x-=target.x; - lpos.y-=target.y; - lpos.z-=target.z; - float d=sqrt(lpos.x*lpos.x+lpos.y*lpos.y+lpos.z*lpos.z); - lpos.x/=d; - lpos.y/=d; - lpos.z/=d; + lpos.x -= target.x; + lpos.y -= target.y; + lpos.z -= target.z; + float d = sqrt(lpos.x*lpos.x+lpos.y*lpos.y+lpos.z*lpos.z); + lpos.x /= d; + lpos.y /= d; + lpos.z /= d; } float matrix[16]; if(abs(lpos.z)>=abs(lpos.x) && abs(lpos.z)>=abs(lpos.y)) { - float d=sqrt(lpos.x*lpos.x+lpos.z*lpos.z); - matrix[0]=lpos.z/d; - matrix[4]=0; - matrix[8]=-lpos.x/d; - matrix[1]=-lpos.x*lpos.y/d; - matrix[5]=d; - matrix[9]=-lpos.z*lpos.y/d; + float d = sqrt(lpos.x*lpos.x+lpos.z*lpos.z); + matrix[0] = lpos.z/d; + matrix[4] = 0; + matrix[8] = -lpos.x/d; + matrix[1] = -lpos.x*lpos.y/d; + matrix[5] = d; + matrix[9] = -lpos.z*lpos.y/d; } else { - float d=sqrt(lpos.x*lpos.x+lpos.y*lpos.y); - matrix[0]=-lpos.y/d; - matrix[4]=lpos.x/d; - matrix[8]=0; - matrix[1]=-lpos.x*lpos.z/d; - matrix[5]=-lpos.y*lpos.z/d; - matrix[9]=d; + float d = sqrt(lpos.x*lpos.x+lpos.y*lpos.y); + matrix[0] = -lpos.y/d; + matrix[4] = lpos.x/d; + matrix[8] = 0; + matrix[1] = -lpos.x*lpos.z/d; + matrix[5] = -lpos.y*lpos.z/d; + matrix[9] = d; } - matrix[2]=lpos.x; - matrix[6]=lpos.y; - matrix[10]=lpos.z; + matrix[2] = lpos.x; + matrix[6] = lpos.y; + matrix[10] = lpos.z; - matrix[12]=-(target.x*matrix[0]+target.y*matrix[4]+target.z*matrix[8]); - matrix[13]=-(target.x*matrix[1]+target.y*matrix[5]+target.z*matrix[9]); - matrix[14]=-(target.x*matrix[2]+target.y*matrix[6]+target.z*matrix[10]); - matrix[3]=0; - matrix[7]=0; - matrix[11]=0; - matrix[15]=1; + matrix[12] = -(target.x*matrix[0]+target.y*matrix[4]+target.z*matrix[8]); + matrix[13] = -(target.x*matrix[1]+target.y*matrix[5]+target.z*matrix[9]); + matrix[14] = -(target.x*matrix[2]+target.y*matrix[6]+target.z*matrix[10]); + matrix[3] = 0; + matrix[7] = 0; + matrix[11] = 0; + matrix[15] = 1; { matrix_mode(PROJECTION); @@ -111,7 +111,7 @@ void ShadowMap::prepare() push_matrix(); load_matrix(matrix); - const Framebuffer *old_fbo=Framebuffer::current(); + const Framebuffer *old_fbo = Framebuffer::current(); fbo.bind(); clear(DEPTH_BUFFER_BIT); scene.render("shadow"); @@ -127,10 +127,10 @@ void ShadowMap::prepare() } depth_buf.bind_to(unit); - float diam=radius*2; - float s_eq[4]={ matrix[0]/diam, matrix[4]/diam, matrix[8]/diam, matrix[12]/diam+0.5 }; - float t_eq[4]={ matrix[1]/diam, matrix[5]/diam, matrix[9]/diam, matrix[13]/diam+0.5 }; - float r_eq[4]={ -matrix[2]/diam, -matrix[6]/diam, -matrix[10]/diam, 0.5-matrix[14]/diam-4.0/size }; + float diam = radius*2; + float s_eq[4] = { matrix[0]/diam, matrix[4]/diam, matrix[8]/diam, matrix[12]/diam+0.5 }; + float t_eq[4] = { matrix[1]/diam, matrix[5]/diam, matrix[9]/diam, matrix[13]/diam+0.5 }; + float r_eq[4] = { -matrix[2]/diam, -matrix[6]/diam, -matrix[10]/diam, 0.5-matrix[14]/diam-4.0/size }; glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_S, GL_EYE_PLANE, s_eq); enable(GL_TEXTURE_GEN_S); diff --git a/source/tag.cpp b/source/tag.cpp index 76adf7d1..3586507a 100644 --- a/source/tag.cpp +++ b/source/tag.cpp @@ -12,9 +12,9 @@ namespace { template inline unsigned hash(T begin, T end) { - unsigned result=0; + unsigned result = 0; for(T i=begin; (i!=end && *i); ++i) - result=((result>>29)|(result<<5))^static_cast(*i); + result = ((result>>29)|(result<<5))^static_cast(*i); return result; } diff --git a/source/technique.cpp b/source/technique.cpp index d913f4d1..74505c8e 100644 --- a/source/technique.cpp +++ b/source/technique.cpp @@ -27,7 +27,7 @@ bool Technique::has_pass(const GL::Tag &tag) const const RenderPass &Technique::get_pass(const GL::Tag &tag) const { - PassMap::const_iterator i=passes.find(tag); + PassMap::const_iterator i = passes.find(tag); if(i==passes.end()) throw KeyError("Unknown pass"); return i->second; @@ -54,7 +54,7 @@ void Technique::Loader::init() void Technique::Loader::inherit(const string &n) { - obj.passes=get_collection().get(n)->get_passes(); + obj.passes = get_collection().get(n)->get_passes(); InheritLoader ldr(obj, get_collection()); load_sub_with(ldr); } @@ -82,7 +82,7 @@ Technique::InheritLoader::InheritLoader(Technique &t, Collection &c): void Technique::InheritLoader::texture(const string &slot, const string &name) { - Texture *tex=get_collection().get(name); + Texture *tex = get_collection().get(name); for(PassMap::iterator i=obj.passes.begin(); i!=obj.passes.end(); ++i) { try diff --git a/source/texenv.cpp b/source/texenv.cpp index 6e5cca77..e6c06bcb 100644 --- a/source/texenv.cpp +++ b/source/texenv.cpp @@ -17,12 +17,12 @@ TexEnv::TexEnv(): void TexEnv::set_mode(TexEnvMode m) { - mode=m; + mode = m; } void TexEnv::set_color(const Color &c) { - color=c; + color = c; } void TexEnv::bind() diff --git a/source/texture.cpp b/source/texture.cpp index e897ba92..40f18d45 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -20,17 +20,17 @@ istream &operator>>(istream &in, TextureFilter &tf) in>>str; if(str=="NEAREST") - tf=NEAREST; + tf = NEAREST; else if(str=="LINEAR") - tf=LINEAR; + tf = LINEAR; else if(str=="NEAREST_MIPMAP_NEAREST") - tf=NEAREST_MIPMAP_NEAREST; + tf = NEAREST_MIPMAP_NEAREST; else if(str=="NEAREST_MIPMAP_LINEAR") - tf=NEAREST_MIPMAP_LINEAR; + tf = NEAREST_MIPMAP_LINEAR; else if(str=="LINEAR_MIPMAP_NEAREST") - tf=LINEAR_MIPMAP_NEAREST; + tf = LINEAR_MIPMAP_NEAREST; else if(str=="LINEAR_MIPMAP_LINEAR") - tf=LINEAR_MIPMAP_LINEAR; + tf = LINEAR_MIPMAP_LINEAR; else in.setstate(ios_base::failbit); @@ -43,7 +43,7 @@ void Texture::bind() const if(!target) throw InvalidState("Attempt to bind a texture without target"); - const Texture *cur=TexUnit::current().get_texture(); + const Texture *cur = TexUnit::current().get_texture(); if(cur!=this) { if(cur && cur->target!=target) @@ -82,7 +82,7 @@ Texture::~Texture() void Texture::unbind() { - const Texture *cur=TexUnit::current().get_texture(); + const Texture *cur = TexUnit::current().get_texture(); if(!cur) return; diff --git a/source/texture2d.cpp b/source/texture2d.cpp index 1c5a9d63..197e04df 100644 --- a/source/texture2d.cpp +++ b/source/texture2d.cpp @@ -17,7 +17,7 @@ Texture2D::Texture2D(): width(0), height(0) { - target=GL_TEXTURE_2D; + target = GL_TEXTURE_2D; bind(); } @@ -28,10 +28,10 @@ void Texture2D::storage(PixelFormat fmt, unsigned wd, unsigned ht, int brd) if(wd==0 || ht==0) throw InvalidParameterValue("Invalid texture dimensions"); - ifmt=fmt; - width=wd; - height=ht; - border=brd; + ifmt = fmt; + width = wd; + height = ht; + border = brd; } void Texture2D::image(int level, PixelFormat fmt, DataType type, const void *data) @@ -64,9 +64,9 @@ void Texture2D::load_image(const string &fn) void Texture2D::image(const Graphics::Image &img) { - unsigned w=img.get_width(); - unsigned h=img.get_height(); - PixelFormat fmt=pixelformat_from_graphics(img.get_format()); + unsigned w = img.get_width(); + unsigned h = img.get_height(); + PixelFormat fmt = pixelformat_from_graphics(img.get_format()); if(width==0) storage(fmt, w, h, 0); else if(w!=width || h!=height) @@ -94,7 +94,7 @@ void Texture2D::Loader::image_data(const string &data) void Texture2D::Loader::raw_data(const string &data) { - Texture2D &t2d=static_cast(obj); + Texture2D &t2d = static_cast(obj); t2d.image(0, t2d.ifmt, UNSIGNED_BYTE, data.data()); } diff --git a/source/texture3d.cpp b/source/texture3d.cpp index b34e20cd..183bede5 100644 --- a/source/texture3d.cpp +++ b/source/texture3d.cpp @@ -24,7 +24,7 @@ Texture3D::Texture3D(): { static RequireVersion _ver(1, 3); - target=GL_TEXTURE_3D; + target = GL_TEXTURE_3D; bind(); } @@ -35,11 +35,11 @@ void Texture3D::storage(PixelFormat f, unsigned w, unsigned h, unsigned d, int b if(w==0 || h==0 || d==0) throw InvalidParameterValue("Invalid texture dimensions"); - width=w; - height=h; - depth=d; - ifmt=f; - border=b; + width = w; + height = h; + depth = d; + ifmt = f; + border = b; image(0, ifmt, UNSIGNED_BYTE, 0); } @@ -55,16 +55,16 @@ void Texture3D::load_image(const string &fn, int dp) Graphics::Image img; img.load_file(fn); - unsigned w=img.get_width(); - unsigned h=img.get_height(); - unsigned d=1; + unsigned w = img.get_width(); + unsigned h = img.get_height(); + unsigned d = 1; if(dp==-1) { if(h%w) throw IncompatibleData("Image height is not divisible by its width"); - d=h/w; - h=w; + d = h/w; + h = w; } else if(dp==-2) { @@ -72,12 +72,12 @@ void Texture3D::load_image(const string &fn, int dp) for(; d*d0) - d=dp; + d = dp; - PixelFormat fmt=pixelformat_from_graphics(img.get_format()); + PixelFormat fmt = pixelformat_from_graphics(img.get_format()); if(width==0) storage(fmt, w, h, d, 0); else if(w!=width || h!=height || d!=depth) diff --git a/source/texture3d.h b/source/texture3d.h index 8d9566d8..50e4555a 100644 --- a/source/texture3d.h +++ b/source/texture3d.h @@ -30,7 +30,7 @@ public: void storage(PixelFormat, unsigned, unsigned, unsigned, int); void image(int, PixelFormat, DataType, const void *); void sub_image(int, int, int, unsigned, unsigned, unsigned, PixelFormat, DataType, const void *); - void load_image(const std::string &fn, int dp=-1); + void load_image(const std::string &fn, int dp = -1); unsigned get_width() const { return width; } unsigned get_height() const { return height; } unsigned get_depth() const { return depth; } diff --git a/source/texunit.cpp b/source/texunit.cpp index 622599a2..1155fa96 100644 --- a/source/texunit.cpp +++ b/source/texunit.cpp @@ -22,15 +22,15 @@ TexUnit::TexUnit(): bool TexUnit::set_texture(const Texture *tex) { - bool result=(tex!=texture); - texture=tex; + bool result = (tex!=texture); + texture = tex; return result; } bool TexUnit::set_texenv(const TexEnv *env) { - bool result=(texenv!=env); - texenv=env; + bool result = (texenv!=env); + texenv = env; return result; } @@ -44,7 +44,7 @@ TexUnit &TexUnit::activate(unsigned n) static RequireVersion _ver(1, 3); glActiveTexture(GL_TEXTURE0+n); } - cur_unit=&units[n]; + cur_unit = &units[n]; return units[n]; } @@ -57,7 +57,7 @@ TexUnit &TexUnit::current() } vector TexUnit::units; -TexUnit *TexUnit::cur_unit=0; +TexUnit *TexUnit::cur_unit = 0; } // namespace GL } // namespace Msp diff --git a/source/uniform.cpp b/source/uniform.cpp index 8ed1336e..641552e7 100644 --- a/source/uniform.cpp +++ b/source/uniform.cpp @@ -43,8 +43,8 @@ Uniform1f *Uniform1f::clone() const Uniform2f::Uniform2f(float v0, float v1) { - v[0]=v0; - v[1]=v1; + v[0] = v0; + v[1] = v1; } void Uniform2f::apply(int index) const @@ -60,9 +60,9 @@ Uniform2f *Uniform2f::clone() const Uniform3f::Uniform3f(float v0, float v1, float v2) { - v[0]=v0; - v[1]=v1; - v[2]=v2; + v[0] = v0; + v[1] = v1; + v[2] = v2; } void Uniform3f::apply(int index) const @@ -78,10 +78,10 @@ Uniform3f *Uniform3f::clone() const Uniform4f::Uniform4f(float v0, float v1, float v2, float v3) { - v[0]=v0; - v[1]=v1; - v[2]=v2; - v[3]=v3; + v[0] = v0; + v[1] = v1; + v[2] = v2; + v[3] = v3; } void Uniform4f::apply(int index) const diff --git a/source/version_1_2.cpp b/source/version_1_2.cpp index d7c2734d..9fed2834 100644 --- a/source/version_1_2.cpp +++ b/source/version_1_2.cpp @@ -4,85 +4,85 @@ namespace Msp { namespace GL { -PFNGLBLENDCOLORPROC glBlendColor=0; -PFNGLBLENDEQUATIONPROC glBlendEquation=0; -PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements=0; -PFNGLCOLORTABLEPROC glColorTable=0; -PFNGLCOLORTABLEPARAMETERFVPROC glColorTableParameterfv=0; -PFNGLCOLORTABLEPARAMETERIVPROC glColorTableParameteriv=0; -PFNGLCOPYCOLORTABLEPROC glCopyColorTable=0; -PFNGLGETCOLORTABLEPROC glGetColorTable=0; -PFNGLGETCOLORTABLEPARAMETERFVPROC glGetColorTableParameterfv=0; -PFNGLGETCOLORTABLEPARAMETERIVPROC glGetColorTableParameteriv=0; -PFNGLCOLORSUBTABLEPROC glColorSubTable=0; -PFNGLCOPYCOLORSUBTABLEPROC glCopyColorSubTable=0; -PFNGLCONVOLUTIONFILTER1DPROC glConvolutionFilter1D=0; -PFNGLCONVOLUTIONFILTER2DPROC glConvolutionFilter2D=0; -PFNGLCONVOLUTIONPARAMETERFPROC glConvolutionParameterf=0; -PFNGLCONVOLUTIONPARAMETERFVPROC glConvolutionParameterfv=0; -PFNGLCONVOLUTIONPARAMETERIPROC glConvolutionParameteri=0; -PFNGLCONVOLUTIONPARAMETERIVPROC glConvolutionParameteriv=0; -PFNGLCOPYCONVOLUTIONFILTER1DPROC glCopyConvolutionFilter1D=0; -PFNGLCOPYCONVOLUTIONFILTER2DPROC glCopyConvolutionFilter2D=0; -PFNGLGETCONVOLUTIONFILTERPROC glGetConvolutionFilter=0; -PFNGLGETCONVOLUTIONPARAMETERFVPROC glGetConvolutionParameterfv=0; -PFNGLGETCONVOLUTIONPARAMETERIVPROC glGetConvolutionParameteriv=0; -PFNGLGETSEPARABLEFILTERPROC glGetSeparableFilter=0; -PFNGLSEPARABLEFILTER2DPROC glSeparableFilter2D=0; -PFNGLGETHISTOGRAMPROC glGetHistogram=0; -PFNGLGETHISTOGRAMPARAMETERFVPROC glGetHistogramParameterfv=0; -PFNGLGETHISTOGRAMPARAMETERIVPROC glGetHistogramParameteriv=0; -PFNGLGETMINMAXPROC glGetMinmax=0; -PFNGLGETMINMAXPARAMETERFVPROC glGetMinmaxParameterfv=0; -PFNGLGETMINMAXPARAMETERIVPROC glGetMinmaxParameteriv=0; -PFNGLHISTOGRAMPROC glHistogram=0; -PFNGLMINMAXPROC glMinmax=0; -PFNGLRESETHISTOGRAMPROC glResetHistogram=0; -PFNGLRESETMINMAXPROC glResetMinmax=0; -PFNGLTEXIMAGE3DPROC glTexImage3D=0; -PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D=0; -PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3D=0; +PFNGLBLENDCOLORPROC glBlendColor = 0; +PFNGLBLENDEQUATIONPROC glBlendEquation = 0; +PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements = 0; +PFNGLCOLORTABLEPROC glColorTable = 0; +PFNGLCOLORTABLEPARAMETERFVPROC glColorTableParameterfv = 0; +PFNGLCOLORTABLEPARAMETERIVPROC glColorTableParameteriv = 0; +PFNGLCOPYCOLORTABLEPROC glCopyColorTable = 0; +PFNGLGETCOLORTABLEPROC glGetColorTable = 0; +PFNGLGETCOLORTABLEPARAMETERFVPROC glGetColorTableParameterfv = 0; +PFNGLGETCOLORTABLEPARAMETERIVPROC glGetColorTableParameteriv = 0; +PFNGLCOLORSUBTABLEPROC glColorSubTable = 0; +PFNGLCOPYCOLORSUBTABLEPROC glCopyColorSubTable = 0; +PFNGLCONVOLUTIONFILTER1DPROC glConvolutionFilter1D = 0; +PFNGLCONVOLUTIONFILTER2DPROC glConvolutionFilter2D = 0; +PFNGLCONVOLUTIONPARAMETERFPROC glConvolutionParameterf = 0; +PFNGLCONVOLUTIONPARAMETERFVPROC glConvolutionParameterfv = 0; +PFNGLCONVOLUTIONPARAMETERIPROC glConvolutionParameteri = 0; +PFNGLCONVOLUTIONPARAMETERIVPROC glConvolutionParameteriv = 0; +PFNGLCOPYCONVOLUTIONFILTER1DPROC glCopyConvolutionFilter1D = 0; +PFNGLCOPYCONVOLUTIONFILTER2DPROC glCopyConvolutionFilter2D = 0; +PFNGLGETCONVOLUTIONFILTERPROC glGetConvolutionFilter = 0; +PFNGLGETCONVOLUTIONPARAMETERFVPROC glGetConvolutionParameterfv = 0; +PFNGLGETCONVOLUTIONPARAMETERIVPROC glGetConvolutionParameteriv = 0; +PFNGLGETSEPARABLEFILTERPROC glGetSeparableFilter = 0; +PFNGLSEPARABLEFILTER2DPROC glSeparableFilter2D = 0; +PFNGLGETHISTOGRAMPROC glGetHistogram = 0; +PFNGLGETHISTOGRAMPARAMETERFVPROC glGetHistogramParameterfv = 0; +PFNGLGETHISTOGRAMPARAMETERIVPROC glGetHistogramParameteriv = 0; +PFNGLGETMINMAXPROC glGetMinmax = 0; +PFNGLGETMINMAXPARAMETERFVPROC glGetMinmaxParameterfv = 0; +PFNGLGETMINMAXPARAMETERIVPROC glGetMinmaxParameteriv = 0; +PFNGLHISTOGRAMPROC glHistogram = 0; +PFNGLMINMAXPROC glMinmax = 0; +PFNGLRESETHISTOGRAMPROC glResetHistogram = 0; +PFNGLRESETMINMAXPROC glResetMinmax = 0; +PFNGLTEXIMAGE3DPROC glTexImage3D = 0; +PFNGLTEXSUBIMAGE3DPROC glTexSubImage3D = 0; +PFNGLCOPYTEXSUBIMAGE3DPROC glCopyTexSubImage3D = 0; void init_version_1_2() { - glBlendColor=reinterpret_cast(get_proc_address("glBlendColor")); - glBlendEquation=reinterpret_cast(get_proc_address("glBlendEquation")); - glDrawRangeElements=reinterpret_cast(get_proc_address("glDrawRangeElements")); - glColorTable=reinterpret_cast(get_proc_address("glColorTable")); - glColorTableParameterfv=reinterpret_cast(get_proc_address("glColorTableParameterfv")); - glColorTableParameteriv=reinterpret_cast(get_proc_address("glColorTableParameteriv")); - glCopyColorTable=reinterpret_cast(get_proc_address("glCopyColorTable")); - glGetColorTable=reinterpret_cast(get_proc_address("glGetColorTable")); - glGetColorTableParameterfv=reinterpret_cast(get_proc_address("glGetColorTableParameterfv")); - glGetColorTableParameteriv=reinterpret_cast(get_proc_address("glGetColorTableParameteriv")); - glColorSubTable=reinterpret_cast(get_proc_address("glColorSubTable")); - glCopyColorSubTable=reinterpret_cast(get_proc_address("glCopyColorSubTable")); - glConvolutionFilter1D=reinterpret_cast(get_proc_address("glConvolutionFilter1D")); - glConvolutionFilter2D=reinterpret_cast(get_proc_address("glConvolutionFilter2D")); - glConvolutionParameterf=reinterpret_cast(get_proc_address("glConvolutionParameterf")); - glConvolutionParameterfv=reinterpret_cast(get_proc_address("glConvolutionParameterfv")); - glConvolutionParameteri=reinterpret_cast(get_proc_address("glConvolutionParameteri")); - glConvolutionParameteriv=reinterpret_cast(get_proc_address("glConvolutionParameteriv")); - glCopyConvolutionFilter1D=reinterpret_cast(get_proc_address("glCopyConvolutionFilter1D")); - glCopyConvolutionFilter2D=reinterpret_cast(get_proc_address("glCopyConvolutionFilter2D")); - glGetConvolutionFilter=reinterpret_cast(get_proc_address("glGetConvolutionFilter")); - glGetConvolutionParameterfv=reinterpret_cast(get_proc_address("glGetConvolutionParameterfv")); - glGetConvolutionParameteriv=reinterpret_cast(get_proc_address("glGetConvolutionParameteriv")); - glGetSeparableFilter=reinterpret_cast(get_proc_address("glGetSeparableFilter")); - glSeparableFilter2D=reinterpret_cast(get_proc_address("glSeparableFilter2D")); - glGetHistogram=reinterpret_cast(get_proc_address("glGetHistogram")); - glGetHistogramParameterfv=reinterpret_cast(get_proc_address("glGetHistogramParameterfv")); - glGetHistogramParameteriv=reinterpret_cast(get_proc_address("glGetHistogramParameteriv")); - glGetMinmax=reinterpret_cast(get_proc_address("glGetMinmax")); - glGetMinmaxParameterfv=reinterpret_cast(get_proc_address("glGetMinmaxParameterfv")); - glGetMinmaxParameteriv=reinterpret_cast(get_proc_address("glGetMinmaxParameteriv")); - glHistogram=reinterpret_cast(get_proc_address("glHistogram")); - glMinmax=reinterpret_cast(get_proc_address("glMinmax")); - glResetHistogram=reinterpret_cast(get_proc_address("glResetHistogram")); - glResetMinmax=reinterpret_cast(get_proc_address("glResetMinmax")); - glTexImage3D=reinterpret_cast(get_proc_address("glTexImage3D")); - glTexSubImage3D=reinterpret_cast(get_proc_address("glTexSubImage3D")); - glCopyTexSubImage3D=reinterpret_cast(get_proc_address("glCopyTexSubImage3D")); + glBlendColor = reinterpret_cast(get_proc_address("glBlendColor")); + glBlendEquation = reinterpret_cast(get_proc_address("glBlendEquation")); + glDrawRangeElements = reinterpret_cast(get_proc_address("glDrawRangeElements")); + glColorTable = reinterpret_cast(get_proc_address("glColorTable")); + glColorTableParameterfv = reinterpret_cast(get_proc_address("glColorTableParameterfv")); + glColorTableParameteriv = reinterpret_cast(get_proc_address("glColorTableParameteriv")); + glCopyColorTable = reinterpret_cast(get_proc_address("glCopyColorTable")); + glGetColorTable = reinterpret_cast(get_proc_address("glGetColorTable")); + glGetColorTableParameterfv = reinterpret_cast(get_proc_address("glGetColorTableParameterfv")); + glGetColorTableParameteriv = reinterpret_cast(get_proc_address("glGetColorTableParameteriv")); + glColorSubTable = reinterpret_cast(get_proc_address("glColorSubTable")); + glCopyColorSubTable = reinterpret_cast(get_proc_address("glCopyColorSubTable")); + glConvolutionFilter1D = reinterpret_cast(get_proc_address("glConvolutionFilter1D")); + glConvolutionFilter2D = reinterpret_cast(get_proc_address("glConvolutionFilter2D")); + glConvolutionParameterf = reinterpret_cast(get_proc_address("glConvolutionParameterf")); + glConvolutionParameterfv = reinterpret_cast(get_proc_address("glConvolutionParameterfv")); + glConvolutionParameteri = reinterpret_cast(get_proc_address("glConvolutionParameteri")); + glConvolutionParameteriv = reinterpret_cast(get_proc_address("glConvolutionParameteriv")); + glCopyConvolutionFilter1D = reinterpret_cast(get_proc_address("glCopyConvolutionFilter1D")); + glCopyConvolutionFilter2D = reinterpret_cast(get_proc_address("glCopyConvolutionFilter2D")); + glGetConvolutionFilter = reinterpret_cast(get_proc_address("glGetConvolutionFilter")); + glGetConvolutionParameterfv = reinterpret_cast(get_proc_address("glGetConvolutionParameterfv")); + glGetConvolutionParameteriv = reinterpret_cast(get_proc_address("glGetConvolutionParameteriv")); + glGetSeparableFilter = reinterpret_cast(get_proc_address("glGetSeparableFilter")); + glSeparableFilter2D = reinterpret_cast(get_proc_address("glSeparableFilter2D")); + glGetHistogram = reinterpret_cast(get_proc_address("glGetHistogram")); + glGetHistogramParameterfv = reinterpret_cast(get_proc_address("glGetHistogramParameterfv")); + glGetHistogramParameteriv = reinterpret_cast(get_proc_address("glGetHistogramParameteriv")); + glGetMinmax = reinterpret_cast(get_proc_address("glGetMinmax")); + glGetMinmaxParameterfv = reinterpret_cast(get_proc_address("glGetMinmaxParameterfv")); + glGetMinmaxParameteriv = reinterpret_cast(get_proc_address("glGetMinmaxParameteriv")); + glHistogram = reinterpret_cast(get_proc_address("glHistogram")); + glMinmax = reinterpret_cast(get_proc_address("glMinmax")); + glResetHistogram = reinterpret_cast(get_proc_address("glResetHistogram")); + glResetMinmax = reinterpret_cast(get_proc_address("glResetMinmax")); + glTexImage3D = reinterpret_cast(get_proc_address("glTexImage3D")); + glTexSubImage3D = reinterpret_cast(get_proc_address("glTexSubImage3D")); + glCopyTexSubImage3D = reinterpret_cast(get_proc_address("glCopyTexSubImage3D")); } } // namespace GL diff --git a/source/version_1_3.cpp b/source/version_1_3.cpp index 088d5ba6..d248a083 100644 --- a/source/version_1_3.cpp +++ b/source/version_1_3.cpp @@ -4,101 +4,101 @@ namespace Msp { namespace GL { -PFNGLACTIVETEXTUREPROC glActiveTexture=0; -PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture=0; -PFNGLMULTITEXCOORD1DPROC glMultiTexCoord1d=0; -PFNGLMULTITEXCOORD1DVPROC glMultiTexCoord1dv=0; -PFNGLMULTITEXCOORD1FPROC glMultiTexCoord1f=0; -PFNGLMULTITEXCOORD1FVPROC glMultiTexCoord1fv=0; -PFNGLMULTITEXCOORD1IPROC glMultiTexCoord1i=0; -PFNGLMULTITEXCOORD1IVPROC glMultiTexCoord1iv=0; -PFNGLMULTITEXCOORD1SPROC glMultiTexCoord1s=0; -PFNGLMULTITEXCOORD1SVPROC glMultiTexCoord1sv=0; -PFNGLMULTITEXCOORD2DPROC glMultiTexCoord2d=0; -PFNGLMULTITEXCOORD2DVPROC glMultiTexCoord2dv=0; -PFNGLMULTITEXCOORD2FPROC glMultiTexCoord2f=0; -PFNGLMULTITEXCOORD2FVPROC glMultiTexCoord2fv=0; -PFNGLMULTITEXCOORD2IPROC glMultiTexCoord2i=0; -PFNGLMULTITEXCOORD2IVPROC glMultiTexCoord2iv=0; -PFNGLMULTITEXCOORD2SPROC glMultiTexCoord2s=0; -PFNGLMULTITEXCOORD2SVPROC glMultiTexCoord2sv=0; -PFNGLMULTITEXCOORD3DPROC glMultiTexCoord3d=0; -PFNGLMULTITEXCOORD3DVPROC glMultiTexCoord3dv=0; -PFNGLMULTITEXCOORD3FPROC glMultiTexCoord3f=0; -PFNGLMULTITEXCOORD3FVPROC glMultiTexCoord3fv=0; -PFNGLMULTITEXCOORD3IPROC glMultiTexCoord3i=0; -PFNGLMULTITEXCOORD3IVPROC glMultiTexCoord3iv=0; -PFNGLMULTITEXCOORD3SPROC glMultiTexCoord3s=0; -PFNGLMULTITEXCOORD3SVPROC glMultiTexCoord3sv=0; -PFNGLMULTITEXCOORD4DPROC glMultiTexCoord4d=0; -PFNGLMULTITEXCOORD4DVPROC glMultiTexCoord4dv=0; -PFNGLMULTITEXCOORD4FPROC glMultiTexCoord4f=0; -PFNGLMULTITEXCOORD4FVPROC glMultiTexCoord4fv=0; -PFNGLMULTITEXCOORD4IPROC glMultiTexCoord4i=0; -PFNGLMULTITEXCOORD4IVPROC glMultiTexCoord4iv=0; -PFNGLMULTITEXCOORD4SPROC glMultiTexCoord4s=0; -PFNGLMULTITEXCOORD4SVPROC glMultiTexCoord4sv=0; -PFNGLLOADTRANSPOSEMATRIXFPROC glLoadTransposeMatrixf=0; -PFNGLLOADTRANSPOSEMATRIXDPROC glLoadTransposeMatrixd=0; -PFNGLMULTTRANSPOSEMATRIXFPROC glMultTransposeMatrixf=0; -PFNGLMULTTRANSPOSEMATRIXDPROC glMultTransposeMatrixd=0; -PFNGLSAMPLECOVERAGEPROC glSampleCoverage=0; -PFNGLCOMPRESSEDTEXIMAGE3DPROC glCompressedTexImage3D=0; -PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D=0; -PFNGLCOMPRESSEDTEXIMAGE1DPROC glCompressedTexImage1D=0; -PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glCompressedTexSubImage3D=0; -PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2D=0; -PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glCompressedTexSubImage1D=0; -PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage=0; +PFNGLACTIVETEXTUREPROC glActiveTexture = 0; +PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture = 0; +PFNGLMULTITEXCOORD1DPROC glMultiTexCoord1d = 0; +PFNGLMULTITEXCOORD1DVPROC glMultiTexCoord1dv = 0; +PFNGLMULTITEXCOORD1FPROC glMultiTexCoord1f = 0; +PFNGLMULTITEXCOORD1FVPROC glMultiTexCoord1fv = 0; +PFNGLMULTITEXCOORD1IPROC glMultiTexCoord1i = 0; +PFNGLMULTITEXCOORD1IVPROC glMultiTexCoord1iv = 0; +PFNGLMULTITEXCOORD1SPROC glMultiTexCoord1s = 0; +PFNGLMULTITEXCOORD1SVPROC glMultiTexCoord1sv = 0; +PFNGLMULTITEXCOORD2DPROC glMultiTexCoord2d = 0; +PFNGLMULTITEXCOORD2DVPROC glMultiTexCoord2dv = 0; +PFNGLMULTITEXCOORD2FPROC glMultiTexCoord2f = 0; +PFNGLMULTITEXCOORD2FVPROC glMultiTexCoord2fv = 0; +PFNGLMULTITEXCOORD2IPROC glMultiTexCoord2i = 0; +PFNGLMULTITEXCOORD2IVPROC glMultiTexCoord2iv = 0; +PFNGLMULTITEXCOORD2SPROC glMultiTexCoord2s = 0; +PFNGLMULTITEXCOORD2SVPROC glMultiTexCoord2sv = 0; +PFNGLMULTITEXCOORD3DPROC glMultiTexCoord3d = 0; +PFNGLMULTITEXCOORD3DVPROC glMultiTexCoord3dv = 0; +PFNGLMULTITEXCOORD3FPROC glMultiTexCoord3f = 0; +PFNGLMULTITEXCOORD3FVPROC glMultiTexCoord3fv = 0; +PFNGLMULTITEXCOORD3IPROC glMultiTexCoord3i = 0; +PFNGLMULTITEXCOORD3IVPROC glMultiTexCoord3iv = 0; +PFNGLMULTITEXCOORD3SPROC glMultiTexCoord3s = 0; +PFNGLMULTITEXCOORD3SVPROC glMultiTexCoord3sv = 0; +PFNGLMULTITEXCOORD4DPROC glMultiTexCoord4d = 0; +PFNGLMULTITEXCOORD4DVPROC glMultiTexCoord4dv = 0; +PFNGLMULTITEXCOORD4FPROC glMultiTexCoord4f = 0; +PFNGLMULTITEXCOORD4FVPROC glMultiTexCoord4fv = 0; +PFNGLMULTITEXCOORD4IPROC glMultiTexCoord4i = 0; +PFNGLMULTITEXCOORD4IVPROC glMultiTexCoord4iv = 0; +PFNGLMULTITEXCOORD4SPROC glMultiTexCoord4s = 0; +PFNGLMULTITEXCOORD4SVPROC glMultiTexCoord4sv = 0; +PFNGLLOADTRANSPOSEMATRIXFPROC glLoadTransposeMatrixf = 0; +PFNGLLOADTRANSPOSEMATRIXDPROC glLoadTransposeMatrixd = 0; +PFNGLMULTTRANSPOSEMATRIXFPROC glMultTransposeMatrixf = 0; +PFNGLMULTTRANSPOSEMATRIXDPROC glMultTransposeMatrixd = 0; +PFNGLSAMPLECOVERAGEPROC glSampleCoverage = 0; +PFNGLCOMPRESSEDTEXIMAGE3DPROC glCompressedTexImage3D = 0; +PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D = 0; +PFNGLCOMPRESSEDTEXIMAGE1DPROC glCompressedTexImage1D = 0; +PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glCompressedTexSubImage3D = 0; +PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2D = 0; +PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glCompressedTexSubImage1D = 0; +PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage = 0; void init_version_1_3() { - glActiveTexture=reinterpret_cast(get_proc_address("glActiveTexture")); - glClientActiveTexture=reinterpret_cast(get_proc_address("glClientActiveTexture")); - glMultiTexCoord1d=reinterpret_cast(get_proc_address("glMultiTexCoord1d")); - glMultiTexCoord1dv=reinterpret_cast(get_proc_address("glMultiTexCoord1dv")); - glMultiTexCoord1f=reinterpret_cast(get_proc_address("glMultiTexCoord1f")); - glMultiTexCoord1fv=reinterpret_cast(get_proc_address("glMultiTexCoord1fv")); - glMultiTexCoord1i=reinterpret_cast(get_proc_address("glMultiTexCoord1i")); - glMultiTexCoord1iv=reinterpret_cast(get_proc_address("glMultiTexCoord1iv")); - glMultiTexCoord1s=reinterpret_cast(get_proc_address("glMultiTexCoord1s")); - glMultiTexCoord1sv=reinterpret_cast(get_proc_address("glMultiTexCoord1sv")); - glMultiTexCoord2d=reinterpret_cast(get_proc_address("glMultiTexCoord2d")); - glMultiTexCoord2dv=reinterpret_cast(get_proc_address("glMultiTexCoord2dv")); - glMultiTexCoord2f=reinterpret_cast(get_proc_address("glMultiTexCoord2f")); - glMultiTexCoord2fv=reinterpret_cast(get_proc_address("glMultiTexCoord2fv")); - glMultiTexCoord2i=reinterpret_cast(get_proc_address("glMultiTexCoord2i")); - glMultiTexCoord2iv=reinterpret_cast(get_proc_address("glMultiTexCoord2iv")); - glMultiTexCoord2s=reinterpret_cast(get_proc_address("glMultiTexCoord2s")); - glMultiTexCoord2sv=reinterpret_cast(get_proc_address("glMultiTexCoord2sv")); - glMultiTexCoord3d=reinterpret_cast(get_proc_address("glMultiTexCoord3d")); - glMultiTexCoord3dv=reinterpret_cast(get_proc_address("glMultiTexCoord3dv")); - glMultiTexCoord3f=reinterpret_cast(get_proc_address("glMultiTexCoord3f")); - glMultiTexCoord3fv=reinterpret_cast(get_proc_address("glMultiTexCoord3fv")); - glMultiTexCoord3i=reinterpret_cast(get_proc_address("glMultiTexCoord3i")); - glMultiTexCoord3iv=reinterpret_cast(get_proc_address("glMultiTexCoord3iv")); - glMultiTexCoord3s=reinterpret_cast(get_proc_address("glMultiTexCoord3s")); - glMultiTexCoord3sv=reinterpret_cast(get_proc_address("glMultiTexCoord3sv")); - glMultiTexCoord4d=reinterpret_cast(get_proc_address("glMultiTexCoord4d")); - glMultiTexCoord4dv=reinterpret_cast(get_proc_address("glMultiTexCoord4dv")); - glMultiTexCoord4f=reinterpret_cast(get_proc_address("glMultiTexCoord4f")); - glMultiTexCoord4fv=reinterpret_cast(get_proc_address("glMultiTexCoord4fv")); - glMultiTexCoord4i=reinterpret_cast(get_proc_address("glMultiTexCoord4i")); - glMultiTexCoord4iv=reinterpret_cast(get_proc_address("glMultiTexCoord4iv")); - glMultiTexCoord4s=reinterpret_cast(get_proc_address("glMultiTexCoord4s")); - glMultiTexCoord4sv=reinterpret_cast(get_proc_address("glMultiTexCoord4sv")); - glLoadTransposeMatrixf=reinterpret_cast(get_proc_address("glLoadTransposeMatrixf")); - glLoadTransposeMatrixd=reinterpret_cast(get_proc_address("glLoadTransposeMatrixd")); - glMultTransposeMatrixf=reinterpret_cast(get_proc_address("glMultTransposeMatrixf")); - glMultTransposeMatrixd=reinterpret_cast(get_proc_address("glMultTransposeMatrixd")); - glSampleCoverage=reinterpret_cast(get_proc_address("glSampleCoverage")); - glCompressedTexImage3D=reinterpret_cast(get_proc_address("glCompressedTexImage3D")); - glCompressedTexImage2D=reinterpret_cast(get_proc_address("glCompressedTexImage2D")); - glCompressedTexImage1D=reinterpret_cast(get_proc_address("glCompressedTexImage1D")); - glCompressedTexSubImage3D=reinterpret_cast(get_proc_address("glCompressedTexSubImage3D")); - glCompressedTexSubImage2D=reinterpret_cast(get_proc_address("glCompressedTexSubImage2D")); - glCompressedTexSubImage1D=reinterpret_cast(get_proc_address("glCompressedTexSubImage1D")); - glGetCompressedTexImage=reinterpret_cast(get_proc_address("glGetCompressedTexImage")); + glActiveTexture = reinterpret_cast(get_proc_address("glActiveTexture")); + glClientActiveTexture = reinterpret_cast(get_proc_address("glClientActiveTexture")); + glMultiTexCoord1d = reinterpret_cast(get_proc_address("glMultiTexCoord1d")); + glMultiTexCoord1dv = reinterpret_cast(get_proc_address("glMultiTexCoord1dv")); + glMultiTexCoord1f = reinterpret_cast(get_proc_address("glMultiTexCoord1f")); + glMultiTexCoord1fv = reinterpret_cast(get_proc_address("glMultiTexCoord1fv")); + glMultiTexCoord1i = reinterpret_cast(get_proc_address("glMultiTexCoord1i")); + glMultiTexCoord1iv = reinterpret_cast(get_proc_address("glMultiTexCoord1iv")); + glMultiTexCoord1s = reinterpret_cast(get_proc_address("glMultiTexCoord1s")); + glMultiTexCoord1sv = reinterpret_cast(get_proc_address("glMultiTexCoord1sv")); + glMultiTexCoord2d = reinterpret_cast(get_proc_address("glMultiTexCoord2d")); + glMultiTexCoord2dv = reinterpret_cast(get_proc_address("glMultiTexCoord2dv")); + glMultiTexCoord2f = reinterpret_cast(get_proc_address("glMultiTexCoord2f")); + glMultiTexCoord2fv = reinterpret_cast(get_proc_address("glMultiTexCoord2fv")); + glMultiTexCoord2i = reinterpret_cast(get_proc_address("glMultiTexCoord2i")); + glMultiTexCoord2iv = reinterpret_cast(get_proc_address("glMultiTexCoord2iv")); + glMultiTexCoord2s = reinterpret_cast(get_proc_address("glMultiTexCoord2s")); + glMultiTexCoord2sv = reinterpret_cast(get_proc_address("glMultiTexCoord2sv")); + glMultiTexCoord3d = reinterpret_cast(get_proc_address("glMultiTexCoord3d")); + glMultiTexCoord3dv = reinterpret_cast(get_proc_address("glMultiTexCoord3dv")); + glMultiTexCoord3f = reinterpret_cast(get_proc_address("glMultiTexCoord3f")); + glMultiTexCoord3fv = reinterpret_cast(get_proc_address("glMultiTexCoord3fv")); + glMultiTexCoord3i = reinterpret_cast(get_proc_address("glMultiTexCoord3i")); + glMultiTexCoord3iv = reinterpret_cast(get_proc_address("glMultiTexCoord3iv")); + glMultiTexCoord3s = reinterpret_cast(get_proc_address("glMultiTexCoord3s")); + glMultiTexCoord3sv = reinterpret_cast(get_proc_address("glMultiTexCoord3sv")); + glMultiTexCoord4d = reinterpret_cast(get_proc_address("glMultiTexCoord4d")); + glMultiTexCoord4dv = reinterpret_cast(get_proc_address("glMultiTexCoord4dv")); + glMultiTexCoord4f = reinterpret_cast(get_proc_address("glMultiTexCoord4f")); + glMultiTexCoord4fv = reinterpret_cast(get_proc_address("glMultiTexCoord4fv")); + glMultiTexCoord4i = reinterpret_cast(get_proc_address("glMultiTexCoord4i")); + glMultiTexCoord4iv = reinterpret_cast(get_proc_address("glMultiTexCoord4iv")); + glMultiTexCoord4s = reinterpret_cast(get_proc_address("glMultiTexCoord4s")); + glMultiTexCoord4sv = reinterpret_cast(get_proc_address("glMultiTexCoord4sv")); + glLoadTransposeMatrixf = reinterpret_cast(get_proc_address("glLoadTransposeMatrixf")); + glLoadTransposeMatrixd = reinterpret_cast(get_proc_address("glLoadTransposeMatrixd")); + glMultTransposeMatrixf = reinterpret_cast(get_proc_address("glMultTransposeMatrixf")); + glMultTransposeMatrixd = reinterpret_cast(get_proc_address("glMultTransposeMatrixd")); + glSampleCoverage = reinterpret_cast(get_proc_address("glSampleCoverage")); + glCompressedTexImage3D = reinterpret_cast(get_proc_address("glCompressedTexImage3D")); + glCompressedTexImage2D = reinterpret_cast(get_proc_address("glCompressedTexImage2D")); + glCompressedTexImage1D = reinterpret_cast(get_proc_address("glCompressedTexImage1D")); + glCompressedTexSubImage3D = reinterpret_cast(get_proc_address("glCompressedTexSubImage3D")); + glCompressedTexSubImage2D = reinterpret_cast(get_proc_address("glCompressedTexSubImage2D")); + glCompressedTexSubImage1D = reinterpret_cast(get_proc_address("glCompressedTexSubImage1D")); + glGetCompressedTexImage = reinterpret_cast(get_proc_address("glGetCompressedTexImage")); } } // namespace GL diff --git a/source/vertexarray.cpp b/source/vertexarray.cpp index c6724e13..8381d8ad 100644 --- a/source/vertexarray.cpp +++ b/source/vertexarray.cpp @@ -35,8 +35,8 @@ void VertexArray::use_vertex_buffer() if(vbuf && own_vbuf) return; - vbuf=new Buffer(ARRAY_BUFFER); - own_vbuf=true; + vbuf = new Buffer(ARRAY_BUFFER); + own_vbuf = true; update_data(); } @@ -45,8 +45,8 @@ void VertexArray::use_vertex_buffer(Buffer *b) { if(own_vbuf) delete vbuf; - vbuf=b; - own_vbuf=false; + vbuf = b; + own_vbuf = false; update_data(); } @@ -64,12 +64,12 @@ void VertexArray::clear() void VertexArray::reset(const VertexFormat &f) { clear(); - format=f; - stride=get_stride(format); + format = f; + stride = get_stride(format); - bool has_gen_attrs=false; + bool has_gen_attrs = false; for(const unsigned char *c=format.begin(); (!has_gen_attrs && c!=format.end()); ++c) - has_gen_attrs=(*c>=ATTRIB1); + has_gen_attrs = (*c>=ATTRIB1); if(has_gen_attrs) static RequireExtension _ext("GL_ARB_vertex_program"); } @@ -82,14 +82,14 @@ void VertexArray::apply() const if(vbuf) vbuf->bind(); - const float *base=vbuf?0:&data[0]; - unsigned offset=0; - unsigned found=0; - unsigned bpv=stride*sizeof(float); + const float *base = vbuf?0:&data[0]; + unsigned offset = 0; + unsigned found = 0; + unsigned bpv = stride*sizeof(float); for(const unsigned char *c=format.begin(); c!=format.end(); ++c) { - unsigned sz=(*c&3)+1; - unsigned t=*c>>2; + unsigned sz = (*c&3)+1; + unsigned t = *c>>2; switch(t) { case 0: @@ -111,8 +111,8 @@ void VertexArray::apply() const glVertexAttribPointerARB(t-4, sz, GL_FLOAT, false, bpv, base+offset); break; } - found|=1<>2; + unsigned size = (*c&3)+1; + unsigned type = *c>>2; switch(type) { case 0: - *ptr++=x; - *ptr++=y; - if(size>=3) *ptr++=z; - if(size>=4) *ptr++=w; + *ptr+ += x; + *ptr+ += y; + if(size>=3) *ptr+ += z; + if(size>=4) *ptr+ += w; break; case 1: - *ptr++=nx; - *ptr++=ny; - *ptr++=nz; + *ptr+ += nx; + *ptr+ += ny; + *ptr+ += nz; break; case 2: - *ptr++=ts; - if(size>=2) *ptr++=tt; - if(size>=3) *ptr++=tr; - if(size>=4) *ptr++=tq; + *ptr+ += ts; + if(size>=2) *ptr+ += tt; + if(size>=3) *ptr+ += tr; + if(size>=4) *ptr+ += tq; break; case 3: if(size==1) { union { unsigned char c[4]; float f; } u; - u.c[0]=static_cast(cr*255); - u.c[1]=static_cast(cg*255); - u.c[2]=static_cast(cb*255); - u.c[3]=static_cast(ca*255); - *ptr++=u.f; + u.c[0] = static_cast(cr*255); + u.c[1] = static_cast(cg*255); + u.c[2] = static_cast(cb*255); + u.c[3] = static_cast(ca*255); + *ptr+ += u.f; } else { - *ptr++=cr; - *ptr++=cg; - *ptr++=cb; - if(size>=4) *+ptr++=ca; + *ptr+ += cr; + *ptr+ += cg; + *ptr+ += cb; + if(size>=4) *+ptr+ += ca; } break; default: - const Attrib &a=av[type-4]; - *ptr++=a.x; - if(size>=2) *ptr++=a.y; - if(size>=3) *ptr++=a.z; - if(size>=4) *ptr++=a.w; + const Attrib &a = av[type-4]; + *ptr+ += a.x; + if(size>=2) *ptr+ += a.y; + if(size>=3) *ptr+ += a.z; + if(size>=4) *ptr+ += a.w; break; } } diff --git a/source/vertexbuilder.cpp b/source/vertexbuilder.cpp index d6759d7e..3d3ec79b 100644 --- a/source/vertexbuilder.cpp +++ b/source/vertexbuilder.cpp @@ -18,11 +18,11 @@ VertexBuilder::VertexBuilder(): void VertexBuilder::attrib(unsigned i, float x, float y, float z, float w) { - Attrib &a=av[i]; - a.x=x; - a.y=y; - a.z=z; - a.w=w; + Attrib &a = av[i]; + a.x = x; + a.y = y; + a.z = z; + a.w = w; } } // namespace GL diff --git a/source/vertexbuilder.h b/source/vertexbuilder.h index c92a2760..8235c7af 100644 --- a/source/vertexbuilder.h +++ b/source/vertexbuilder.h @@ -37,15 +37,15 @@ public: void vertex(float x, float y) { vertex(x, y, 0, 1); } void vertex(float x, float y, float z) { vertex(x, y, z, 1); } void vertex(float x, float y, float z, float w) { vertex_(x, y, z, w); } - void normal(float x, float y, float z) { nx=x; ny=y; nz=z; } + void normal(float x, float y, float z) { nx = x; ny = y; nz = z; } void texcoord(float s) { texcoord(s, 0, 0, 1); } void texcoord(float s, float t) { texcoord(s, t, 0, 1); } void texcoord(float s, float t, float r) { texcoord(s, t, r, 1); } - void texcoord(float s, float t, float r, float q) { ts=s; tt=t; tr=r; tq=q; } + void texcoord(float s, float t, float r, float q) { ts = s; tt = t; tr = r; tq = q; } void color(unsigned char r, unsigned char g, unsigned char b) { color(r, g, b, 255); } void color(unsigned char r, unsigned char g, unsigned char b, unsigned char a) { color(r/255.f, g/255.f, b/255.f, a/255.f); } void color(float r, float g, float b) { color(r, g, b, 1); } - void color(float r, float g, float b, float a) { cr=r; cg=g; cb=b; ca=a; } + void color(float r, float g, float b, float a) { cr = r; cg = g; cb = b; ca = a; } void attrib(unsigned i, float x) { attrib(i, x, 0, 0, 1); } void attrib(unsigned i, float x, float y) { attrib(i, x, y, 0, 1); } void attrib(unsigned i, float x, float y, float z) { attrib(i, x, y, z, 1); } diff --git a/source/vertexformat.cpp b/source/vertexformat.cpp index c26c5c3e..e56397e2 100644 --- a/source/vertexformat.cpp +++ b/source/vertexformat.cpp @@ -22,8 +22,8 @@ VertexFormat::VertexFormat(): VertexFormat::VertexFormat(VertexComponent c): data(new unsigned char[8]) { - data[0]=1; - data[1]=c; + data[0] = 1; + data[1] = c; } VertexFormat::VertexFormat(const VertexFormat &f): @@ -31,7 +31,7 @@ VertexFormat::VertexFormat(const VertexFormat &f): { if(f.data) { - data=new unsigned char[f.data[0]/8+8]; + data = new unsigned char[f.data[0]/8+8]; memcpy(data, f.data, f.data[0]+1); } } @@ -41,11 +41,11 @@ VertexFormat &VertexFormat::operator=(const VertexFormat &f) delete[] data; if(f.data) { - data=new unsigned char[f.data[0]/8+8]; + data = new unsigned char[f.data[0]/8+8]; memcpy(data, f.data, f.data[0]+1); } else - data=0; + data = 0; return *this; } @@ -57,32 +57,32 @@ VertexFormat::~VertexFormat() unsigned VertexFormat::stride() const { - unsigned s=0; + unsigned s = 0; for(const unsigned char *i=begin(); i!=end(); ++i) - s+=(*i&3)+1; + s += (*i&3)+1; return s; } VertexFormat operator,(const VertexFormat &f, VertexComponent c) { - VertexFormat r=f; + VertexFormat r = f; if(r.data) { - const unsigned char n=++r.data[0]; + const unsigned char n = ++r.data[0]; if((n&7)==7) { - unsigned char *newdt=new unsigned char[n+9]; + unsigned char *newdt = new unsigned char[n+9]; memcpy(newdt, r.data, n); delete r.data; - r.data=newdt; + r.data = newdt; } - r.data[n]=c; + r.data[n] = c; } else { - r.data=new unsigned char[8]; - r.data[0]=1; - r.data[1]=c; + r.data = new unsigned char[8]; + r.data[0] = 1; + r.data[1] = c; } return r; @@ -92,14 +92,14 @@ VertexFormat operator,(const VertexFormat &f, unsigned i) { if(!f.data) throw InvalidState("VertexFormat has no components"); - VertexFormat r=f; - unsigned char *c=r.data+r.data[0]; + VertexFormat r = f; + unsigned char *c = r.data+r.data[0]; if(*c=28) throw InvalidParameterValue("Generic attribute index out of range"); - *c+=i*4; + *c += i*4; return r; } @@ -109,58 +109,58 @@ istream &operator>>(istream &in, VertexFormat &f) string str; in>>str; - unsigned start=0; + unsigned start = 0; while(1) { - string::size_type underscore=str.find('_', start); - bool fail=false; + string::size_type underscore = str.find('_', start); + bool fail = false; if(!str.compare(start, underscore-start, "VERTEX2")) - f=(f,VERTEX2); + f = (f,VERTEX2); else if(!str.compare(start, underscore-start, "VERTEX3")) - f=(f,VERTEX3); + f = (f,VERTEX3); else if(!str.compare(start, underscore-start, "VERTEX4")) - f=(f,VERTEX4); + f = (f,VERTEX4); else if(!str.compare(start, underscore-start, "NORMAL3")) - f=(f,NORMAL3); + f = (f,NORMAL3); else if(!str.compare(start, underscore-start, "TEXCOORD1")) - f=(f,TEXCOORD1); + f = (f,TEXCOORD1); else if(!str.compare(start, underscore-start, "TEXCOORD2")) - f=(f,TEXCOORD2); + f = (f,TEXCOORD2); else if(!str.compare(start, underscore-start, "TEXCOORD3")) - f=(f,TEXCOORD3); + f = (f,TEXCOORD3); else if(!str.compare(start, underscore-start, "TEXCOORD4")) - f=(f,TEXCOORD4); + f = (f,TEXCOORD4); else if(!str.compare(start, underscore-start, "COLOR4UB")) - f=(f,COLOR4_UBYTE); + f = (f,COLOR4_UBYTE); else if(!str.compare(start, underscore-start, "COLOR3F")) - f=(f,COLOR3_FLOAT); + f = (f,COLOR3_FLOAT); else if(!str.compare(start, underscore-start, "COLOR4F")) - f=(f,COLOR4_FLOAT); + f = (f,COLOR4_FLOAT); else if(underscore>=start+8 && !str.compare(start, 6, "ATTRIB")) { try { - char n=str[start+6]; - unsigned i=lexical_cast(str.substr(start+7, underscore-start-7)); + char n = str[start+6]; + unsigned i = lexical_cast(str.substr(start+7, underscore-start-7)); if(n=='1') - f=(f,ATTRIB1,i); + f = (f,ATTRIB1,i); else if(n=='2') - f=(f,ATTRIB2,i); + f = (f,ATTRIB2,i); else if(n=='3') - f=(f,ATTRIB3,i); + f = (f,ATTRIB3,i); else if(n=='4') - f=(f,ATTRIB4,i); + f = (f,ATTRIB4,i); else - fail=true; + fail = true; } catch(const LexicalError &) { - fail=true; + fail = true; } } else - fail=true; + fail = true; if(fail) { @@ -170,7 +170,7 @@ istream &operator>>(istream &in, VertexFormat &f) if(underscore==string::npos) break; - start=underscore+1; + start = underscore+1; } return in; diff --git a/source/vertexformat.h b/source/vertexformat.h index 2164a8fb..3e36c18f 100644 --- a/source/vertexformat.h +++ b/source/vertexformat.h @@ -15,18 +15,18 @@ namespace GL { enum VertexComponent { - VERTEX2=1, + VERTEX2 = 1, VERTEX3, VERTEX4, - NORMAL3=6, - TEXCOORD1=8, + NORMAL3 = 6, + TEXCOORD1 = 8, TEXCOORD2, TEXCOORD3, TEXCOORD4, - COLOR4_UBYTE=12, - COLOR3_FLOAT=14, + COLOR4_UBYTE = 12, + COLOR3_FLOAT = 14, COLOR4_FLOAT, - ATTRIB1=16, + ATTRIB1 = 16, ATTRIB2, ATTRIB3, ATTRIB4 -- 2.45.2