# HG changeset patch # User John Tsiombikas # Date 1384740619 -7200 # Node ID 25b911c7c35c1aedcd1e670e35c83382a9e6ca3a # Parent 98f87a1dbb2f38c3d267e1e8b0f239ff6aee70a7 fixed some line endings fixed the cubemap2.jpg file in examples/cubemap/data which was resized improperly causing seams... diff -r 98f87a1dbb2f -r 25b911c7c35c Makefile --- a/Makefile Mon Nov 18 03:35:20 2013 +0200 +++ b/Makefile Mon Nov 18 04:10:19 2013 +0200 @@ -28,6 +28,8 @@ dbg = -g warn = -Wall +libs_ldflags = -limago -lanim -lpsys -lvmath + CFLAGS = -pedantic $(warn) $(dbg) $(pic) $(opt) $(inc) $(libs_cflags) CXXFLAGS = $(CFLAGS) LDFLAGS = $(libgl) $(libs_ldflags) diff -r 98f87a1dbb2f -r 25b911c7c35c examples/cubemap/data/cubemap2.jpg Binary file examples/cubemap/data/cubemap2.jpg has changed diff -r 98f87a1dbb2f -r 25b911c7c35c examples/cubemap/sdr/sky.p.glsl --- a/examples/cubemap/sdr/sky.p.glsl Mon Nov 18 03:35:20 2013 +0200 +++ b/examples/cubemap/sdr/sky.p.glsl Mon Nov 18 04:10:19 2013 +0200 @@ -1,9 +1,9 @@ -uniform samplerCube cubemap; - -varying vec3 norm; - -void main() -{ - gl_FragColor = textureCube(cubemap, norm); - //gl_FragColor = vec4(norm * 0.5 + 0.5, 1.0); -} +uniform samplerCube cubemap; + +varying vec3 norm; + +void main() +{ + gl_FragColor = textureCube(cubemap, norm); + //gl_FragColor = vec4(norm * 0.5 + 0.5, 1.0); +} diff -r 98f87a1dbb2f -r 25b911c7c35c examples/cubemap/sdr/sky.v.glsl --- a/examples/cubemap/sdr/sky.v.glsl Mon Nov 18 03:35:20 2013 +0200 +++ b/examples/cubemap/sdr/sky.v.glsl Mon Nov 18 04:10:19 2013 +0200 @@ -1,7 +1,7 @@ -varying vec3 norm; - -void main() -{ - gl_Position = ftransform(); - norm = gl_Vertex.xyz; -} +varying vec3 norm; + +void main() +{ + gl_Position = ftransform(); + norm = gl_Vertex.xyz; +} diff -r 98f87a1dbb2f -r 25b911c7c35c examples/cubemap/src/main.cc --- a/examples/cubemap/src/main.cc Mon Nov 18 03:35:20 2013 +0200 +++ b/examples/cubemap/src/main.cc Mon Nov 18 04:10:19 2013 +0200 @@ -1,155 +1,155 @@ -#include -#include -#include -#include -#include - -#define CUBEMAP_FILENAME "data/cubemap2.jpg" - -static bool init(); -static void cleanup(); -static void display(); -static void skybox(const TextureCube *cubemap = 0); -static void reshape(int x, int y); -static void keyboard(unsigned char key, int x, int y); -static void mouse(int bn, int st, int x, int y); -static void motion(int x, int y); - -static float cam_theta, cam_phi; - -static TextureCube *cubemap; -static ShaderProg *sdrsky; - -int main(int argc, char **argv) -{ - glutInit(&argc, argv); - glutInitWindowSize(800, 600); - glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); - glutCreateWindow("cubemap"); - - glutDisplayFunc(display); - glutReshapeFunc(reshape); - glutKeyboardFunc(keyboard); - glutMouseFunc(mouse); - glutMotionFunc(motion); - - if(!init()) { - return 1; - } - atexit(cleanup); - - glutMainLoop(); - return 0; -} - -static bool init() -{ - glewInit(); - - glEnable(GL_DEPTH_TEST); - //glEnable(GL_CULL_FACE); - - cubemap = new TextureCube; - if(!cubemap->load(CUBEMAP_FILENAME)) { - fatal_log("Failed to load cubemap: %s\n", CUBEMAP_FILENAME); - return false; - } - - if(!(sdrsky = get_sdrprog("sdr/sky.v.glsl", "sdr/sky.p.glsl"))) { - fatal_log("failed to load skybox shader\n"); - return false; - } - - return true; -} - -static void cleanup() -{ - delete cubemap; -} - -static void display() -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - Matrix4x4 view_matrix; - view_matrix.rotate(Vector3(1, 0, 0), M_PI * cam_phi / 180.0); - view_matrix.rotate(Vector3(0, 1, 0), M_PI * cam_theta / 180.0); - set_view_matrix(view_matrix); - - setup_gl_matrices(); - - skybox(cubemap); - - glutSwapBuffers(); - CHECKGLERR; -} - -static void skybox(const TextureCube *cubemap) -{ - static Mesh *skybox; - - if(!skybox) { - skybox = new Mesh; - gen_sphere(skybox, 10.0, 12, 6); - } - - glPushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT); - glDisable(GL_DEPTH_TEST); - glDisable(GL_CULL_FACE); - glDisable(GL_LIGHTING); - - glEnable(GL_TEXTURE_CUBE_MAP); - - if(cubemap) cubemap->bind(); - sdrsky->bind(); - - skybox->draw(); - - glUseProgram(0); - glPopAttrib(); -} - -static void reshape(int x, int y) -{ - glViewport(0, 0, x, y); - - Matrix4x4 proj; - proj.set_perspective(M_PI / 4.0, (float)x / (float)y, 0.5, 500.0); - set_projection_matrix(proj); -} - -static void keyboard(unsigned char key, int x, int y) -{ - switch(key) { - case 27: - exit(0); - } -} - -static bool bnstate[16]; -static int prev_x, prev_y; - -static void mouse(int bn, int st, int x, int y) -{ - bnstate[bn - GLUT_LEFT_BUTTON] = st == GLUT_DOWN; - prev_x = x; - prev_y = y; -} - -static void motion(int x, int y) -{ - int dx = x - prev_x; - int dy = y - prev_y; - prev_x = x; - prev_y = y; - - if(!dx && !dy) return; - - if(bnstate[0]) { - cam_theta += dx * 0.5; - cam_phi += dy * 0.5; - cam_phi = std::max(-90.0f, std::min(90.0f, cam_phi)); - glutPostRedisplay(); - } -} +#include +#include +#include +#include +#include + +#define CUBEMAP_FILENAME "data/cubemap2.jpg" + +static bool init(); +static void cleanup(); +static void display(); +static void skybox(const TextureCube *cubemap = 0); +static void reshape(int x, int y); +static void keyboard(unsigned char key, int x, int y); +static void mouse(int bn, int st, int x, int y); +static void motion(int x, int y); + +static float cam_theta, cam_phi; + +static TextureCube *cubemap; +static ShaderProg *sdrsky; + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + glutInitWindowSize(800, 600); + glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); + glutCreateWindow("cubemap"); + + glutDisplayFunc(display); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyboard); + glutMouseFunc(mouse); + glutMotionFunc(motion); + + if(!init()) { + return 1; + } + atexit(cleanup); + + glutMainLoop(); + return 0; +} + +static bool init() +{ + glewInit(); + + glEnable(GL_DEPTH_TEST); + //glEnable(GL_CULL_FACE); + + cubemap = new TextureCube; + if(!cubemap->load(CUBEMAP_FILENAME)) { + fatal_log("Failed to load cubemap: %s\n", CUBEMAP_FILENAME); + return false; + } + + if(!(sdrsky = get_sdrprog("sdr/sky.v.glsl", "sdr/sky.p.glsl"))) { + fatal_log("failed to load skybox shader\n"); + return false; + } + + return true; +} + +static void cleanup() +{ + delete cubemap; +} + +static void display() +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + Matrix4x4 view_matrix; + view_matrix.rotate(Vector3(1, 0, 0), M_PI * cam_phi / 180.0); + view_matrix.rotate(Vector3(0, 1, 0), M_PI * cam_theta / 180.0); + set_view_matrix(view_matrix); + + setup_gl_matrices(); + + skybox(cubemap); + + glutSwapBuffers(); + CHECKGLERR; +} + +static void skybox(const TextureCube *cubemap) +{ + static Mesh *skybox; + + if(!skybox) { + skybox = new Mesh; + gen_sphere(skybox, 10.0, 12, 6); + } + + glPushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT); + glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + glDisable(GL_LIGHTING); + + glEnable(GL_TEXTURE_CUBE_MAP); + + if(cubemap) cubemap->bind(); + sdrsky->bind(); + + skybox->draw(); + + glUseProgram(0); + glPopAttrib(); +} + +static void reshape(int x, int y) +{ + glViewport(0, 0, x, y); + + Matrix4x4 proj; + proj.set_perspective(M_PI / 4.0, (float)x / (float)y, 0.5, 500.0); + set_projection_matrix(proj); +} + +static void keyboard(unsigned char key, int x, int y) +{ + switch(key) { + case 27: + exit(0); + } +} + +static bool bnstate[16]; +static int prev_x, prev_y; + +static void mouse(int bn, int st, int x, int y) +{ + bnstate[bn - GLUT_LEFT_BUTTON] = st == GLUT_DOWN; + prev_x = x; + prev_y = y; +} + +static void motion(int x, int y) +{ + int dx = x - prev_x; + int dy = y - prev_y; + prev_x = x; + prev_y = y; + + if(!dx && !dy) return; + + if(bnstate[0]) { + cam_theta += dx * 0.5; + cam_phi += dy * 0.5; + cam_phi = std::max(-90.0f, std::min(90.0f, cam_phi)); + glutPostRedisplay(); + } +} diff -r 98f87a1dbb2f -r 25b911c7c35c src/3dschunks.h --- a/src/3dschunks.h Mon Nov 18 03:35:20 2013 +0200 +++ b/src/3dschunks.h Mon Nov 18 04:10:19 2013 +0200 @@ -1,160 +1,160 @@ -#ifndef _3DSCHUNKS_H_ -#define _3DSCHUNKS_H_ - -enum ChunkID { - Chunk_Color_Float3 = 0x0010, // o Floating point color - Chunk_Color_Byte3 = 0x0011, // o 24bit color - Chunk_Color_GammaByte3 = 0x0012, // o 24bit gamma corrected - Chunk_Color_GammaFloat3 = 0x0013, // o Floating point gamma corrected - Chunk_PercentInt = 0x0030, // o Percent Chunk int 0 - 100 - Chunk_PercentFloat = 0x0031, // o Percent Chunk float 0 - 1 - - Chunk_3DSMain = 0x4D4D, // + Root Chunk - Chunk_Main_3DSVersion = 0x0002, // - 3DS Version - Chunk_Main_3DEditor = 0x3D3D, // + 3D Editor Chunk - Chunk_Edit_Unit = 0x0100, // - Unit - Chunk_Edit_BGBitmap = 0x1100, // - Background Bitmap - Chunk_Edit_UseBGBitmap = 0x1101, // - Use Background Bitmap - Chunk_Edit_BGColor = 0x1200, // - Background Color - Chunk_Edit_UseBGColor = 0x1201, // - Use Background Color - Chunk_Edit_GradColor = 0x1300, // - Background Gradient - Chunk_Edit_UseGradColor = 0x1301, // - Use Gradient Color - Chunk_Edit_ShadowMapBias = 0x1400, // - Shadow map bias - Chunk_Edit_ShadowMapSize = 0x1420, // - Shadow map size - Chunk_Edit_ShadowMapSampleRange = 0x1450, // - Shadow map sample range - Chunk_Edit_RaytraceBias = 0x1460, // - Raytrace bias - Chunk_Edit_UseRaytrace = 0x1470, // - Use Raytrace - Chunk_Edit_AmbientColor = 0x2100, // - Ambient Color - Chunk_Edit_Fog = 0x2200, // + Fog - Chunk_Fog_FogColor = 0x2210, // - Fog Color - Chunk_Edit_UseFog = 0x2201, // - Use Fog - Chunk_Edit_DistanceQue = 0x2300, // + Distance que - Chunk_Dist_DimBackground = 0x2310, // - Dim Background - Chunk_Edit_UseDistanceQue = 0x2301, // - Use distance que - Chunk_Edit_LayeredFogOptions = 0x2302, // - Layered fog options - Chunk_Edit_UseLayeredFog = 0x2303, // - Use Layered Fog - Chunk_Edit_MeshVersion = 0x3D3E, // - Mesh Version - - Chunk_Edit_Object = 0x4000, // + Object - Chunk_Obj_Hidden = 0x4010, // - Hidden - Chunk_Obj_DontCastShadows = 0x4012, // - Object doesn't cast shadows - Chunk_Obj_MatteObject = 0x4013, // - Matte - Chunk_Obj_ExternalProcessOn = 0x4015, // - External Process on (?) - Chunk_Obj_DontReceiveShadows = 0x4017, // - doesn't reseive shadows - Chunk_Obj_TriMesh = 0x4100, // + TriMesh - Chunk_TriMesh_VertexList = 0x4110, // - Vertex List - Chunk_TriMesh_FaceDesc = 0x4120, // + Faces description - Chunk_Face_Material = 0x4130, // - Face Materials* - Chunk_TriMesh_TexCoords = 0x4140, // - Texture Coordinates - Chunk_TriMesh_SmoothingGroup = 0x4150, // - Smoothing group - Chunk_TriMesh_WorldTransform = 0x4160, // - Position and Orientation - Chunk_TriMesh_Color = 0x4165, // - Object color - Chunk_TriMesh_ExternalProcessName = 0x4181, // - External Process name (?) - Chunk_TriMesh_ExternalProcessParams = 0x4182, // - External Process parameters (?) - - Chunk_Obj_Light = 0x4600, // + Light - Chunk_Light_SpotLight = 0x4610, // + SpotLight - Chunk_Spot_Raytrace = 0x4627, // - Raytrace - Chunk_Spot_CastShadows = 0x4630, // - Light casts shadows - Chunk_Spot_ShadowMap = 0x4641, // - Shadow Map - Chunk_Spot_ShowCone = 0x4650, // - Show Cone - Chunk_Spot_Rectangular = 0x4651, // - Rectangular shaped spotlight - Chunk_Spot_OverShoot = 0x4652, // - Overshoot - Chunk_Spot_ProjMap = 0x4653, // - Projector Map - Chunk_Spot_Roll = 0x4656, // - Roll around dir - Chunk_Spot_RaytraceBias = 0x4658, // - Raytrace Bias - Chunk_Light_Off = 0x4620, // - Light is disabled - Chunk_Light_Attenuation = 0x4625, // - Attenuation enabled - Chunk_Light_AttenuationStart = 0x4659, // - Attenuation Start Range - Chunk_Light_AttenuationEnd = 0x465A, // - Attenuation End Range - Chunk_Light_Intensity = 0x465B, // - Light Intensity - - Chunk_Obj_Camera = 0x4700, // - Camera - Chunk_Edit_ViewSettings = 0x7001, // - View Settings - Chunk_Edit_ViewDesc2 = 0x7011, // - View Description 2 - Chunk_Edit_ViewDesc1 = 0x7012, // - View Description 1 - Chunk_Edit_MeshWindows = 0x7020, // - Mesh Windows (?) - - Chunk_Edit_Material = 0xAFFF, // + Material Block - Chunk_Mat_Name = 0xA000, // - Material Name - Chunk_Mat_AmbientColor = 0xA010, // - Ambient Color - Chunk_Mat_DiffuseColor = 0xA020, // - Diffuse Color - Chunk_Mat_SpecularColor = 0xA030, // - Specular Color - Chunk_Mat_Specular = 0xA040, // - Shininness (Specular Power) - Chunk_Mat_SpecularIntensity = 0xA041, // - Shininness Strength (specular intensity) - Chunk_Mat_Transparency = 0xA050, // - Transparency (alpha) - Chunk_Mat_TransparencyFalloff = 0xA052, // - Transparency Falloff - Chunk_Mat_ReflectionBlur = 0xA053, // - Reflection Blur - Chunk_Mat_TwoSided = 0xA081, // - Two Sided - Chunk_Mat_AddTransparency = 0xA083, // - ? - Chunk_Mat_SelfIllumination = 0xA084, // - Self Illumination (emissive) - Chunk_Mat_Wireframe = 0xA085, // - Render in wireframe - Chunk_Mat_WireframeThickness = 0xA087, // - Wire thickness - Chunk_Mat_FaceMapping = 0xA088, // - Apply maps to faces seperatly (ignore uv) - Chunk_Mat_InTranc = 0xA08A, // ? - Chunk_Mat_Soften = 0xA08C, // - Soft Shading - Chunk_Mat_WireUnits = 0xA08E, // - Wire units (?) - Chunk_Mat_RenderType = 0xA100, // - Render Type - Chunk_Mat_BumpMapPercent = 0xA252, // - Bump map intensity - Chunk_Mat_TextureMap = 0xA200, // + Texture Map - Chunk_Mat_TextureMap2 = 0xA33A, // + Texture Map 2 - Chunk_Mat_OpacityMap = 0xA210, // + Opacity Map - Chunk_Mat_BumpMap = 0xA230, // + Bump Map - Chunk_Mat_SpecularMap = 0xA33C, // + Specular Intensity map - Chunk_Mat_SpecularColorMap = 0xA204, // + Specular color (texture) map - Chunk_Mat_SelfIlluminationMap = 0xA33D, // + Self Illumination Map - Chunk_Mat_ReflectionMap = 0xA220, // + Reflection Map - Chunk_Mat_TextureMask = 0xA33E, // - Texture Mask - Chunk_Mat_Texture2Mask = 0xA340, // - Texture 2 Mask - Chunk_Mat_OpacityMask = 0xA342, // - Opacity Mask - Chunk_Mat_BumpMask = 0xA344, // - Bump Mask - Chunk_Mat_SpecularMask = 0xA346, // - Specular Mask - Chunk_Mat_SpecularColorMask = 0xA348, // - Specular color mask - Chunk_Mat_SelfIlluminationMask = 0xA34A, // - Self Illumination mask - Chunk_Mat_ReflectionMask = 0xA34C, // - Reflection mask - - // map subchunks // ----------------------- - Chunk_Map_FileName = 0xA300, // - Filename - Chunk_Map_Params = 0xA351, // - Parameters - Chunk_Map_BlurPercent = 0xA353, // - Blur ammount - Chunk_Map_VScale = 0xA354, // - Texture V Scale - Chunk_Map_UScale = 0xA356, // - Texture U Scale - Chunk_Map_UOffset = 0xA358, // - Texture U Offset - Chunk_MAP_VOffset = 0xA35A, // - Texture V Offset - Chunk_Map_RotationAngle = 0xA35C, // - Texture Rotation Angle - Chunk_Map_RGBLumAlphaTint1 = 0xA360, // - RGB Luminance Alpha Tint 1 - Chunk_Map_RGBLumAlphaTint2 = 0xA362, // - RGB Luminance Alpha Tint 2 - Chunk_Map_RGBTintR = 0xA364, // - RGB Tint R - Chunk_Map_RGBTintG = 0xA366, // - RGB Tint G - Chunk_Map_RGBTintB = 0xA368, // - RGB Tint B - // map subchunks end // ----------------------- - - Chunk_Main_Keyframer = 0xB000, // + Keyframer Chunk - Chunk_Key_AmbientInfo = 0xB001, // - Ambient animation info - Chunk_Key_MeshInfo = 0xB002, // - Mesh animation info - Chunk_Key_CameraInfo = 0xB003, // - Camera animation info - Chunk_Key_CameraTargetInfo = 0xB004, // - Camera Target animation info - Chunk_Key_OmniLightInfo = 0xB005, // - Omni Light animation info - Chunk_Key_SpotLightTargetInfo = 0xB006, // - Spotlight target animation info - Chunk_Key_SpotLightInfo = 0xB007, // - Spotlight animation info - Chunk_Key_Frames = 0xB008, // - Animation Frames - - // animation information subchunks // ----------------------- - Chunk_Info_Object = 0xB010, // - Object information - Chunk_Info_ObjectPivot = 0xB013, // - Object Pivot - Chunk_Info_ObjectMorphAngle = 0xB015, // - Object Morph Angle - Chunk_Info_PositionTrack = 0xB020, // - Position Track - Chunk_Info_RotationTrack = 0xB021, // - Rotation Track - Chunk_Info_ScaleTrack = 0xB022, // - Scaling Track - Chunk_Info_FOVTrack = 0xB023, // - FOV Track - Chunk_Info_RollTrack = 0xB024, // - Roll Track - Chunk_Info_ColorTrack = 0xB025, // - Color Track - Chunk_Info_MorphTrack = 0xB026, // - Morph Track - Chunk_Info_HotSpotTrack = 0xB027, // - HotSpot Track - Chunk_Info_FalloffTrack = 0xB028, // - Falloff Track - Chunk_Info_HideTrack = 0xB029, // - Hide Track - Chunk_Info_HierarchyPosition = 0xB030 // - Hierarchy Position -}; - -#endif // _3DSCHUNKS_H_ - +#ifndef _3DSCHUNKS_H_ +#define _3DSCHUNKS_H_ + +enum ChunkID { + Chunk_Color_Float3 = 0x0010, // o Floating point color + Chunk_Color_Byte3 = 0x0011, // o 24bit color + Chunk_Color_GammaByte3 = 0x0012, // o 24bit gamma corrected + Chunk_Color_GammaFloat3 = 0x0013, // o Floating point gamma corrected + Chunk_PercentInt = 0x0030, // o Percent Chunk int 0 - 100 + Chunk_PercentFloat = 0x0031, // o Percent Chunk float 0 - 1 + + Chunk_3DSMain = 0x4D4D, // + Root Chunk + Chunk_Main_3DSVersion = 0x0002, // - 3DS Version + Chunk_Main_3DEditor = 0x3D3D, // + 3D Editor Chunk + Chunk_Edit_Unit = 0x0100, // - Unit + Chunk_Edit_BGBitmap = 0x1100, // - Background Bitmap + Chunk_Edit_UseBGBitmap = 0x1101, // - Use Background Bitmap + Chunk_Edit_BGColor = 0x1200, // - Background Color + Chunk_Edit_UseBGColor = 0x1201, // - Use Background Color + Chunk_Edit_GradColor = 0x1300, // - Background Gradient + Chunk_Edit_UseGradColor = 0x1301, // - Use Gradient Color + Chunk_Edit_ShadowMapBias = 0x1400, // - Shadow map bias + Chunk_Edit_ShadowMapSize = 0x1420, // - Shadow map size + Chunk_Edit_ShadowMapSampleRange = 0x1450, // - Shadow map sample range + Chunk_Edit_RaytraceBias = 0x1460, // - Raytrace bias + Chunk_Edit_UseRaytrace = 0x1470, // - Use Raytrace + Chunk_Edit_AmbientColor = 0x2100, // - Ambient Color + Chunk_Edit_Fog = 0x2200, // + Fog + Chunk_Fog_FogColor = 0x2210, // - Fog Color + Chunk_Edit_UseFog = 0x2201, // - Use Fog + Chunk_Edit_DistanceQue = 0x2300, // + Distance que + Chunk_Dist_DimBackground = 0x2310, // - Dim Background + Chunk_Edit_UseDistanceQue = 0x2301, // - Use distance que + Chunk_Edit_LayeredFogOptions = 0x2302, // - Layered fog options + Chunk_Edit_UseLayeredFog = 0x2303, // - Use Layered Fog + Chunk_Edit_MeshVersion = 0x3D3E, // - Mesh Version + + Chunk_Edit_Object = 0x4000, // + Object + Chunk_Obj_Hidden = 0x4010, // - Hidden + Chunk_Obj_DontCastShadows = 0x4012, // - Object doesn't cast shadows + Chunk_Obj_MatteObject = 0x4013, // - Matte + Chunk_Obj_ExternalProcessOn = 0x4015, // - External Process on (?) + Chunk_Obj_DontReceiveShadows = 0x4017, // - doesn't reseive shadows + Chunk_Obj_TriMesh = 0x4100, // + TriMesh + Chunk_TriMesh_VertexList = 0x4110, // - Vertex List + Chunk_TriMesh_FaceDesc = 0x4120, // + Faces description + Chunk_Face_Material = 0x4130, // - Face Materials* + Chunk_TriMesh_TexCoords = 0x4140, // - Texture Coordinates + Chunk_TriMesh_SmoothingGroup = 0x4150, // - Smoothing group + Chunk_TriMesh_WorldTransform = 0x4160, // - Position and Orientation + Chunk_TriMesh_Color = 0x4165, // - Object color + Chunk_TriMesh_ExternalProcessName = 0x4181, // - External Process name (?) + Chunk_TriMesh_ExternalProcessParams = 0x4182, // - External Process parameters (?) + + Chunk_Obj_Light = 0x4600, // + Light + Chunk_Light_SpotLight = 0x4610, // + SpotLight + Chunk_Spot_Raytrace = 0x4627, // - Raytrace + Chunk_Spot_CastShadows = 0x4630, // - Light casts shadows + Chunk_Spot_ShadowMap = 0x4641, // - Shadow Map + Chunk_Spot_ShowCone = 0x4650, // - Show Cone + Chunk_Spot_Rectangular = 0x4651, // - Rectangular shaped spotlight + Chunk_Spot_OverShoot = 0x4652, // - Overshoot + Chunk_Spot_ProjMap = 0x4653, // - Projector Map + Chunk_Spot_Roll = 0x4656, // - Roll around dir + Chunk_Spot_RaytraceBias = 0x4658, // - Raytrace Bias + Chunk_Light_Off = 0x4620, // - Light is disabled + Chunk_Light_Attenuation = 0x4625, // - Attenuation enabled + Chunk_Light_AttenuationStart = 0x4659, // - Attenuation Start Range + Chunk_Light_AttenuationEnd = 0x465A, // - Attenuation End Range + Chunk_Light_Intensity = 0x465B, // - Light Intensity + + Chunk_Obj_Camera = 0x4700, // - Camera + Chunk_Edit_ViewSettings = 0x7001, // - View Settings + Chunk_Edit_ViewDesc2 = 0x7011, // - View Description 2 + Chunk_Edit_ViewDesc1 = 0x7012, // - View Description 1 + Chunk_Edit_MeshWindows = 0x7020, // - Mesh Windows (?) + + Chunk_Edit_Material = 0xAFFF, // + Material Block + Chunk_Mat_Name = 0xA000, // - Material Name + Chunk_Mat_AmbientColor = 0xA010, // - Ambient Color + Chunk_Mat_DiffuseColor = 0xA020, // - Diffuse Color + Chunk_Mat_SpecularColor = 0xA030, // - Specular Color + Chunk_Mat_Specular = 0xA040, // - Shininness (Specular Power) + Chunk_Mat_SpecularIntensity = 0xA041, // - Shininness Strength (specular intensity) + Chunk_Mat_Transparency = 0xA050, // - Transparency (alpha) + Chunk_Mat_TransparencyFalloff = 0xA052, // - Transparency Falloff + Chunk_Mat_ReflectionBlur = 0xA053, // - Reflection Blur + Chunk_Mat_TwoSided = 0xA081, // - Two Sided + Chunk_Mat_AddTransparency = 0xA083, // - ? + Chunk_Mat_SelfIllumination = 0xA084, // - Self Illumination (emissive) + Chunk_Mat_Wireframe = 0xA085, // - Render in wireframe + Chunk_Mat_WireframeThickness = 0xA087, // - Wire thickness + Chunk_Mat_FaceMapping = 0xA088, // - Apply maps to faces seperatly (ignore uv) + Chunk_Mat_InTranc = 0xA08A, // ? + Chunk_Mat_Soften = 0xA08C, // - Soft Shading + Chunk_Mat_WireUnits = 0xA08E, // - Wire units (?) + Chunk_Mat_RenderType = 0xA100, // - Render Type + Chunk_Mat_BumpMapPercent = 0xA252, // - Bump map intensity + Chunk_Mat_TextureMap = 0xA200, // + Texture Map + Chunk_Mat_TextureMap2 = 0xA33A, // + Texture Map 2 + Chunk_Mat_OpacityMap = 0xA210, // + Opacity Map + Chunk_Mat_BumpMap = 0xA230, // + Bump Map + Chunk_Mat_SpecularMap = 0xA33C, // + Specular Intensity map + Chunk_Mat_SpecularColorMap = 0xA204, // + Specular color (texture) map + Chunk_Mat_SelfIlluminationMap = 0xA33D, // + Self Illumination Map + Chunk_Mat_ReflectionMap = 0xA220, // + Reflection Map + Chunk_Mat_TextureMask = 0xA33E, // - Texture Mask + Chunk_Mat_Texture2Mask = 0xA340, // - Texture 2 Mask + Chunk_Mat_OpacityMask = 0xA342, // - Opacity Mask + Chunk_Mat_BumpMask = 0xA344, // - Bump Mask + Chunk_Mat_SpecularMask = 0xA346, // - Specular Mask + Chunk_Mat_SpecularColorMask = 0xA348, // - Specular color mask + Chunk_Mat_SelfIlluminationMask = 0xA34A, // - Self Illumination mask + Chunk_Mat_ReflectionMask = 0xA34C, // - Reflection mask + + // map subchunks // ----------------------- + Chunk_Map_FileName = 0xA300, // - Filename + Chunk_Map_Params = 0xA351, // - Parameters + Chunk_Map_BlurPercent = 0xA353, // - Blur ammount + Chunk_Map_VScale = 0xA354, // - Texture V Scale + Chunk_Map_UScale = 0xA356, // - Texture U Scale + Chunk_Map_UOffset = 0xA358, // - Texture U Offset + Chunk_MAP_VOffset = 0xA35A, // - Texture V Offset + Chunk_Map_RotationAngle = 0xA35C, // - Texture Rotation Angle + Chunk_Map_RGBLumAlphaTint1 = 0xA360, // - RGB Luminance Alpha Tint 1 + Chunk_Map_RGBLumAlphaTint2 = 0xA362, // - RGB Luminance Alpha Tint 2 + Chunk_Map_RGBTintR = 0xA364, // - RGB Tint R + Chunk_Map_RGBTintG = 0xA366, // - RGB Tint G + Chunk_Map_RGBTintB = 0xA368, // - RGB Tint B + // map subchunks end // ----------------------- + + Chunk_Main_Keyframer = 0xB000, // + Keyframer Chunk + Chunk_Key_AmbientInfo = 0xB001, // - Ambient animation info + Chunk_Key_MeshInfo = 0xB002, // - Mesh animation info + Chunk_Key_CameraInfo = 0xB003, // - Camera animation info + Chunk_Key_CameraTargetInfo = 0xB004, // - Camera Target animation info + Chunk_Key_OmniLightInfo = 0xB005, // - Omni Light animation info + Chunk_Key_SpotLightTargetInfo = 0xB006, // - Spotlight target animation info + Chunk_Key_SpotLightInfo = 0xB007, // - Spotlight animation info + Chunk_Key_Frames = 0xB008, // - Animation Frames + + // animation information subchunks // ----------------------- + Chunk_Info_Object = 0xB010, // - Object information + Chunk_Info_ObjectPivot = 0xB013, // - Object Pivot + Chunk_Info_ObjectMorphAngle = 0xB015, // - Object Morph Angle + Chunk_Info_PositionTrack = 0xB020, // - Position Track + Chunk_Info_RotationTrack = 0xB021, // - Rotation Track + Chunk_Info_ScaleTrack = 0xB022, // - Scaling Track + Chunk_Info_FOVTrack = 0xB023, // - FOV Track + Chunk_Info_RollTrack = 0xB024, // - Roll Track + Chunk_Info_ColorTrack = 0xB025, // - Color Track + Chunk_Info_MorphTrack = 0xB026, // - Morph Track + Chunk_Info_HotSpotTrack = 0xB027, // - HotSpot Track + Chunk_Info_FalloffTrack = 0xB028, // - Falloff Track + Chunk_Info_HideTrack = 0xB029, // - Hide Track + Chunk_Info_HierarchyPosition = 0xB030 // - Hierarchy Position +}; + +#endif // _3DSCHUNKS_H_ + diff -r 98f87a1dbb2f -r 25b911c7c35c src/texture.cc --- a/src/texture.cc Mon Nov 18 03:35:20 2013 +0200 +++ b/src/texture.cc Mon Nov 18 04:10:19 2013 +0200 @@ -1,3 +1,4 @@ +#include #include "texture.h" #include "image.h" #include "opengl.h" @@ -249,6 +250,7 @@ glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); for(int i=0; i<6; i++) { glTexImage2D(cube_faces[i], 0, ifmt, xsz, ysz, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); @@ -269,6 +271,7 @@ glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); glTexImage2D(cube_faces[idx], 0, texfmt, sz[0], sz[1], 0, fmt, type, img.get_pixels()); }