├── .gitignore ├── .travis.yml ├── CMakeLists.txt ├── LICENSE ├── README.md ├── cmake ├── FindGLEW.cmake ├── FindRapidJSON.cmake └── ThreeTargets.cmake ├── data ├── fonts │ └── consolas.ttf ├── textures │ ├── 2294472375_24a3b8ef46_o.jpg │ ├── 758px-Canestra_di_frutta_(Caravaggio).jpg │ ├── ash_uvgrid01.jpg │ ├── ash_uvgrid01.nfo │ ├── compressed │ │ ├── disturb_dxt1_mip.dds │ │ ├── disturb_dxt1_nomip.dds │ │ ├── explosion_dxt5_mip.dds │ │ └── hepatica_dxt3_mip.dds │ ├── crate.gif │ ├── cube │ │ ├── Bridge2 │ │ │ ├── negx.jpg │ │ │ ├── negy.jpg │ │ │ ├── negz.jpg │ │ │ ├── posx.jpg │ │ │ ├── posy.jpg │ │ │ ├── posz.jpg │ │ │ └── readme.txt │ │ ├── Escher │ │ │ ├── dds │ │ │ │ ├── nx.dds │ │ │ │ ├── ny.dds │ │ │ │ ├── nz.dds │ │ │ │ ├── px.dds │ │ │ │ ├── py.dds │ │ │ │ └── pz.dds │ │ │ ├── nx.jpg │ │ │ ├── ny.jpg │ │ │ ├── nz.jpg │ │ │ ├── px.jpg │ │ │ ├── py.jpg │ │ │ └── pz.jpg │ │ ├── Park2 │ │ │ ├── negx.jpg │ │ │ ├── negy.jpg │ │ │ ├── negz.jpg │ │ │ ├── posx.jpg │ │ │ ├── posy.jpg │ │ │ ├── posz.jpg │ │ │ └── readme.txt │ │ ├── Park3Med │ │ │ ├── nx.jpg │ │ │ ├── ny.jpg │ │ │ ├── nz.jpg │ │ │ ├── px.jpg │ │ │ ├── py.jpg │ │ │ ├── pz.jpg │ │ │ └── readme.txt │ │ ├── SwedishRoyalCastle │ │ │ ├── nx.jpg │ │ │ ├── ny.jpg │ │ │ ├── nz.jpg │ │ │ ├── px.jpg │ │ │ ├── py.jpg │ │ │ ├── pz.jpg │ │ │ └── readme.txt │ │ ├── pisa │ │ │ ├── nx.png │ │ │ ├── ny.png │ │ │ ├── nz.png │ │ │ ├── px.png │ │ │ ├── py.png │ │ │ └── pz.png │ │ └── skybox │ │ │ ├── nx.jpg │ │ │ ├── ny.jpg │ │ │ ├── nz.jpg │ │ │ ├── px.jpg │ │ │ ├── py.jpg │ │ │ └── pz.jpg │ ├── disturb.jpg │ ├── envmap.png │ ├── kinect.nfo │ ├── kinect.webm │ ├── land_ocean_ice_cloud_2048.jpg │ ├── lava │ │ ├── cloud.png │ │ └── lavatile.jpg │ ├── lensflare │ │ ├── LICENSE.txt │ │ ├── hexangle.png │ │ ├── lensflare0.png │ │ ├── lensflare0_alpha.png │ │ ├── lensflare1.png │ │ ├── lensflare2.png │ │ └── lensflare3.png │ ├── lensflare0.png │ ├── lensflare1.png │ ├── lensflare2.jpg │ ├── memorial.png │ ├── metal.jpg │ ├── minecraft │ │ ├── dirt.png │ │ ├── grass.png │ │ ├── grass_dirt.png │ │ └── painterlypack.txt │ ├── normal │ │ └── ninja │ │ │ ├── ao.jpg │ │ │ ├── displacement.jpg │ │ │ ├── displacement.txt │ │ │ └── normal.jpg │ ├── patterns │ │ ├── bright_squares256.png │ │ ├── circuit_pattern.png │ │ └── readme.txt │ ├── planets │ │ ├── earth_atmos_2048.jpg │ │ ├── earth_clouds_1024.png │ │ ├── earth_normal_2048.jpg │ │ ├── earth_specular_2048.jpg │ │ └── moon_1024.jpg │ ├── sintel.mp4 │ ├── sintel.ogv │ ├── sprite0.jpg │ ├── sprite0.png │ ├── sprite1.jpg │ ├── sprite1.png │ ├── sprite2.png │ ├── sprites │ │ ├── ball.png │ │ ├── circle.png │ │ ├── disc.png │ │ ├── snowflake1.png │ │ ├── snowflake2.png │ │ ├── snowflake3.png │ │ ├── snowflake4.png │ │ ├── snowflake5.png │ │ ├── snowflake7_alpha.png │ │ └── spark1.png │ ├── square-outline-textured.png │ ├── square-outline.png │ ├── terrain │ │ ├── backgrounddetailed6.jpg │ │ ├── grasslight-big-nm.jpg │ │ ├── grasslight-big.jpg │ │ └── readme.txt │ └── water.jpg └── thumbs │ ├── webgl_custom_attributes_particles.png │ ├── webgl_custom_attributes_particles2.png │ ├── webgl_custom_attributes_particles3.png │ ├── webgl_geometry_hierarchy.png │ ├── webgl_geometry_hierarchy2.png │ ├── webgl_geometry_minecraft.png │ ├── webgl_lines_colors.png │ ├── webgl_lines_cubes.png │ ├── webgl_lines_sphere.png │ ├── webgl_particles_billboards.png │ ├── webgl_particles_billboards_colors.png │ ├── webgl_particles_random.png │ ├── webgl_particles_sprites.png │ ├── webgl_shader.png │ ├── webgl_shader2.png │ ├── webgl_shader_lava.png │ └── webgl_test_memory.png ├── examples ├── .gitignore ├── CMakeLists.txt ├── common.hpp ├── custom_attributes_particles.cpp ├── custom_attributes_particles2.cpp ├── custom_attributes_particles3.cpp ├── geometry_hierarchy.cpp ├── geometry_hierarchy2.cpp ├── geometry_minecraft.cpp ├── lines_colors.cpp ├── lines_cubes.cpp ├── lines_sphere.cpp ├── particles_billboards.cpp ├── particles_billboards_colors.cpp ├── particles_random.cpp ├── particles_sprites.cpp ├── performance_static.bak ├── shader.cpp ├── shader2.cpp ├── shader_fireball.cpp ├── shader_lava.cpp ├── simple.cpp ├── test_memory.cpp └── trails.cpp ├── externals ├── glew-1.9.0 │ ├── CMakeLists.txt │ ├── include │ │ └── GL │ │ │ ├── glew.h │ │ │ ├── glxew.h │ │ │ └── wglew.h │ └── src │ │ └── glew.c ├── rapidjson │ ├── include │ │ └── rapidjson │ │ │ ├── allocators.h │ │ │ ├── document.h │ │ │ ├── encodedstream.h │ │ │ ├── encodings.h │ │ │ ├── filereadstream.h │ │ │ ├── filestream.h │ │ │ ├── filewritestream.h │ │ │ ├── internal │ │ │ ├── pow10.h │ │ │ ├── stack.h │ │ │ └── strfunc.h │ │ │ ├── prettywriter.h │ │ │ ├── rapidjson.h │ │ │ ├── reader.h │ │ │ ├── stringbuffer.h │ │ │ └── writer.h │ ├── license.txt │ └── readme.txt └── sdl-1.2.15 │ ├── mingw │ ├── bin │ │ └── SDL.dll │ ├── include │ │ └── SDL │ │ │ ├── SDL.h │ │ │ ├── SDL_active.h │ │ │ ├── SDL_audio.h │ │ │ ├── SDL_byteorder.h │ │ │ ├── SDL_cdrom.h │ │ │ ├── SDL_config.h │ │ │ ├── SDL_config_win32.h │ │ │ ├── SDL_copying.h │ │ │ ├── SDL_cpuinfo.h │ │ │ ├── SDL_endian.h │ │ │ ├── SDL_error.h │ │ │ ├── SDL_events.h │ │ │ ├── SDL_getenv.h │ │ │ ├── SDL_image.h │ │ │ ├── SDL_joystick.h │ │ │ ├── SDL_keyboard.h │ │ │ ├── SDL_keysym.h │ │ │ ├── SDL_loadso.h │ │ │ ├── SDL_main.h │ │ │ ├── SDL_mouse.h │ │ │ ├── SDL_mutex.h │ │ │ ├── SDL_name.h │ │ │ ├── SDL_opengl.h │ │ │ ├── SDL_platform.h │ │ │ ├── SDL_quit.h │ │ │ ├── SDL_rwops.h │ │ │ ├── SDL_stdinc.h │ │ │ ├── SDL_syswm.h │ │ │ ├── SDL_thread.h │ │ │ ├── SDL_timer.h │ │ │ ├── SDL_ttf.h │ │ │ ├── SDL_types.h │ │ │ ├── SDL_version.h │ │ │ ├── SDL_video.h │ │ │ ├── begin_code.h │ │ │ └── close_code.h │ ├── lib │ │ ├── ._libSDL.dll.a │ │ ├── ._libSDL.la │ │ ├── ._libSDLmain.a │ │ ├── SDL.dll │ │ ├── SDL_image.dll │ │ ├── SDL_image.lib │ │ ├── SDL_ttf.dll │ │ ├── SDL_ttf.lib │ │ ├── libSDL.dll.a │ │ ├── libSDL.la │ │ ├── libSDLmain.a │ │ ├── libfreetype-6.dll │ │ ├── libjpeg-8.dll │ │ ├── libpng15-15.dll │ │ ├── libtiff-5.dll │ │ ├── libwebp-2.dll │ │ └── zlib1.dll │ └── lib64 │ │ ├── SDL.dll │ │ ├── libSDL.a │ │ ├── libSDL.dll.a │ │ ├── libSDL.la │ │ └── libSDLmain.a │ ├── msvc │ ├── include │ │ ├── SDL.h │ │ ├── SDL_active.h │ │ ├── SDL_audio.h │ │ ├── SDL_byteorder.h │ │ ├── SDL_cdrom.h │ │ ├── SDL_config.h │ │ ├── SDL_config_dreamcast.h │ │ ├── SDL_config_macos.h │ │ ├── SDL_config_macosx.h │ │ ├── SDL_config_minimal.h │ │ ├── SDL_config_nds.h │ │ ├── SDL_config_os2.h │ │ ├── SDL_config_symbian.h │ │ ├── SDL_config_win32.h │ │ ├── SDL_copying.h │ │ ├── SDL_cpuinfo.h │ │ ├── SDL_endian.h │ │ ├── SDL_error.h │ │ ├── SDL_events.h │ │ ├── SDL_getenv.h │ │ ├── SDL_image.h │ │ ├── SDL_joystick.h │ │ ├── SDL_keyboard.h │ │ ├── SDL_keysym.h │ │ ├── SDL_loadso.h │ │ ├── SDL_main.h │ │ ├── SDL_mouse.h │ │ ├── SDL_mutex.h │ │ ├── SDL_name.h │ │ ├── SDL_opengl.h │ │ ├── SDL_platform.h │ │ ├── SDL_quit.h │ │ ├── SDL_rwops.h │ │ ├── SDL_stdinc.h │ │ ├── SDL_syswm.h │ │ ├── SDL_thread.h │ │ ├── SDL_timer.h │ │ ├── SDL_ttf.h │ │ ├── SDL_types.h │ │ ├── SDL_version.h │ │ ├── SDL_video.h │ │ ├── begin_code.h │ │ └── close_code.h │ ├── lib │ │ ├── SDL.dll │ │ ├── SDL.lib │ │ ├── SDL_image.lib │ │ ├── SDL_ttf.dll │ │ ├── SDL_ttf.lib │ │ ├── SDLmain.lib │ │ ├── libfreetype-6.dll │ │ └── zlib1.dll │ └── lib64 │ │ ├── SDL.dll │ │ ├── SDL.lib │ │ ├── SDL_image.dll │ │ ├── SDL_image.lib │ │ ├── SDL_ttf.dll │ │ ├── SDL_ttf.lib │ │ ├── SDLmain.lib │ │ ├── libfreetype-6.dll │ │ ├── libjpeg-8.dll │ │ ├── libpng15-15.dll │ │ ├── libtiff-5.dll │ │ ├── libwebp-2.dll │ │ └── zlib1.dll │ └── xcode │ ├── SDLMain.h │ └── SDLMain.m └── three ├── cameras ├── camera.hpp ├── orthographic_camera.hpp └── perspective_camera.hpp ├── common.hpp ├── config.hpp ├── console.hpp ├── constants.hpp ├── core ├── bone.hpp ├── buffer_geometry.hpp ├── clock.hpp ├── color.hpp ├── event_target.hpp ├── face.hpp ├── face3.hpp ├── face4.hpp ├── frustum.hpp ├── geometry.hpp ├── geometry_buffer.hpp ├── geometry_group.hpp ├── impl │ ├── buffer_geometry.ipp │ ├── frustum.ipp │ ├── geometry.ipp │ ├── matrix3.ipp │ ├── matrix4.ipp │ ├── object3d.ipp │ ├── projector.ipp │ └── quaternion.ipp ├── interfaces.hpp ├── math.hpp ├── matrix3.hpp ├── matrix4.hpp ├── object3d.hpp ├── projector.hpp ├── quaternion.hpp ├── ray.hpp ├── rectangle.hpp ├── spline.hpp ├── uv.hpp ├── vector2.hpp ├── vector3.hpp ├── vector4.hpp └── vertex.hpp ├── extras.hpp ├── extras ├── anim.hpp ├── events.hpp ├── geometries │ ├── cube_geometry.hpp │ ├── impl │ │ └── text_2d_geometry.ipp │ ├── plane_geometry.hpp │ ├── sphere_geometry.hpp │ ├── text_2d_geometry.hpp │ └── torus_geometry.hpp ├── geometry_utils.hpp ├── glew.hpp ├── image_utils.hpp ├── impl │ ├── anim.ipp │ ├── image_utils.ipp │ ├── sdl.ipp │ └── stats.ipp ├── renderers │ └── plugins │ │ └── shadow_map_plugin.hpp ├── scene_utils.hpp ├── sdl.hpp ├── stats.hpp └── utils │ ├── font.hpp │ ├── impl │ ├── font.ipp │ ├── stb_image.h │ └── stb_truetype.h │ └── improved_noise.hpp ├── fwd.hpp ├── gl.hpp ├── impl ├── src.cpp ├── src.hpp ├── src_extras.cpp └── src_extras.hpp ├── lights ├── ambient_light.hpp ├── directional_light.hpp ├── hemisphere_light.hpp ├── light.hpp ├── point_light.hpp └── spot_light.hpp ├── loaders ├── binary_loader.hpp ├── geometry_loader.hpp ├── image_loader.hpp ├── json_loader.hpp ├── loader.hpp ├── loader_monitor.hpp ├── scene_loader.hpp └── texture_loader.hpp ├── materials ├── attribute.hpp ├── impl │ ├── material.ipp │ ├── text_2d_material.ipp │ └── uniform.ipp ├── line_basic_material.hpp ├── material.hpp ├── mesh_basic_material.hpp ├── mesh_depth_material.hpp ├── mesh_face_material.hpp ├── mesh_lambert_material.hpp ├── mesh_normal_material.hpp ├── mesh_phong_material.hpp ├── particle_basic_material.hpp ├── program.hpp ├── shader_material.hpp ├── text_2d_material.hpp └── uniform.hpp ├── objects ├── bone.hpp ├── impl │ └── mesh.ipp ├── line.hpp ├── mesh.hpp ├── particle.hpp ├── particle_system.hpp └── skinned_mesh.hpp ├── renderers ├── gl_render_target.hpp ├── gl_render_target_buffer.hpp ├── gl_renderer.hpp ├── gl_shaders.hpp ├── impl │ ├── gl_renderer.ipp │ └── gl_shaders.ipp ├── renderables │ ├── renderable.hpp │ ├── renderable_face.hpp │ ├── renderable_face3.hpp │ ├── renderable_face4.hpp │ ├── renderable_line.hpp │ ├── renderable_object.hpp │ ├── renderable_particle.hpp │ └── renderable_vertex.hpp └── renderer_parameters.hpp ├── scenes ├── fog.hpp ├── fog_exp2.hpp ├── impl │ └── scene.ipp └── scene.hpp ├── textures ├── texture.hpp └── texture_buffer.hpp ├── three.hpp ├── utils ├── any.hpp ├── conversion.hpp ├── hash.hpp ├── index.hpp ├── memory.hpp ├── noncopyable.hpp ├── properties.hpp └── template.hpp └── visitor.hpp /.gitignore: -------------------------------------------------------------------------------- 1 | *.sublime-workspace 2 | *.sublime-project 3 | bin/ 4 | build/ 5 | lib/ 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: 2 | - cpp 3 | 4 | compiler: 5 | - gcc 6 | 7 | before_install: 8 | - sudo apt-get -qq update 9 | 10 | install: 11 | - sudo apt-get -qq install libglew-dev libsdl1.2-dev 12 | 13 | script: 14 | - mkdir build 15 | - cd build 16 | - cmake .. 17 | - make -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010-2012 three.cpp authors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /cmake/FindGLEW.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find GLEW library and include path. 3 | # Once done this will define 4 | # 5 | # GLEW_FOUND 6 | # GLEW_INCLUDE_DIR 7 | # GLEW_LIBRARY 8 | # 9 | 10 | IF (WIN32) 11 | FIND_PATH(GLEW_INCLUDE_DIR GL/glew.h 12 | $ENV{PROGRAMFILES}/GLEW/include 13 | ${COMPILER_PATH}/PlatformSDK/Include 14 | $ENV{GLEW_ROOT_DIR}/include 15 | ${GLEW_ROOT_DIR}/include 16 | DOC "The directory where GL/glew.h resides") 17 | 18 | FIND_LIBRARY( GLEW_LIBRARY 19 | NAMES glew GLEW glew32 glew32s glew64 20 | PATHS 21 | $ENV{PROGRAMFILES}/GLEW/lib 22 | $ENV{GLEWROOT}/lib 23 | $ENV{GLEW_ROOT}/lib 24 | $ENV{GLEW_DIR}/lib 25 | $ENV{GLEW_ROOT_DIR}/lib 26 | ${GLEW_ROOT_DIR}/lib 27 | DOC "The GLEW library") 28 | ELSE (WIN32) 29 | FIND_PATH(GLEW_INCLUDE_DIR GL/glew.h 30 | /usr/include 31 | /usr/local/include 32 | /sw/include 33 | /opt/local/include 34 | ${GLEW_ROOT_DIR}/include 35 | DOC "The directory where GL/glew.h resides") 36 | 37 | # Prefer the static library. 38 | FIND_LIBRARY(GLEW_LIBRARY 39 | NAMES libGLEW.a glew64 GLEW glew glew32 40 | PATHS 41 | /usr/lib64 42 | /usr/lib 43 | /usr/local/lib64 44 | /usr/local/lib 45 | /sw/lib 46 | /opt/local/lib 47 | ${GLEW_ROOT_DIR}/lib 48 | DOC "The GLEW library") 49 | ENDIF (WIN32) 50 | 51 | GET_FILENAME_COMPONENT(GLEW_LIBRARY_DIR ${GLEW_LIBRARY} PATH) 52 | 53 | INCLUDE(FindPackageHandleStandardArgs) 54 | # handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if 55 | # all listed variables are TRUE 56 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW DEFAULT_MSG GLEW_LIBRARY GLEW_INCLUDE_DIR) 57 | -------------------------------------------------------------------------------- /cmake/FindRapidJSON.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find RapidJSON library and include path. 3 | # Once done this will define 4 | # 5 | # RAPID_JSON_FOUND 6 | # RAPID_JSON_INCLUDE_DIR 7 | # 8 | 9 | FIND_PATH(RAPID_JSON_INCLUDE_DIR rapidjson/rapidjson.h 10 | ${CMAKE_SOURCE_DIR}/externals/rapidjson/include 11 | $ENV{PROGRAMFILES}/rapidjson/include 12 | ${COMPILER_PATH}/PlatformSDK/Include 13 | $ENV{JSON_ROOT_DIR}/include 14 | ${GLEW_ROOT_DIR}/include 15 | /usr/include 16 | /usr/local/include 17 | /sw/include 18 | /opt/local/include 19 | DOC "The directory where rapidjson/rapidjson.h resides") 20 | 21 | INCLUDE(FindPackageHandleStandardArgs) 22 | # handle the QUIETLY and REQUIRED arguments and set RAPID_JSON_FOUND to TRUE if 23 | # all listed variables are TRUE 24 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(RAPID_JSON DEFAULT_MSG RAPID_JSON_INCLUDE_DIR) 25 | -------------------------------------------------------------------------------- /data/fonts/consolas.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/fonts/consolas.ttf -------------------------------------------------------------------------------- /data/textures/2294472375_24a3b8ef46_o.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/2294472375_24a3b8ef46_o.jpg -------------------------------------------------------------------------------- /data/textures/758px-Canestra_di_frutta_(Caravaggio).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/758px-Canestra_di_frutta_(Caravaggio).jpg -------------------------------------------------------------------------------- /data/textures/ash_uvgrid01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/ash_uvgrid01.jpg -------------------------------------------------------------------------------- /data/textures/ash_uvgrid01.nfo: -------------------------------------------------------------------------------- 1 | http://www.pixelcg.com/blog/?p=146 2 | -------------------------------------------------------------------------------- /data/textures/compressed/disturb_dxt1_mip.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/compressed/disturb_dxt1_mip.dds -------------------------------------------------------------------------------- /data/textures/compressed/disturb_dxt1_nomip.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/compressed/disturb_dxt1_nomip.dds -------------------------------------------------------------------------------- /data/textures/compressed/explosion_dxt5_mip.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/compressed/explosion_dxt5_mip.dds -------------------------------------------------------------------------------- /data/textures/compressed/hepatica_dxt3_mip.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/compressed/hepatica_dxt3_mip.dds -------------------------------------------------------------------------------- /data/textures/crate.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/crate.gif -------------------------------------------------------------------------------- /data/textures/cube/Bridge2/negx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Bridge2/negx.jpg -------------------------------------------------------------------------------- /data/textures/cube/Bridge2/negy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Bridge2/negy.jpg -------------------------------------------------------------------------------- /data/textures/cube/Bridge2/negz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Bridge2/negz.jpg -------------------------------------------------------------------------------- /data/textures/cube/Bridge2/posx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Bridge2/posx.jpg -------------------------------------------------------------------------------- /data/textures/cube/Bridge2/posy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Bridge2/posy.jpg -------------------------------------------------------------------------------- /data/textures/cube/Bridge2/posz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Bridge2/posz.jpg -------------------------------------------------------------------------------- /data/textures/cube/Bridge2/readme.txt: -------------------------------------------------------------------------------- 1 | Author 2 | ====== 3 | 4 | This is the work of Emil Persson, aka Humus. 5 | http://www.humus.name 6 | humus@comhem.se 7 | 8 | 9 | 10 | Legal stuff 11 | =========== 12 | 13 | This work is free and may be used by anyone for any purpose 14 | and may be distributed freely to anyone using any distribution 15 | media or distribution method as long as this file is included. 16 | Distribution without this file is allowed if it's distributed 17 | with free non-commercial software; however, fair credit of the 18 | original author is expected. 19 | Any commercial distribution of this software requires the written 20 | approval of Emil Persson. 21 | -------------------------------------------------------------------------------- /data/textures/cube/Escher/dds/nx.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Escher/dds/nx.dds -------------------------------------------------------------------------------- /data/textures/cube/Escher/dds/ny.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Escher/dds/ny.dds -------------------------------------------------------------------------------- /data/textures/cube/Escher/dds/nz.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Escher/dds/nz.dds -------------------------------------------------------------------------------- /data/textures/cube/Escher/dds/px.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Escher/dds/px.dds -------------------------------------------------------------------------------- /data/textures/cube/Escher/dds/py.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Escher/dds/py.dds -------------------------------------------------------------------------------- /data/textures/cube/Escher/dds/pz.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Escher/dds/pz.dds -------------------------------------------------------------------------------- /data/textures/cube/Escher/nx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Escher/nx.jpg -------------------------------------------------------------------------------- /data/textures/cube/Escher/ny.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Escher/ny.jpg -------------------------------------------------------------------------------- /data/textures/cube/Escher/nz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Escher/nz.jpg -------------------------------------------------------------------------------- /data/textures/cube/Escher/px.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Escher/px.jpg -------------------------------------------------------------------------------- /data/textures/cube/Escher/py.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Escher/py.jpg -------------------------------------------------------------------------------- /data/textures/cube/Escher/pz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Escher/pz.jpg -------------------------------------------------------------------------------- /data/textures/cube/Park2/negx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Park2/negx.jpg -------------------------------------------------------------------------------- /data/textures/cube/Park2/negy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Park2/negy.jpg -------------------------------------------------------------------------------- /data/textures/cube/Park2/negz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Park2/negz.jpg -------------------------------------------------------------------------------- /data/textures/cube/Park2/posx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Park2/posx.jpg -------------------------------------------------------------------------------- /data/textures/cube/Park2/posy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Park2/posy.jpg -------------------------------------------------------------------------------- /data/textures/cube/Park2/posz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Park2/posz.jpg -------------------------------------------------------------------------------- /data/textures/cube/Park2/readme.txt: -------------------------------------------------------------------------------- 1 | Author 2 | ====== 3 | 4 | This is the work of Emil Persson, aka Humus. 5 | http://www.humus.name 6 | humus@comhem.se 7 | 8 | 9 | 10 | Legal stuff 11 | =========== 12 | 13 | This work is free and may be used by anyone for any purpose 14 | and may be distributed freely to anyone using any distribution 15 | media or distribution method as long as this file is included. 16 | Distribution without this file is allowed if it's distributed 17 | with free non-commercial software; however, fair credit of the 18 | original author is expected. 19 | Any commercial distribution of this software requires the written 20 | approval of Emil Persson. 21 | -------------------------------------------------------------------------------- /data/textures/cube/Park3Med/nx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Park3Med/nx.jpg -------------------------------------------------------------------------------- /data/textures/cube/Park3Med/ny.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Park3Med/ny.jpg -------------------------------------------------------------------------------- /data/textures/cube/Park3Med/nz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Park3Med/nz.jpg -------------------------------------------------------------------------------- /data/textures/cube/Park3Med/px.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Park3Med/px.jpg -------------------------------------------------------------------------------- /data/textures/cube/Park3Med/py.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Park3Med/py.jpg -------------------------------------------------------------------------------- /data/textures/cube/Park3Med/pz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/Park3Med/pz.jpg -------------------------------------------------------------------------------- /data/textures/cube/Park3Med/readme.txt: -------------------------------------------------------------------------------- 1 | Author 2 | ====== 3 | 4 | This is the work of Emil Persson, aka Humus. 5 | http://www.humus.name 6 | humus@comhem.se 7 | 8 | 9 | 10 | Legal stuff 11 | =========== 12 | 13 | This work is free and may be used by anyone for any purpose 14 | and may be distributed freely to anyone using any distribution 15 | media or distribution method as long as this file is included. 16 | Distribution without this file is allowed if it's distributed 17 | with free non-commercial software; however, fair credit of the 18 | original author is expected. 19 | Any commercial distribution of this software requires the written 20 | approval of Emil Persson. 21 | -------------------------------------------------------------------------------- /data/textures/cube/SwedishRoyalCastle/nx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/SwedishRoyalCastle/nx.jpg -------------------------------------------------------------------------------- /data/textures/cube/SwedishRoyalCastle/ny.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/SwedishRoyalCastle/ny.jpg -------------------------------------------------------------------------------- /data/textures/cube/SwedishRoyalCastle/nz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/SwedishRoyalCastle/nz.jpg -------------------------------------------------------------------------------- /data/textures/cube/SwedishRoyalCastle/px.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/SwedishRoyalCastle/px.jpg -------------------------------------------------------------------------------- /data/textures/cube/SwedishRoyalCastle/py.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/SwedishRoyalCastle/py.jpg -------------------------------------------------------------------------------- /data/textures/cube/SwedishRoyalCastle/pz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/SwedishRoyalCastle/pz.jpg -------------------------------------------------------------------------------- /data/textures/cube/SwedishRoyalCastle/readme.txt: -------------------------------------------------------------------------------- 1 | Author 2 | ====== 3 | 4 | This is the work of Emil Persson, aka Humus. 5 | http://www.humus.name 6 | humus@comhem.se 7 | 8 | 9 | 10 | Legal stuff 11 | =========== 12 | 13 | This work is free and may be used by anyone for any purpose 14 | and may be distributed freely to anyone using any distribution 15 | media or distribution method as long as this file is included. 16 | Distribution without this file is allowed if it's distributed 17 | with free non-commercial software; however, fair credit of the 18 | original author is expected. 19 | Any commercial distribution of this software requires the written 20 | approval of Emil Persson. 21 | -------------------------------------------------------------------------------- /data/textures/cube/pisa/nx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/pisa/nx.png -------------------------------------------------------------------------------- /data/textures/cube/pisa/ny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/pisa/ny.png -------------------------------------------------------------------------------- /data/textures/cube/pisa/nz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/pisa/nz.png -------------------------------------------------------------------------------- /data/textures/cube/pisa/px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/pisa/px.png -------------------------------------------------------------------------------- /data/textures/cube/pisa/py.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/pisa/py.png -------------------------------------------------------------------------------- /data/textures/cube/pisa/pz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/pisa/pz.png -------------------------------------------------------------------------------- /data/textures/cube/skybox/nx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/skybox/nx.jpg -------------------------------------------------------------------------------- /data/textures/cube/skybox/ny.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/skybox/ny.jpg -------------------------------------------------------------------------------- /data/textures/cube/skybox/nz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/skybox/nz.jpg -------------------------------------------------------------------------------- /data/textures/cube/skybox/px.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/skybox/px.jpg -------------------------------------------------------------------------------- /data/textures/cube/skybox/py.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/skybox/py.jpg -------------------------------------------------------------------------------- /data/textures/cube/skybox/pz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/cube/skybox/pz.jpg -------------------------------------------------------------------------------- /data/textures/disturb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/disturb.jpg -------------------------------------------------------------------------------- /data/textures/envmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/envmap.png -------------------------------------------------------------------------------- /data/textures/kinect.nfo: -------------------------------------------------------------------------------- 1 | Using freenect and a modified version of glview.c: 2 | https://gist.github.com/1326080 3 | 4 | Recorded the screen using ffmpeg (I have 0 knowledge of C...): 5 | https://gist.github.com/1325393 6 | -------------------------------------------------------------------------------- /data/textures/kinect.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/kinect.webm -------------------------------------------------------------------------------- /data/textures/land_ocean_ice_cloud_2048.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/land_ocean_ice_cloud_2048.jpg -------------------------------------------------------------------------------- /data/textures/lava/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/lava/cloud.png -------------------------------------------------------------------------------- /data/textures/lava/lavatile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/lava/lavatile.jpg -------------------------------------------------------------------------------- /data/textures/lensflare/LICENSE.txt: -------------------------------------------------------------------------------- 1 | lensflare0.png 2 | lensflare1.png 3 | lensflare2.png 4 | lensflare3.png 5 | 6 | 3D assets and textures for ROME "3 Dreams of Black" at http://ro.me are licensed 7 | under a Creative CommonsAttribution-NonCommercial-ShareAlike 3.0 Unported License 8 | ( http://creativecommons.org/licenses/by-nc-sa/3.0/ ). 9 | 10 | --------------------------------------------------------------------------- 11 | hexangle.png 12 | 13 | CC0 - Public Domain Donation by hackcraft.de 14 | 15 | http://opengameart.org/content/lens-flares-and-particles 16 | http://creativecommons.org/publicdomain/zero/1.0/ -------------------------------------------------------------------------------- /data/textures/lensflare/hexangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/lensflare/hexangle.png -------------------------------------------------------------------------------- /data/textures/lensflare/lensflare0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/lensflare/lensflare0.png -------------------------------------------------------------------------------- /data/textures/lensflare/lensflare0_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/lensflare/lensflare0_alpha.png -------------------------------------------------------------------------------- /data/textures/lensflare/lensflare1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/lensflare/lensflare1.png -------------------------------------------------------------------------------- /data/textures/lensflare/lensflare2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/lensflare/lensflare2.png -------------------------------------------------------------------------------- /data/textures/lensflare/lensflare3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/lensflare/lensflare3.png -------------------------------------------------------------------------------- /data/textures/lensflare0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/lensflare0.png -------------------------------------------------------------------------------- /data/textures/lensflare1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/lensflare1.png -------------------------------------------------------------------------------- /data/textures/lensflare2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/lensflare2.jpg -------------------------------------------------------------------------------- /data/textures/memorial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/memorial.png -------------------------------------------------------------------------------- /data/textures/metal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/metal.jpg -------------------------------------------------------------------------------- /data/textures/minecraft/dirt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/minecraft/dirt.png -------------------------------------------------------------------------------- /data/textures/minecraft/grass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/minecraft/grass.png -------------------------------------------------------------------------------- /data/textures/minecraft/grass_dirt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/minecraft/grass_dirt.png -------------------------------------------------------------------------------- /data/textures/minecraft/painterlypack.txt: -------------------------------------------------------------------------------- 1 | http://painterlypack.net/ 2 | -------------------------------------------------------------------------------- /data/textures/normal/ninja/ao.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/normal/ninja/ao.jpg -------------------------------------------------------------------------------- /data/textures/normal/ninja/displacement.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/normal/ninja/displacement.jpg -------------------------------------------------------------------------------- /data/textures/normal/ninja/displacement.txt: -------------------------------------------------------------------------------- 1 | DisplacementMap Scale: 2.436143 2 | DisplacementMap Bias : -0.428408 3 | -------------------------------------------------------------------------------- /data/textures/normal/ninja/normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/normal/ninja/normal.jpg -------------------------------------------------------------------------------- /data/textures/patterns/bright_squares256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/patterns/bright_squares256.png -------------------------------------------------------------------------------- /data/textures/patterns/circuit_pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/patterns/circuit_pattern.png -------------------------------------------------------------------------------- /data/textures/patterns/readme.txt: -------------------------------------------------------------------------------- 1 | Texture "bright_squares256.png" from http://subtlepatterns.com/ 2 | 3 | Slightly modified to have more GPU friendly sizes. 4 | 5 | Licensed under a Creative Commons Attribution 3.0 Unported License: 6 | http://creativecommons.org/licenses/by/3.0/ -------------------------------------------------------------------------------- /data/textures/planets/earth_atmos_2048.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/planets/earth_atmos_2048.jpg -------------------------------------------------------------------------------- /data/textures/planets/earth_clouds_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/planets/earth_clouds_1024.png -------------------------------------------------------------------------------- /data/textures/planets/earth_normal_2048.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/planets/earth_normal_2048.jpg -------------------------------------------------------------------------------- /data/textures/planets/earth_specular_2048.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/planets/earth_specular_2048.jpg -------------------------------------------------------------------------------- /data/textures/planets/moon_1024.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/planets/moon_1024.jpg -------------------------------------------------------------------------------- /data/textures/sintel.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sintel.mp4 -------------------------------------------------------------------------------- /data/textures/sintel.ogv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sintel.ogv -------------------------------------------------------------------------------- /data/textures/sprite0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprite0.jpg -------------------------------------------------------------------------------- /data/textures/sprite0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprite0.png -------------------------------------------------------------------------------- /data/textures/sprite1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprite1.jpg -------------------------------------------------------------------------------- /data/textures/sprite1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprite1.png -------------------------------------------------------------------------------- /data/textures/sprite2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprite2.png -------------------------------------------------------------------------------- /data/textures/sprites/ball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprites/ball.png -------------------------------------------------------------------------------- /data/textures/sprites/circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprites/circle.png -------------------------------------------------------------------------------- /data/textures/sprites/disc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprites/disc.png -------------------------------------------------------------------------------- /data/textures/sprites/snowflake1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprites/snowflake1.png -------------------------------------------------------------------------------- /data/textures/sprites/snowflake2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprites/snowflake2.png -------------------------------------------------------------------------------- /data/textures/sprites/snowflake3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprites/snowflake3.png -------------------------------------------------------------------------------- /data/textures/sprites/snowflake4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprites/snowflake4.png -------------------------------------------------------------------------------- /data/textures/sprites/snowflake5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprites/snowflake5.png -------------------------------------------------------------------------------- /data/textures/sprites/snowflake7_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprites/snowflake7_alpha.png -------------------------------------------------------------------------------- /data/textures/sprites/spark1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/sprites/spark1.png -------------------------------------------------------------------------------- /data/textures/square-outline-textured.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/square-outline-textured.png -------------------------------------------------------------------------------- /data/textures/square-outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/square-outline.png -------------------------------------------------------------------------------- /data/textures/terrain/backgrounddetailed6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/terrain/backgrounddetailed6.jpg -------------------------------------------------------------------------------- /data/textures/terrain/grasslight-big-nm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/terrain/grasslight-big-nm.jpg -------------------------------------------------------------------------------- /data/textures/terrain/grasslight-big.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/terrain/grasslight-big.jpg -------------------------------------------------------------------------------- /data/textures/terrain/readme.txt: -------------------------------------------------------------------------------- 1 | Textures from http://opengameart.org/ 2 | 3 | http://opengameart.org/content/dark-grass 4 | http://opengameart.org/content/backgrounds-topdown-games 5 | 6 | Slightly modified to have more GPU friendly sizes. 7 | 8 | Licensed under a Creative Commons Attribution 3.0 Unported License: 9 | http://creativecommons.org/licenses/by/3.0/ -------------------------------------------------------------------------------- /data/textures/water.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/textures/water.jpg -------------------------------------------------------------------------------- /data/thumbs/webgl_custom_attributes_particles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_custom_attributes_particles.png -------------------------------------------------------------------------------- /data/thumbs/webgl_custom_attributes_particles2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_custom_attributes_particles2.png -------------------------------------------------------------------------------- /data/thumbs/webgl_custom_attributes_particles3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_custom_attributes_particles3.png -------------------------------------------------------------------------------- /data/thumbs/webgl_geometry_hierarchy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_geometry_hierarchy.png -------------------------------------------------------------------------------- /data/thumbs/webgl_geometry_hierarchy2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_geometry_hierarchy2.png -------------------------------------------------------------------------------- /data/thumbs/webgl_geometry_minecraft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_geometry_minecraft.png -------------------------------------------------------------------------------- /data/thumbs/webgl_lines_colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_lines_colors.png -------------------------------------------------------------------------------- /data/thumbs/webgl_lines_cubes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_lines_cubes.png -------------------------------------------------------------------------------- /data/thumbs/webgl_lines_sphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_lines_sphere.png -------------------------------------------------------------------------------- /data/thumbs/webgl_particles_billboards.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_particles_billboards.png -------------------------------------------------------------------------------- /data/thumbs/webgl_particles_billboards_colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_particles_billboards_colors.png -------------------------------------------------------------------------------- /data/thumbs/webgl_particles_random.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_particles_random.png -------------------------------------------------------------------------------- /data/thumbs/webgl_particles_sprites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_particles_sprites.png -------------------------------------------------------------------------------- /data/thumbs/webgl_shader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_shader.png -------------------------------------------------------------------------------- /data/thumbs/webgl_shader2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_shader2.png -------------------------------------------------------------------------------- /data/thumbs/webgl_shader_lava.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_shader_lava.png -------------------------------------------------------------------------------- /data/thumbs/webgl_test_memory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/data/thumbs/webgl_test_memory.png -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/examples/.gitignore -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(three_examples) 2 | 3 | set(THREE_EXAMPLE_LIBS ${THREE_LIB} ${THREE_DEP_LIBS} ${SDLMAIN_LIBRARY}) 4 | 5 | if(APPLE) 6 | find_library(COCOA_LIBRARY Cocoa) 7 | set(THREE_EXAMPLE_LIBS ${THREE_EXAMPLE_LIBS} ${COCOA_LIBRARY}) 8 | endif() 9 | 10 | file(GLOB examples "*.cpp") 11 | 12 | foreach(example ${examples}) 13 | get_filename_component(example_name ${example} NAME_WE) 14 | three_add_example(${example_name} ${example}) 15 | endforeach() 16 | 17 | -------------------------------------------------------------------------------- /examples/common.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_EXAMPLES_COMMON_HPP 2 | #define THREE_EXAMPLES_COMMON_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | namespace three { 18 | 19 | struct ExampleSession { 20 | 21 | ExampleSession( three::RendererParameters parameters = three::RendererParameters() ) { 22 | if ( !three::sdl::init( parameters ) || !three::glew::init( parameters ) ) { 23 | return; 24 | } 25 | renderer = three::GLRenderer::create( parameters ); 26 | } 27 | 28 | ~ExampleSession() { 29 | three::sdl::quit(); 30 | } 31 | 32 | template < typename Example > 33 | void run( Example example ) { 34 | if ( renderer ) 35 | example( renderer ); 36 | } 37 | 38 | private: 39 | ExampleSession(ExampleSession&); 40 | ExampleSession& operator=(ExampleSession&); 41 | 42 | three::GLRenderer::Ptr renderer; 43 | }; 44 | 45 | } // namespace three 46 | 47 | #endif // THREE_EXAMPLES_COMMON_HPP -------------------------------------------------------------------------------- /examples/performance_static.bak: -------------------------------------------------------------------------------- 1 | #if 0 2 | #include "common.hpp" 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | using namespace three; 14 | 15 | void performance_static( GLRenderer::Ptr renderer ) { 16 | 17 | auto camera = PerspectiveCamera::create( 18 | 60, (float)renderer->width() / renderer->height(), 1, 10000 19 | ); 20 | camera->position.z = 3200; 21 | 22 | auto scene = Scene::create(); 23 | 24 | auto material = MeshNormalMaterial::create( 25 | Material::Parameters().add("shading", THREE::SmoothShading) 26 | ); 27 | 28 | auto loader = JSONLoader::create(); 29 | loader->load( threeDataPath("/obj/Suzanne.js"), [&material]( Geometry::Ptr geometry ) { 30 | geometry->computeVertexNormals(); 31 | 32 | for ( int = 0; i < 7700; i ++ ) { 33 | 34 | auto mesh = Mesh::create( geometry, material ); 35 | 36 | mesh->position.x = Math.random() * 10000 - 5000; 37 | mesh->position.y = Math.random() * 10000 - 5000; 38 | mesh->position.z = Math.random() * 10000 - 5000; 39 | mesh->rotation.x = Math.random() * 360 * ( Math.PI / 180 ); 40 | mesh->rotation.y = Math.random() * 360 * ( Math.PI / 180 ); 41 | mesh->scale.x = mesh->scale.y = mesh->scale.z = Math.random(100.f, 150.f); 42 | mesh->matrixAutoUpdate = false; 43 | mesh->updateMatrix(); 44 | 45 | scene.add( mesh ); 46 | 47 | } 48 | }); 49 | 50 | auto mesh = ParticleSystem::create( geometry, material ); 51 | scene->add( mesh ); 52 | 53 | auto mouseX = 0.f, mouseY = 0.f; 54 | 55 | anim::gameLoop ( 56 | 57 | [&]( float ) -> bool { 58 | 59 | camera->position.x += ( 100.f * mouseX - camera->position.x ) * dt; 60 | camera->position.y += ( 100.f * mouseY - camera->position.y ) * dt; 61 | camera->lookAt( scene->position ); 62 | 63 | renderer->render( *scene, *camera ); 64 | 65 | return true; 66 | 67 | } ); 68 | 69 | } 70 | 71 | int main ( int argc, char* argv[] ) { 72 | 73 | auto onQuit = defer( SDL_Quit ); 74 | 75 | GLRenderer::Parameters parameters; 76 | if ( !sdl::init( parameters ) || !glew::init( parameters ) ) { 77 | return 0; 78 | } 79 | 80 | auto renderer = three::GLRenderer::create( parameters ); 81 | if ( !renderer ) { 82 | return 0; 83 | } 84 | 85 | renderer->sortObjects = false; 86 | performance_static( renderer ); 87 | 88 | return 0; 89 | } 90 | #endif // 0 -------------------------------------------------------------------------------- /examples/simple.cpp: -------------------------------------------------------------------------------- 1 | #include "common.hpp" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace three; 12 | 13 | void simple( const GLRenderer::Ptr& renderer ) { 14 | 15 | // Camera 16 | auto camera = PerspectiveCamera::create( 17 | 50, ( float )renderer->width() / renderer->height(), .1f, 1000.f 18 | ); 19 | camera->position.z = 300; 20 | 21 | 22 | // Scene 23 | auto scene = Scene::create(); 24 | scene->add( camera ); 25 | 26 | 27 | // Lights 28 | auto pointLight = PointLight::create( 0xFFFFFF ); 29 | pointLight->position = Vector3( 10, 50, 130 ); 30 | scene->add( pointLight ); 31 | 32 | 33 | // Materials 34 | auto sphereMaterial = MeshLambertMaterial::create( 35 | Material::Parameters().add( "color", Color( 0xcc0000 ) ) 36 | ); 37 | 38 | 39 | // Geometries 40 | float radius = 50, segments = 16, rings = 16; 41 | auto sphereGeometry = SphereGeometry::create( radius, segments, rings ); 42 | 43 | auto sphere = Mesh::create( sphereGeometry, sphereMaterial ); 44 | scene->add( sphere ); 45 | 46 | 47 | // Events 48 | auto running = true; 49 | sdl::addEventListener(SDL_KEYDOWN, [&]( const sdl::Event& ) { 50 | running = false; 51 | }); 52 | sdl::addEventListener(SDL_QUIT, [&]( const sdl::Event& ) { 53 | running = false; 54 | }); 55 | auto mouseX = 0.f, mouseY = 0.f; 56 | sdl::addEventListener(SDL_MOUSEMOTION, [&]( const sdl::Event& event ) { 57 | mouseX = 2.f * ((float)event.motion.x / renderer->width() - 0.5f); 58 | mouseY = 2.f * ((float)event.motion.y / renderer->height() - 0.5f); 59 | }); 60 | 61 | 62 | // Rendering 63 | 64 | stats::Stats stats( *renderer ); 65 | anim::gameLoop( [&]( float dt ) -> bool { 66 | 67 | camera->position.x += (-100.f * mouseX - camera->position.x ) * 3 * dt; 68 | camera->position.y += ( 100.f * mouseY - camera->position.y ) * 3 * dt; 69 | camera->lookAt( scene->position ); 70 | 71 | renderer->render( *scene, *camera ); 72 | 73 | return running; 74 | 75 | }, 3000 ); 76 | 77 | } 78 | 79 | int main( int argc, char* argv[] ) { 80 | 81 | ExampleSession session; 82 | 83 | session.run( simple ); 84 | 85 | return 0; 86 | } -------------------------------------------------------------------------------- /externals/rapidjson/include/rapidjson/filereadstream.h: -------------------------------------------------------------------------------- 1 | #ifndef RAPIDJSON_FILEREADSTREAM_H_ 2 | #define RAPIDJSON_FILEREADSTREAM_H_ 3 | 4 | #include "rapidjson.h" 5 | #include 6 | 7 | namespace rapidjson { 8 | 9 | //! File byte stream for input using fread(). 10 | /*! 11 | \implements Stream 12 | */ 13 | class FileReadStream { 14 | public: 15 | typedef char Ch; //!< Character type (byte). 16 | 17 | //! Constructor. 18 | /*! 19 | \param fp File pointer opened for read. 20 | \param buffer user-supplied buffer. 21 | \param bufferSize size of buffer in bytes. Must >=4 bytes. 22 | */ 23 | FileReadStream(FILE* fp, char* buffer, size_t bufferSize) : fp_(fp), buffer_(buffer), bufferSize_(bufferSize), bufferLast_(0), current_(buffer_), readCount_(0), count_(0), eof_(false) { 24 | RAPIDJSON_ASSERT(fp_ != 0); 25 | RAPIDJSON_ASSERT(bufferSize >= 4); 26 | Read(); 27 | } 28 | 29 | Ch Peek() const { return *current_; } 30 | Ch Take() { Ch c = *current_; Read(); return c; } 31 | size_t Tell() const { return count_ + (current_ - buffer_); } 32 | 33 | // Not implemented 34 | void Put(Ch c) { RAPIDJSON_ASSERT(false); } 35 | void Flush() { RAPIDJSON_ASSERT(false); } 36 | Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; } 37 | size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; } 38 | 39 | // For encoding detection only. 40 | const Ch* Peek4() const { 41 | return (current_ + 4 <= bufferLast_) ? current_ : 0; 42 | } 43 | 44 | private: 45 | void Read() { 46 | if (current_ < bufferLast_) 47 | ++current_; 48 | else if (!eof_) { 49 | count_ += readCount_; 50 | readCount_ = fread(buffer_, 1, bufferSize_, fp_); 51 | bufferLast_ = buffer_ + readCount_ - 1; 52 | current_ = buffer_; 53 | 54 | if (readCount_ < bufferSize_) { 55 | buffer_[readCount_] = '\0'; 56 | ++bufferLast_; 57 | eof_ = true; 58 | } 59 | } 60 | } 61 | 62 | FILE* fp_; 63 | Ch *buffer_; 64 | size_t bufferSize_; 65 | Ch *bufferLast_; 66 | Ch *current_; 67 | size_t readCount_; 68 | size_t count_; //!< Number of characters read 69 | bool eof_; 70 | }; 71 | 72 | } // namespace rapidjson 73 | 74 | #endif // RAPIDJSON_FILESTREAM_H_ 75 | -------------------------------------------------------------------------------- /externals/rapidjson/include/rapidjson/filestream.h: -------------------------------------------------------------------------------- 1 | #ifndef RAPIDJSON_FILESTREAM_H_ 2 | #define RAPIDJSON_FILESTREAM_H_ 3 | 4 | #include "rapidjson.h" 5 | #include 6 | 7 | namespace rapidjson { 8 | 9 | //! (Depreciated) Wrapper of C file stream for input or output. 10 | /*! 11 | This simple wrapper does not check the validity of the stream. 12 | \implements Stream 13 | \deprecated { This was only for basic testing in version 0.1, it is found that the performance is very low by using fgetc(). Use FileReadStream instead. } 14 | */ 15 | class FileStream { 16 | public: 17 | typedef char Ch; //!< Character type. Only support char. 18 | 19 | FileStream(FILE* fp) : fp_(fp), count_(0) { Read(); } 20 | char Peek() const { return current_; } 21 | char Take() { char c = current_; Read(); return c; } 22 | size_t Tell() const { return count_; } 23 | void Put(char c) { fputc(c, fp_); } 24 | void Flush() { fflush(fp_); } 25 | 26 | // Not implemented 27 | char* PutBegin() { return 0; } 28 | size_t PutEnd(char*) { return 0; } 29 | 30 | private: 31 | void Read() { 32 | RAPIDJSON_ASSERT(fp_ != 0); 33 | int c = fgetc(fp_); 34 | if (c != EOF) { 35 | current_ = (char)c; 36 | count_++; 37 | } 38 | else if (current_ != '\0') 39 | current_ = '\0'; 40 | } 41 | 42 | FILE* fp_; 43 | char current_; 44 | size_t count_; 45 | }; 46 | 47 | } // namespace rapidjson 48 | 49 | #endif // RAPIDJSON_FILESTREAM_H_ 50 | -------------------------------------------------------------------------------- /externals/rapidjson/include/rapidjson/filewritestream.h: -------------------------------------------------------------------------------- 1 | #ifndef RAPIDJSON_FILEWRITESTREAM_H_ 2 | #define RAPIDJSON_FILEWRITESTREAM_H_ 3 | 4 | #include "rapidjson.h" 5 | #include 6 | 7 | namespace rapidjson { 8 | 9 | //! Wrapper of C file stream for input using fread(). 10 | /*! 11 | \implements Stream 12 | */ 13 | class FileWriteStream { 14 | public: 15 | typedef char Ch; //!< Character type. Only support char. 16 | 17 | FileWriteStream(FILE* fp, char* buffer, size_t bufferSize) : fp_(fp), buffer_(buffer), bufferEnd_(buffer + bufferSize), current_(buffer_) { 18 | RAPIDJSON_ASSERT(fp_ != 0); 19 | } 20 | 21 | void Put(char c) { 22 | if (current_ >= bufferEnd_) 23 | Flush(); 24 | 25 | *current_++ = c; 26 | } 27 | 28 | void PutN(char c, size_t n) { 29 | size_t avail = bufferEnd_ - current_; 30 | while (n > avail) { 31 | memset(current_, c, avail); 32 | current_ += avail; 33 | Flush(); 34 | n -= avail; 35 | avail = bufferEnd_ - current_; 36 | } 37 | 38 | if (n > 0) { 39 | memset(current_, c, n); 40 | current_ += n; 41 | } 42 | } 43 | 44 | void Flush() { 45 | if (current_ != buffer_) { 46 | fwrite(buffer_, 1, current_ - buffer_, fp_); 47 | current_ = buffer_; 48 | } 49 | } 50 | 51 | // Not implemented 52 | char Peek() const { RAPIDJSON_ASSERT(false); } 53 | char Take() { RAPIDJSON_ASSERT(false); } 54 | size_t Tell() const { RAPIDJSON_ASSERT(false); } 55 | char* PutBegin() { RAPIDJSON_ASSERT(false); return 0; } 56 | size_t PutEnd(char*) { RAPIDJSON_ASSERT(false); return 0; } 57 | 58 | private: 59 | FILE* fp_; 60 | char *buffer_; 61 | char *bufferEnd_; 62 | char *current_; 63 | }; 64 | 65 | //! Implement specialized version of PutN() with memset() for better performance. 66 | template<> 67 | inline void PutN(FileWriteStream& stream, char c, size_t n) { 68 | stream.PutN(c, n); 69 | } 70 | 71 | } // namespace rapidjson 72 | 73 | #endif // RAPIDJSON_FILESTREAM_H_ 74 | -------------------------------------------------------------------------------- /externals/rapidjson/include/rapidjson/internal/strfunc.h: -------------------------------------------------------------------------------- 1 | #ifndef RAPIDJSON_INTERNAL_STRFUNC_H_ 2 | #define RAPIDJSON_INTERNAL_STRFUNC_H_ 3 | 4 | namespace rapidjson { 5 | namespace internal { 6 | 7 | //! Custom strlen() which works on different character types. 8 | /*! \tparam Ch Character type (e.g. char, wchar_t, short) 9 | \param s Null-terminated input string. 10 | \return Number of characters in the string. 11 | \note This has the same semantics as strlen(), the return value is not number of Unicode codepoints. 12 | */ 13 | template 14 | inline SizeType StrLen(const Ch* s) { 15 | const Ch* p = s; 16 | while (*p != '\0') 17 | ++p; 18 | return SizeType(p - s); 19 | } 20 | 21 | } // namespace internal 22 | } // namespace rapidjson 23 | 24 | #endif // RAPIDJSON_INTERNAL_STRFUNC_H_ 25 | -------------------------------------------------------------------------------- /externals/rapidjson/include/rapidjson/stringbuffer.h: -------------------------------------------------------------------------------- 1 | #ifndef RAPIDJSON_STRINGBUFFER_H_ 2 | #define RAPIDJSON_STRINGBUFFER_H_ 3 | 4 | #include "rapidjson.h" 5 | #include "internal/stack.h" 6 | 7 | namespace rapidjson { 8 | 9 | //! Represents an in-memory output stream. 10 | /*! 11 | \tparam Encoding Encoding of the stream. 12 | \tparam Allocator type for allocating memory buffer. 13 | \implements Stream 14 | */ 15 | template 16 | struct GenericStringBuffer { 17 | typedef typename Encoding::Ch Ch; 18 | 19 | GenericStringBuffer(Allocator* allocator = 0, size_t capacity = kDefaultCapacity) : stack_(allocator, capacity) {} 20 | 21 | void Put(Ch c) { *stack_.template Push() = c; } 22 | void Flush() {} 23 | 24 | void Clear() { stack_.Clear(); } 25 | 26 | const Ch* GetString() const { 27 | // Push and pop a null terminator. This is safe. 28 | *stack_.template Push() = '\0'; 29 | stack_.template Pop(1); 30 | 31 | return stack_.template Bottom(); 32 | } 33 | 34 | size_t GetSize() const { return stack_.GetSize(); } 35 | 36 | static const size_t kDefaultCapacity = 256; 37 | mutable internal::Stack stack_; 38 | }; 39 | 40 | typedef GenericStringBuffer > StringBuffer; 41 | 42 | //! Implement specialized version of PutN() with memset() for better performance. 43 | template<> 44 | inline void PutN(GenericStringBuffer >& stream, char c, size_t n) { 45 | memset(stream.stack_.Push(n), c, n * sizeof(c)); 46 | } 47 | 48 | } // namespace rapidjson 49 | 50 | #endif // RAPIDJSON_STRINGBUFFER_H_ 51 | -------------------------------------------------------------------------------- /externals/rapidjson/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 Milo Yip 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /externals/rapidjson/readme.txt: -------------------------------------------------------------------------------- 1 | Rapidjson v0.1 2 | 3 | Copyright (c) 2011 Milo Yip (miloyip@gmail.com) 4 | 5 | http://code.google.com/p/rapidjson/ 6 | 7 | 19 Nov 2011 8 | 9 | 1. Introduction 10 | Rapidjson is a JSON parser and generator for C++. It was inspired by rapidxml http://rapidxml.sourceforge.net/ 11 | Rapidjson is small but complete. It supports both SAX and DOM style API. The SAX parser is only a half thousand lines of code. 12 | Rapidjson is fast. Its performance can be comparable to strlen(). It also optionally supports SSE2/SSE4.1 for acceleration. 13 | Rapidjson is self-contained. It does not depend on external libraries such as BOOST. It even does not depend on STL. 14 | Rapidjson is memory friendly. Each JSON value costs exactly 16/20 bytes for 32/64-bit machines (excluding text string). By default it uses a fast memory allocator, and the parser allocates memory compactly during parsing. 15 | 16 | For the full features please refer to the user guide. 17 | 18 | JSON(JavaScript Object Notation) is a light-weight data exchange format. 19 | More information about JSON can be obtained at 20 | http://json.org/ 21 | http://www.ietf.org/rfc/rfc4627.txt 22 | 23 | 2. Installation 24 | 25 | Rapidjson is a header-only C++ library. Just copy the rapidjson/include/rapidjson folder to system or project's include path. 26 | 27 | To build the tests and examples, 28 | 1. obtain premake4 http://industriousone.com/premake/download 29 | 2. Copy premake4 executable to rapidjson/build 30 | 3. Run rapidjson/build/premake.bat on Windows, rapidjson/build/premake on Linux or other platforms 31 | 4. On Windows, build the solution at rapidjson/build/vs2008/ or /vs2010/ 32 | 5. On other platforms, run GNU make at rapidjson/build/gmake/ (e.g., make -f test.make config=release32, make -f example.make config=debug32) 33 | 6. On success, the executable are generated at rapidjson/bin 34 | 35 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/bin/SDL.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/bin/SDL.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/include/SDL/SDL_active.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_active.h 25 | * Include file for SDL application focus event handling 26 | */ 27 | 28 | #ifndef _SDL_active_h 29 | #define _SDL_active_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | #include "begin_code.h" 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @name The available application states */ 41 | /*@{*/ 42 | #define SDL_APPMOUSEFOCUS 0x01 /**< The app has mouse coverage */ 43 | #define SDL_APPINPUTFOCUS 0x02 /**< The app has input focus */ 44 | #define SDL_APPACTIVE 0x04 /**< The application is active */ 45 | /*@}*/ 46 | 47 | /* Function prototypes */ 48 | /** 49 | * This function returns the current state of the application, which is a 50 | * bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and 51 | * SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to 52 | * see your application, otherwise it has been iconified or disabled. 53 | */ 54 | extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void); 55 | 56 | 57 | /* Ends C function definitions when using C++ */ 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | #include "close_code.h" 62 | 63 | #endif /* _SDL_active_h */ 64 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/include/SDL/SDL_byteorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_byteorder.h 25 | * @deprecated Use SDL_endian.h instead 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_endian.h" 30 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/include/SDL/SDL_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_h 24 | #define _SDL_config_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* Add any platform that doesn't build using the configure system */ 29 | #if defined(__DREAMCAST__) 30 | #include "SDL_config_dreamcast.h" 31 | #elif defined(__MACOS__) 32 | #include "SDL_config_macos.h" 33 | #elif defined(__MACOSX__) 34 | #include "SDL_config_macosx.h" 35 | #elif defined(__SYMBIAN32__) 36 | #include "SDL_config_symbian.h" /* must be before win32! */ 37 | #elif defined(__WIN32__) 38 | #include "SDL_config_win32.h" 39 | #elif defined(__OS2__) 40 | #include "SDL_config_os2.h" 41 | #else 42 | #include "SDL_config_minimal.h" 43 | #endif /* platform config */ 44 | 45 | #endif /* _SDL_config_h */ 46 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/include/SDL/SDL_copying.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2009 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/include/SDL/SDL_cpuinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_cpuinfo.h 25 | * CPU feature detection for SDL 26 | */ 27 | 28 | #ifndef _SDL_cpuinfo_h 29 | #define _SDL_cpuinfo_h 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** This function returns true if the CPU has the RDTSC instruction */ 40 | extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); 41 | 42 | /** This function returns true if the CPU has MMX features */ 43 | extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); 44 | 45 | /** This function returns true if the CPU has MMX Ext. features */ 46 | extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void); 47 | 48 | /** This function returns true if the CPU has 3DNow features */ 49 | extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void); 50 | 51 | /** This function returns true if the CPU has 3DNow! Ext. features */ 52 | extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void); 53 | 54 | /** This function returns true if the CPU has SSE features */ 55 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); 56 | 57 | /** This function returns true if the CPU has SSE2 features */ 58 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); 59 | 60 | /** This function returns true if the CPU has AltiVec features */ 61 | extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); 62 | 63 | /* Ends C function definitions when using C++ */ 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #include "close_code.h" 68 | 69 | #endif /* _SDL_cpuinfo_h */ 70 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/include/SDL/SDL_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_error.h 25 | * Simple error message routines for SDL 26 | */ 27 | 28 | #ifndef _SDL_error_h 29 | #define _SDL_error_h 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * @name Public functions 41 | */ 42 | /*@{*/ 43 | extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...); 44 | extern DECLSPEC char * SDLCALL SDL_GetError(void); 45 | extern DECLSPEC void SDLCALL SDL_ClearError(void); 46 | /*@}*/ 47 | 48 | /** 49 | * @name Private functions 50 | * @internal Private error message function - used internally 51 | */ 52 | /*@{*/ 53 | #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) 54 | #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) 55 | typedef enum { 56 | SDL_ENOMEM, 57 | SDL_EFREAD, 58 | SDL_EFWRITE, 59 | SDL_EFSEEK, 60 | SDL_UNSUPPORTED, 61 | SDL_LASTERROR 62 | } SDL_errorcode; 63 | extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code); 64 | /*@}*/ 65 | 66 | /* Ends C function definitions when using C++ */ 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | #include "close_code.h" 71 | 72 | #endif /* _SDL_error_h */ 73 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/include/SDL/SDL_getenv.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_getenv.h 24 | * @deprecated Use SDL_stdinc.h instead 25 | */ 26 | 27 | /* DEPRECATED */ 28 | #include "SDL_stdinc.h" 29 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/include/SDL/SDL_name.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SDLname_h_ 3 | #define _SDLname_h_ 4 | 5 | #if defined(__STDC__) || defined(__cplusplus) 6 | #define NeedFunctionPrototypes 1 7 | #endif 8 | 9 | #define SDL_NAME(X) SDL_##X 10 | 11 | #endif /* _SDLname_h_ */ 12 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/include/SDL/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_quit.h 24 | * Include file for SDL quit event handling 25 | */ 26 | 27 | #ifndef _SDL_quit_h 28 | #define _SDL_quit_h 29 | 30 | #include "SDL_stdinc.h" 31 | #include "SDL_error.h" 32 | 33 | /** @file SDL_quit.h 34 | * An SDL_QUITEVENT is generated when the user tries to close the application 35 | * window. If it is ignored or filtered out, the window will remain open. 36 | * If it is not ignored or filtered, it is queued normally and the window 37 | * is allowed to close. When the window is closed, screen updates will 38 | * complete, but have no effect. 39 | * 40 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 41 | * and SIGTERM (system termination request), if handlers do not already 42 | * exist, that generate SDL_QUITEVENT events as well. There is no way 43 | * to determine the cause of an SDL_QUITEVENT, but setting a signal 44 | * handler in your application will override the default generation of 45 | * quit events for that signal. 46 | */ 47 | 48 | /** @file SDL_quit.h 49 | * There are no functions directly affecting the quit event 50 | */ 51 | 52 | #define SDL_QuitRequested() \ 53 | (SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK)) 54 | 55 | #endif /* _SDL_quit_h */ 56 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/include/SDL/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_types.h 24 | * @deprecated Use SDL_stdinc.h instead. 25 | */ 26 | 27 | /* DEPRECATED */ 28 | #include "SDL_stdinc.h" 29 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/include/SDL/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file close_code.h 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #undef _begin_code_h 30 | 31 | /** 32 | * @file close_code.h 33 | * Reset structure packing at previous byte alignment 34 | */ 35 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) 36 | #ifdef __BORLANDC__ 37 | #pragma nopackwarning 38 | #endif 39 | #if (defined(__MWERKS__) && defined(__MACOS__)) 40 | #pragma options align=reset 41 | #pragma enumsalwaysint reset 42 | #else 43 | #pragma pack(pop) 44 | #endif 45 | #endif /* Compiler needs structure packing set */ 46 | 47 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/._libSDL.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/._libSDL.dll.a -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/._libSDL.la: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/._libSDL.la -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/._libSDLmain.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/._libSDLmain.a -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/SDL.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/SDL.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/SDL_image.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/SDL_image.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/SDL_image.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/SDL_image.lib -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/SDL_ttf.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/SDL_ttf.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/SDL_ttf.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/SDL_ttf.lib -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/libSDL.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/libSDL.dll.a -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/libSDL.la: -------------------------------------------------------------------------------- 1 | # libSDL.la - a libtool library file 2 | # Generated by ltmain.sh (GNU libtool) 2.2.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='../bin/SDL.dll' 9 | 10 | # Names of this library. 11 | library_names='libSDL.dll.a' 12 | 13 | # The name of the static archive. 14 | old_library='' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -luser32 -lgdi32 -lwinmm -ldxguid' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libSDL. 26 | current=11 27 | age=11 28 | revision=4 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/usr/local/cross-tools/i686-w64-mingw32/lib' 42 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/libSDLmain.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/libSDLmain.a -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/libfreetype-6.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/libfreetype-6.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/libjpeg-8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/libjpeg-8.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/libpng15-15.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/libpng15-15.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/libtiff-5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/libtiff-5.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/libwebp-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/libwebp-2.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib/zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib/zlib1.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib64/SDL.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib64/SDL.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib64/libSDL.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib64/libSDL.a -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib64/libSDL.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib64/libSDL.dll.a -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib64/libSDL.la: -------------------------------------------------------------------------------- 1 | # libSDL.la - a libtool library file 2 | # Generated by ltmain.sh (GNU libtool) 2.2.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='../bin/SDL.dll' 9 | 10 | # Names of this library. 11 | library_names='libSDL.dll.a' 12 | 13 | # The name of the static archive. 14 | old_library='libSDL.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -luser32 -lgdi32 -lwinmm -ldxguid' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libSDL. 26 | current=11 27 | age=11 28 | revision=3 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/opt/cross_win64/lib' 42 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/mingw/lib64/libSDLmain.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/mingw/lib64/libSDLmain.a -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/include/SDL_active.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_active.h 25 | * Include file for SDL application focus event handling 26 | */ 27 | 28 | #ifndef _SDL_active_h 29 | #define _SDL_active_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | #include "begin_code.h" 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @name The available application states */ 41 | /*@{*/ 42 | #define SDL_APPMOUSEFOCUS 0x01 /**< The app has mouse coverage */ 43 | #define SDL_APPINPUTFOCUS 0x02 /**< The app has input focus */ 44 | #define SDL_APPACTIVE 0x04 /**< The application is active */ 45 | /*@}*/ 46 | 47 | /* Function prototypes */ 48 | /** 49 | * This function returns the current state of the application, which is a 50 | * bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and 51 | * SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to 52 | * see your application, otherwise it has been iconified or disabled. 53 | */ 54 | extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void); 55 | 56 | 57 | /* Ends C function definitions when using C++ */ 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | #include "close_code.h" 62 | 63 | #endif /* _SDL_active_h */ 64 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/include/SDL_byteorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_byteorder.h 25 | * @deprecated Use SDL_endian.h instead 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_endian.h" 30 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/include/SDL_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_h 24 | #define _SDL_config_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* Add any platform that doesn't build using the configure system */ 29 | #if defined(__DREAMCAST__) 30 | #include "SDL_config_dreamcast.h" 31 | #elif defined(__MACOS__) 32 | #include "SDL_config_macos.h" 33 | #elif defined(__MACOSX__) 34 | #include "SDL_config_macosx.h" 35 | #elif defined(__SYMBIAN32__) 36 | #include "SDL_config_symbian.h" /* must be before win32! */ 37 | #elif defined(__WIN32__) 38 | #include "SDL_config_win32.h" 39 | #elif defined(__OS2__) 40 | #include "SDL_config_os2.h" 41 | #else 42 | #include "SDL_config_minimal.h" 43 | #endif /* platform config */ 44 | 45 | #endif /* _SDL_config_h */ 46 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/include/SDL_config_minimal.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_minimal_h 24 | #define _SDL_config_minimal_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is the minimal configuration that can be used to build SDL */ 29 | 30 | #include 31 | 32 | typedef signed char int8_t; 33 | typedef unsigned char uint8_t; 34 | typedef signed short int16_t; 35 | typedef unsigned short uint16_t; 36 | typedef signed int int32_t; 37 | typedef unsigned int uint32_t; 38 | typedef unsigned int size_t; 39 | typedef unsigned long uintptr_t; 40 | 41 | /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ 42 | #define SDL_AUDIO_DRIVER_DUMMY 1 43 | 44 | /* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */ 45 | #define SDL_CDROM_DISABLED 1 46 | 47 | /* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ 48 | #define SDL_JOYSTICK_DISABLED 1 49 | 50 | /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ 51 | #define SDL_LOADSO_DISABLED 1 52 | 53 | /* Enable the stub thread support (src/thread/generic/\*.c) */ 54 | #define SDL_THREADS_DISABLED 1 55 | 56 | /* Enable the stub timer support (src/timer/dummy/\*.c) */ 57 | #define SDL_TIMERS_DISABLED 1 58 | 59 | /* Enable the dummy video driver (src/video/dummy/\*.c) */ 60 | #define SDL_VIDEO_DRIVER_DUMMY 1 61 | 62 | #endif /* _SDL_config_minimal_h */ 63 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/include/SDL_copying.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/include/SDL_cpuinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_cpuinfo.h 25 | * CPU feature detection for SDL 26 | */ 27 | 28 | #ifndef _SDL_cpuinfo_h 29 | #define _SDL_cpuinfo_h 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** This function returns true if the CPU has the RDTSC instruction */ 40 | extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); 41 | 42 | /** This function returns true if the CPU has MMX features */ 43 | extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); 44 | 45 | /** This function returns true if the CPU has MMX Ext. features */ 46 | extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void); 47 | 48 | /** This function returns true if the CPU has 3DNow features */ 49 | extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void); 50 | 51 | /** This function returns true if the CPU has 3DNow! Ext. features */ 52 | extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void); 53 | 54 | /** This function returns true if the CPU has SSE features */ 55 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); 56 | 57 | /** This function returns true if the CPU has SSE2 features */ 58 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); 59 | 60 | /** This function returns true if the CPU has AltiVec features */ 61 | extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); 62 | 63 | /* Ends C function definitions when using C++ */ 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #include "close_code.h" 68 | 69 | #endif /* _SDL_cpuinfo_h */ 70 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/include/SDL_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_error.h 25 | * Simple error message routines for SDL 26 | */ 27 | 28 | #ifndef _SDL_error_h 29 | #define _SDL_error_h 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * @name Public functions 41 | */ 42 | /*@{*/ 43 | extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...); 44 | extern DECLSPEC char * SDLCALL SDL_GetError(void); 45 | extern DECLSPEC void SDLCALL SDL_ClearError(void); 46 | /*@}*/ 47 | 48 | /** 49 | * @name Private functions 50 | * @internal Private error message function - used internally 51 | */ 52 | /*@{*/ 53 | #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) 54 | #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) 55 | typedef enum { 56 | SDL_ENOMEM, 57 | SDL_EFREAD, 58 | SDL_EFWRITE, 59 | SDL_EFSEEK, 60 | SDL_UNSUPPORTED, 61 | SDL_LASTERROR 62 | } SDL_errorcode; 63 | extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code); 64 | /*@}*/ 65 | 66 | /* Ends C function definitions when using C++ */ 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | #include "close_code.h" 71 | 72 | #endif /* _SDL_error_h */ 73 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/include/SDL_getenv.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_getenv.h 24 | * @deprecated Use SDL_stdinc.h instead 25 | */ 26 | 27 | /* DEPRECATED */ 28 | #include "SDL_stdinc.h" 29 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/include/SDL_name.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SDLname_h_ 3 | #define _SDLname_h_ 4 | 5 | #if defined(__STDC__) || defined(__cplusplus) 6 | #define NeedFunctionPrototypes 1 7 | #endif 8 | 9 | #define SDL_NAME(X) SDL_##X 10 | 11 | #endif /* _SDLname_h_ */ 12 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/include/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_quit.h 24 | * Include file for SDL quit event handling 25 | */ 26 | 27 | #ifndef _SDL_quit_h 28 | #define _SDL_quit_h 29 | 30 | #include "SDL_stdinc.h" 31 | #include "SDL_error.h" 32 | 33 | /** @file SDL_quit.h 34 | * An SDL_QUITEVENT is generated when the user tries to close the application 35 | * window. If it is ignored or filtered out, the window will remain open. 36 | * If it is not ignored or filtered, it is queued normally and the window 37 | * is allowed to close. When the window is closed, screen updates will 38 | * complete, but have no effect. 39 | * 40 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 41 | * and SIGTERM (system termination request), if handlers do not already 42 | * exist, that generate SDL_QUITEVENT events as well. There is no way 43 | * to determine the cause of an SDL_QUITEVENT, but setting a signal 44 | * handler in your application will override the default generation of 45 | * quit events for that signal. 46 | */ 47 | 48 | /** @file SDL_quit.h 49 | * There are no functions directly affecting the quit event 50 | */ 51 | 52 | #define SDL_QuitRequested() \ 53 | (SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK)) 54 | 55 | #endif /* _SDL_quit_h */ 56 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/include/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_types.h 24 | * @deprecated Use SDL_stdinc.h instead. 25 | */ 26 | 27 | /* DEPRECATED */ 28 | #include "SDL_stdinc.h" 29 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/include/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file close_code.h 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #undef _begin_code_h 30 | 31 | /** 32 | * @file close_code.h 33 | * Reset structure packing at previous byte alignment 34 | */ 35 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) 36 | #ifdef __BORLANDC__ 37 | #pragma nopackwarning 38 | #endif 39 | #if (defined(__MWERKS__) && defined(__MACOS__)) 40 | #pragma options align=reset 41 | #pragma enumsalwaysint reset 42 | #else 43 | #pragma pack(pop) 44 | #endif 45 | #endif /* Compiler needs structure packing set */ 46 | 47 | -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib/SDL.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib/SDL.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib/SDL.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib/SDL.lib -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib/SDL_image.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib/SDL_image.lib -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib/SDL_ttf.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib/SDL_ttf.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib/SDL_ttf.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib/SDL_ttf.lib -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib/SDLmain.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib/SDLmain.lib -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib/libfreetype-6.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib/libfreetype-6.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib/zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib/zlib1.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib64/SDL.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib64/SDL.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib64/SDL.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib64/SDL.lib -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib64/SDL_image.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib64/SDL_image.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib64/SDL_image.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib64/SDL_image.lib -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib64/SDL_ttf.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib64/SDL_ttf.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib64/SDL_ttf.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib64/SDL_ttf.lib -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib64/SDLmain.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib64/SDLmain.lib -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib64/libfreetype-6.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib64/libfreetype-6.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib64/libjpeg-8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib64/libjpeg-8.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib64/libpng15-15.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib64/libpng15-15.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib64/libtiff-5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib64/libtiff-5.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib64/libwebp-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib64/libwebp-2.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/msvc/lib64/zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdduke/three_cpp/c902f9eadeb4fbdeb9f662e88959f034efd89654/externals/sdl-1.2.15/msvc/lib64/zlib1.dll -------------------------------------------------------------------------------- /externals/sdl-1.2.15/xcode/SDLMain.h: -------------------------------------------------------------------------------- 1 | /* SDLMain.m - main entry point for our Cocoa-ized SDL app 2 | Initial Version: Darrell Walisser 3 | Non-NIB-Code & other changes: Max Horn 4 | 5 | Feel free to customize this file to suit your needs 6 | */ 7 | 8 | #ifndef _SDLMain_h_ 9 | #define _SDLMain_h_ 10 | 11 | #import 12 | 13 | @interface SDLMain : NSObject 14 | @end 15 | 16 | #endif /* _SDLMain_h_ */ 17 | -------------------------------------------------------------------------------- /three/cameras/camera.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_CAMERA_HPP 2 | #define THREE_CAMERA_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace three { 11 | 12 | class Camera : public Object3D { 13 | public: 14 | 15 | typedef std::shared_ptr Ptr; 16 | 17 | static Ptr create() { 18 | return three::make_shared(); 19 | } 20 | 21 | ///////////////////////////////////////////////////////////////////////// 22 | 23 | mutable Matrix4 matrixWorldInverse; 24 | Matrix4 projectionMatrix; 25 | mutable Matrix4 projectionMatrixInverse; 26 | 27 | float near, far; 28 | 29 | std::array _viewMatrixArray; 30 | std::array _projectionMatrixArray; 31 | 32 | ///////////////////////////////////////////////////////////////////////// 33 | 34 | void lookAt( const Vector3& vector ) override { 35 | matrix.lookAt( position, vector, up ); 36 | if ( rotationAutoUpdate ) { 37 | rotation = matrix.getEulerRotation( eulerOrder ); 38 | } 39 | } 40 | 41 | ///////////////////////////////////////////////////////////////////////// 42 | 43 | protected: 44 | 45 | Camera( float near = .1f, float far = 2000.f ) 46 | : Object3D(), near( near ), far( far ) { } 47 | 48 | ///////////////////////////////////////////////////////////////////////// 49 | 50 | THREE_IMPL_OBJECT(Camera) 51 | 52 | }; 53 | 54 | } // namespace three 55 | 56 | #endif // THREE_CAMERA_HPP -------------------------------------------------------------------------------- /three/cameras/orthographic_camera.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_ORTHOGRAPHIC_CAMERA_HPP 2 | #define THREE_ORTHOGRAPHIC_CAMERA_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class OrthographicCamera : public Camera { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | static Ptr create( float left, float right, float top, float bottom, float near = 0.1f, float far = 2000 ) { 16 | return make_shared( left, right, top, bottom, near, far ); 17 | } 18 | 19 | ///////////////////////////////////////////////////////////////////////// 20 | 21 | float left, right; 22 | float top, bottom; 23 | 24 | ///////////////////////////////////////////////////////////////////////// 25 | 26 | void updateProjectionMatrix() { 27 | projectionMatrix.makeOrthographic( left, right, top, bottom, near, far ); 28 | } 29 | 30 | ///////////////////////////////////////////////////////////////////////// 31 | 32 | protected: 33 | 34 | THREE_DECL OrthographicCamera( float left, float right, float top, float bottom, float near, float far ) 35 | : Camera( near, far ), left( left ), right( right ), top( top ), bottom( bottom ) { 36 | 37 | updateProjectionMatrix(); 38 | 39 | } 40 | 41 | }; 42 | 43 | } // namespace three 44 | 45 | #endif // THREE_ORTHOGRAPHIC_CAMERA_HPP -------------------------------------------------------------------------------- /three/common.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_COMMON_HPP 2 | #define THREE_COMMON_HPP 3 | 4 | #include 5 | #include 6 | 7 | #endif // THREE_COMMON_HPP 8 | -------------------------------------------------------------------------------- /three/console.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_CONSOLE_HPP 2 | #define THREE_CONSOLE_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace three { 11 | 12 | class Console { 13 | private: 14 | class LogProxy; 15 | 16 | public: 17 | 18 | typedef void( *LogP )( const char* ); 19 | 20 | static Console& instance() { 21 | static Console sConsole; 22 | return sConsole; 23 | } 24 | 25 | void info( const char* msg ) const { info() << msg; } 26 | void log( const char* msg ) const { log() << msg; } 27 | void debug( const char* msg ) const { debug() << msg; } 28 | void warn( const char* msg ) const { warn() << msg; } 29 | void error( const char* msg ) const { error() << msg; } 30 | 31 | LogProxy info() const { return LogProxy( output, "INFO: " ); } 32 | LogProxy log() const { return LogProxy( output, "LOG: " ); } 33 | LogProxy debug() const { return LogProxy( output, "DEBUG: " ); } 34 | LogProxy warn() const { return LogProxy( output, "WARN: " ); } 35 | LogProxy error() const { return LogProxy( output, "ERROR: " ); } 36 | 37 | void setLog( LogP log ) { output = log; } 38 | 39 | private: 40 | 41 | LogP output; 42 | 43 | class LogProxy { 44 | public: 45 | template 46 | LogProxy& operator<<( const T& rhs ) { 47 | *stream << rhs; 48 | return *this; 49 | } 50 | 51 | ~LogProxy() { 52 | if ( stream && log ) { 53 | log( stream->str().c_str() ); 54 | } 55 | } 56 | LogProxy( LogProxy && other ) 57 | : log( nullptr ) { 58 | std::swap( log, other.log ); 59 | std::swap( stream, other.stream ); 60 | } 61 | 62 | private: 63 | 64 | friend class Console; 65 | 66 | explicit LogProxy( LogP log, const char* msg = nullptr ) 67 | : stream( new std::stringstream() ), log( log ) { 68 | if ( msg ) { 69 | ( *this ) << msg; 70 | } 71 | } 72 | LogProxy& operator= ( LogProxy && other ) THREE_DECL_DELETE; 73 | LogProxy( const LogProxy& other ) THREE_DECL_DELETE; 74 | LogProxy& operator= ( const LogProxy& other ) THREE_DECL_DELETE; 75 | 76 | std::unique_ptr stream; 77 | LogP log; 78 | }; 79 | 80 | private: 81 | 82 | Console() : output( stdcout ) { } 83 | 84 | static void stdcout( const char* msg ) { std::cout << msg << std::endl; } 85 | }; 86 | 87 | static Console& console() { 88 | return Console::instance(); 89 | } 90 | 91 | 92 | } // namespace three 93 | 94 | #endif // THREE_CONSOLE_HPP 95 | -------------------------------------------------------------------------------- /three/core/bone.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_BONE_HPP 2 | #define THREE_BONE_HPP 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | namespace three { 10 | 11 | // TODO: 12 | class Bone { 13 | 14 | Bone( std::string name, 15 | Vector3 position, 16 | Quaternion quaternion, 17 | bool useQuaternion = true, 18 | Vector3 scale = Vector3( 1, 1, 1 ) ) 19 | : name( name ), 20 | position( position ), 21 | quaternion( quaternion ), 22 | useQuaternion( useQuaternion ), 23 | scale( scale ) { } 24 | 25 | std::string name; 26 | Vector3 position; 27 | Quaternion quaternion; 28 | bool useQuaternion; 29 | Vector3 scale; 30 | 31 | }; 32 | 33 | } // namespace three 34 | 35 | #endif // THREE_BONE_HPP 36 | -------------------------------------------------------------------------------- /three/core/buffer_geometry.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_BUFFER_GEOMETRY_HPP 2 | #define THREE_BUFFER_GEOMETRY_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | struct Offset { 11 | Offset() : start( 0 ), count( 0 ), index( 0 ) { } 12 | int start, count, index; 13 | }; 14 | 15 | class BufferGeometry : public Geometry { 16 | public: 17 | 18 | typedef std::shared_ptr Ptr; 19 | 20 | Ptr create() { return make_shared(); } 21 | 22 | virtual THREE::GeometryType type() const { return THREE::BufferGeometry; } 23 | 24 | ///////////////////////////////////////////////////////////////////////// 25 | 26 | std::vector offsets; 27 | 28 | ///////////////////////////////////////////////////////////////////////// 29 | 30 | THREE_DECL void applyMatrix( const Matrix4& matrix ); 31 | 32 | THREE_DECL void computeBoundingBox(); 33 | THREE_DECL void computeBoundingSphere(); 34 | THREE_DECL void computeVertexNormals(); 35 | THREE_DECL void computeTangents(); 36 | 37 | protected: 38 | 39 | THREE_DECL BufferGeometry(); 40 | 41 | }; 42 | 43 | } // namespace three 44 | 45 | #if defined(THREE_HEADER_ONLY) 46 | # include 47 | #endif // defined(THREE_HEADER_ONLY) 48 | 49 | #endif // THREE_BUFFER_GEOMETRY_HPP -------------------------------------------------------------------------------- /three/core/clock.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_CLOCK_HPP 2 | #define THREE_CLOCK_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class Clock { 11 | public: 12 | typedef std::chrono::time_point< std::chrono::system_clock > Time; 13 | typedef std::chrono::duration< float > Duration; 14 | 15 | Clock( bool autostart = true ) 16 | : mElapsedTime( Duration::zero() ), 17 | mbAutoStart( autostart ), 18 | mbRunning( false ) { } 19 | 20 | THREE_DECL void start() { 21 | mStartTime = std::chrono::system_clock::now(); 22 | mOldTime = mStartTime; 23 | mbRunning = true; 24 | } 25 | 26 | THREE_DECL void stop() { 27 | getElapsedTime(); 28 | mbRunning = false; 29 | } 30 | 31 | THREE_DECL float getElapsedTime() { 32 | mElapsedTime += getDelta(); 33 | return mElapsedTime.count(); 34 | } 35 | 36 | private: 37 | 38 | THREE_DECL Duration getDelta() { 39 | Duration diff; 40 | 41 | if ( mbAutoStart && !mbRunning ) { 42 | start(); 43 | } 44 | 45 | if ( mbRunning ) { 46 | auto newTime = std::chrono::system_clock::now(); 47 | diff = std::chrono::duration_cast< Duration > ( newTime - mOldTime ); 48 | mOldTime = newTime; 49 | } 50 | 51 | return diff; 52 | } 53 | 54 | Time mStartTime; 55 | Time mOldTime; 56 | Duration mElapsedTime; 57 | bool mbAutoStart; 58 | bool mbRunning; 59 | }; 60 | 61 | } // namespace three 62 | 63 | #endif // THREE_CLOCK_HPP 64 | -------------------------------------------------------------------------------- /three/core/event_target.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_EVENT_TARGET_HPP 2 | #define THREE_EVENT_TARGET_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | 8 | class EventTarget { 9 | public: 10 | 11 | // TODO: Implement 12 | 13 | /* 14 | var listeners = {}; 15 | 16 | template < typename T > 17 | void addEventListener ( type, listener ) { 18 | 19 | if ( listeners[ type ] === undefined ) { 20 | 21 | listeners[ type ] = []; 22 | 23 | } 24 | 25 | if ( listeners[ type ].indexOf( listener ) === - 1 ) { 26 | 27 | listeners[ type ].push( listener ); 28 | 29 | } 30 | 31 | } 32 | 33 | void dispatchEvent ( event ) { 34 | 35 | for ( var listener in listeners[ event.type ] ) { 36 | 37 | listeners[ event.type ][ listener ]( event ); 38 | 39 | } 40 | 41 | } 42 | 43 | void removeEventListener ( type, listener ) { 44 | 45 | var index = listeners[ type ].indexOf( listener ); 46 | 47 | if ( index !== - 1 ) { 48 | 49 | listeners[ type ].splice( index, 1 ); 50 | 51 | } 52 | 53 | } 54 | */ 55 | 56 | }; 57 | 58 | } // namespace three 59 | 60 | #endif // THREE_EVENT_TARGET_HPP -------------------------------------------------------------------------------- /three/core/face.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_FACE_HPP 2 | #define THREE_FACE_HPP 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | namespace three { 14 | 15 | class Face { 16 | public: 17 | 18 | Face( int a, int b, int c, const Vector3& normal = Vector3(), const Color& color = Color(), int materialIndex = -1 ) 19 | : a( a ), b( b ), c( c ), normal( normal ), color( color ), materialIndex( materialIndex ), mType( THREE::Face3 ), mSize( 3 ) { } 20 | 21 | Face( int a, int b, int c, const Vector3& n1, const Vector3& n2, const Vector3& n3, const Color& color = Color(), int materialIndex = -1 ) 22 | : a( a ), b( b ), c( c ), color( color ), materialIndex( materialIndex ), mType( THREE::Face3 ), mSize( 3 ) { 23 | vertexNormals[0] = n1; 24 | vertexNormals[1] = n2; 25 | vertexNormals[2] = n3; 26 | } 27 | 28 | Face( int a, int b, int c, int d, const Vector3& normal = Vector3(), const Color& color = Color(), int materialIndex = -1 ) 29 | : a( a ), b( b ), c( c ), d( d ), normal( normal ), color( color ), materialIndex( materialIndex ), mType( THREE::Face4 ), mSize( 4 ) { } 30 | 31 | Face( int a, int b, int c, int d, const Vector3& n1, const Vector3& n2, const Vector3& n3, const Vector3& n4, const Color& color = Color(), int materialIndex = -1 ) 32 | : a( a ), b( b ), c( c ), d( d ), color( color ), materialIndex( materialIndex ), mType( THREE::Face4 ), mSize( 3 ) { 33 | vertexNormals[0] = n1; 34 | vertexNormals[1] = n2; 35 | vertexNormals[2] = n3; 36 | vertexNormals[3] = n4; 37 | } 38 | 39 | THREE::FaceType type() const { 40 | return mType; 41 | } 42 | 43 | int size() const { 44 | return mSize; 45 | } 46 | 47 | Face clone() const { 48 | return Face( *this ); 49 | } 50 | 51 | public: 52 | 53 | union { 54 | struct { int a, b, c, d; }; 55 | int abcd[4]; 56 | }; 57 | 58 | Vector3 normal; 59 | std::array vertexNormals; 60 | 61 | Color color; 62 | std::array vertexColors; 63 | 64 | std::array vertexTangents; 65 | 66 | int materialIndex; 67 | 68 | Vector3 centroid; 69 | 70 | private: 71 | 72 | THREE::FaceType mType; 73 | int mSize; 74 | 75 | Face( ) THREE_DECL_DELETE; 76 | 77 | }; 78 | 79 | } // namespace three 80 | 81 | #endif // THREE_FACE_HPP -------------------------------------------------------------------------------- /three/core/face3.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_FACE3_HPP 2 | #define THREE_FACE3_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | 8 | typedef Face Face3; 9 | 10 | } 11 | 12 | #endif // THREE_FACE3_HPP -------------------------------------------------------------------------------- /three/core/face4.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_FACE4_HPP 2 | #define THREE_FACE4_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | 8 | typedef Face Face4; 9 | 10 | } 11 | 12 | #endif // THREE_FACE4_HPP -------------------------------------------------------------------------------- /three/core/frustum.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_FRUSTUM_HPP 2 | #define THREE_FRUSTUM_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace three { 13 | 14 | class Frustum : public NonCopyable { 15 | public: 16 | 17 | Frustum() { } 18 | Frustum( const Matrix4& m ) { setFromMatrix( m ); } 19 | 20 | THREE_DECL void setFromMatrix( const Matrix4& m ); 21 | THREE_DECL bool contains( const Object3D& object ) const; 22 | 23 | std::array planes; 24 | }; 25 | 26 | } // namespace three 27 | 28 | #if defined(THREE_HEADER_ONLY) 29 | # include 30 | #endif // defined(THREE_HEADER_ONLY) 31 | 32 | #endif // THREE_FRUSTUM_HPP -------------------------------------------------------------------------------- /three/core/geometry_group.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_GEOMETRY_GROUP_HPP 2 | #define THREE_GEOMETRY_GROUP_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace three { 13 | 14 | class GeometryGroup : public GeometryBuffer { 15 | public: 16 | 17 | typedef std::shared_ptr Ptr; 18 | 19 | static Ptr create( int materialIndex = -1, int numMorphTargets = 0, int numMorphNormals = 0 ) { 20 | return three::make_shared( materialIndex, numMorphTargets, numMorphNormals ); 21 | } 22 | 23 | typedef GeometryBuffer::GLBuffer GLBuffer; 24 | 25 | int id; 26 | 27 | std::vector> __morphNormalsArrays; 28 | std::vector> __morphTargetsArrays; 29 | 30 | std::vector faces3; 31 | std::vector faces4; 32 | 33 | std::vector offsets; 34 | 35 | GLBuffer vertexColorBuffer; 36 | GLBuffer vertexIndexBuffer; 37 | GLBuffer vertexNormalBuffer; 38 | GLBuffer vertexPositionBuffer; 39 | GLBuffer vertexUvBuffer; 40 | 41 | int vertices; 42 | 43 | protected: 44 | 45 | explicit GeometryGroup( int materialIndex = -1, int numMorphTargets = 0, int numMorphNormals = 0 ) 46 | : GeometryBuffer( numMorphTargets, numMorphNormals, materialIndex ), 47 | id( -1 ), 48 | vertexColorBuffer( 0 ), 49 | vertexIndexBuffer( 0 ), 50 | vertexNormalBuffer( 0 ), 51 | vertexPositionBuffer( 0 ), 52 | vertexUvBuffer( 0 ), 53 | vertices( 0 ) { } 54 | }; 55 | 56 | } // namespace three 57 | 58 | #endif // THREE_GEOMETRY_GROUP_HPP -------------------------------------------------------------------------------- /three/core/impl/frustum.ipp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_FRUSTUM_IPP 2 | #define THREE_FRUSTUM_IPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | #include 13 | 14 | namespace three { 15 | 16 | void Frustum::setFromMatrix( const Matrix4& m ) { 17 | 18 | const auto& me = m.elements; 19 | 20 | auto me0 = me[0], me1 = me[1], me2 = me[2], me3 = me[3]; 21 | auto me4 = me[4], me5 = me[5], me6 = me[6], me7 = me[7]; 22 | auto me8 = me[8], me9 = me[9], me10 = me[10], me11 = me[11]; 23 | auto me12 = me[12], me13 = me[13], me14 = me[14], me15 = me[15]; 24 | 25 | planes[ 0 ].set( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ); 26 | planes[ 1 ].set( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ); 27 | planes[ 2 ].set( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ); 28 | planes[ 3 ].set( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ); 29 | planes[ 4 ].set( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ); 30 | planes[ 5 ].set( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ); 31 | 32 | for ( auto& plane : planes ) { 33 | plane.divideScalar( Math::sqrt( plane.x * plane.x + plane.y * plane.y + plane.z * plane.z ) ); 34 | } 35 | 36 | } 37 | 38 | bool Frustum::contains( const Object3D& object ) const { 39 | 40 | if ( !object.geometry ) 41 | return false; 42 | 43 | auto distance = 0.0f; 44 | const auto& matrix = object.matrixWorld; 45 | const auto& me = matrix.elements; 46 | auto radius = -object.geometry->boundingSphere.radius * matrix.getMaxScaleOnAxis(); 47 | 48 | for ( int i = 0; i < 6; i ++ ) { 49 | distance = planes[ i ].x * me[12] + planes[ i ].y * me[13] + planes[ i ].z * me[14] + planes[ i ].w; 50 | if ( distance <= radius ) 51 | return false; 52 | } 53 | 54 | return true; 55 | 56 | } 57 | 58 | } // namespace three 59 | 60 | #endif // THREE_FRUSTUM_IPP -------------------------------------------------------------------------------- /three/core/interfaces.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_INTERFACES_HPP 2 | #define THREE_INTERFACES_HPP 3 | 4 | #include 5 | #include 6 | 7 | namespace three { 8 | 9 | class IFog { 10 | public: 11 | typedef std::shared_ptr Ptr; 12 | virtual THREE::FogType type() const = 0; 13 | virtual ~IFog() { } 14 | }; 15 | 16 | class IGeometry { 17 | public: 18 | virtual void applyMatrix( const Matrix4& ) = 0; 19 | virtual void computeBoundingBox() = 0; 20 | virtual void computeBoundingSphere() = 0; 21 | virtual void computeVertexNormals() = 0; 22 | virtual void computeTangents() = 0; 23 | virtual ~IGeometry() { } 24 | }; 25 | 26 | class IPlugin { 27 | public: 28 | typedef std::shared_ptr Ptr; 29 | virtual void init( GLRenderer& renderer ) = 0; 30 | virtual void update( Scene& scene, Camera& camera ) = 0; 31 | virtual void render( Scene& scene, Camera& camera, int width, int height ) = 0; 32 | virtual ~IPlugin() { } 33 | }; 34 | 35 | } 36 | 37 | #endif // THREE_INTERFACES_HPP -------------------------------------------------------------------------------- /three/core/matrix3.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_MATRIX3_HPP 2 | #define THREE_MATRIX3_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | 8 | class Matrix3 { 9 | public: 10 | 11 | union { 12 | float elements[9]; 13 | float te[9]; 14 | }; 15 | 16 | THREE_DECL Matrix3(); 17 | THREE_DECL Matrix3( float n11, float n12, float n13, 18 | float n21, float n22, float n23, 19 | float n31, float n32, float n33 ); 20 | THREE_DECL Matrix3( const Matrix3& other ); 21 | THREE_DECL Matrix3& operator= ( const Matrix3& other ); 22 | 23 | THREE_DECL Matrix3& getInverse( const Matrix4& m ); 24 | THREE_DECL Matrix3& transpose(); 25 | 26 | THREE_DECL const Matrix3& transposeIntoArray( float* r ) const; 27 | 28 | THREE_DECL Matrix3& set( float n11, float n12, float n13, 29 | float n21, float n22, float n23, 30 | float n31, float n32, float n33 ); 31 | THREE_DECL Matrix3& identity(); 32 | 33 | THREE_DECL Matrix3& copy( const Matrix3& m ); 34 | THREE_DECL Matrix3& copy( const Matrix4& m ); 35 | THREE_DECL Matrix3 clone(); 36 | 37 | }; 38 | 39 | } // namespace three 40 | 41 | #if defined(THREE_HEADER_ONLY) 42 | # include 43 | #endif // defined(THREE_HEADER_ONLY) 44 | 45 | #endif // THREE_MATRIX3_HPP -------------------------------------------------------------------------------- /three/core/projector.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_PROJECTOR_HPP 2 | #define THREE_PROJECTOR_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | 13 | #include 14 | 15 | namespace three { 16 | 17 | class Projector : public NonCopyable { 18 | public: 19 | 20 | THREE_DECL Projector(); 21 | 22 | THREE_DECL Vector3& projectVector( Vector3& vector, const Camera& camera ); 23 | THREE_DECL Vector3& unprojectVector( Vector3& vector, const Camera& camera ); 24 | 25 | THREE_DECL Ray pickingRay( Vector3 vector, const Camera& camera ); 26 | 27 | struct RenderData { 28 | // TODO: Fill these with pointers AFTER creating with the pool 29 | std::vector objects; 30 | std::vector sprites; 31 | std::vector lights; 32 | std::vector elements; 33 | }; 34 | 35 | THREE_DECL RenderData& projectGraph( Object3D& root, bool sort ); 36 | THREE_DECL RenderData& projectScene( Scene& scene, Camera& camera, bool sort ); 37 | 38 | struct Impl; 39 | 40 | protected: 41 | 42 | std::unique_ptr impl; 43 | 44 | }; 45 | 46 | } // namespace three 47 | 48 | #if defined(THREE_HEADER_ONLY) 49 | # include 50 | #endif // defined(THREE_HEADER_ONLY) 51 | 52 | #endif // THREE_PROJECTOR_HPP -------------------------------------------------------------------------------- /three/core/quaternion.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_QUATERNION_HPP 2 | #define THREE_QUATERNION_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | namespace three { 10 | 11 | class Quaternion { 12 | public: 13 | 14 | union { 15 | struct { float x, y, z, w; }; 16 | float xyzw[4]; 17 | }; 18 | 19 | Quaternion() : x( 0 ), y( 0 ), z( 0 ), w( 1.f ) { } 20 | Quaternion( float xIn, float yIn, float zIn, float wIn = 1.f ) : x( xIn ), y( yIn ), z( zIn ), w( wIn ) { } 21 | Quaternion( const Quaternion& v ) : x( v.x ), y( v.y ), z( v.z ), w( v.w ) { } 22 | Quaternion& operator= ( const Quaternion& v ) { return copy( v ); } 23 | 24 | Quaternion& set( float xIn, float yIn, float zIn, float wIn ) { 25 | x = xIn; 26 | y = yIn; 27 | z = zIn; 28 | w = wIn; 29 | return *this; 30 | } 31 | 32 | Quaternion& copy( const Quaternion& v ) { 33 | x = v.x; 34 | y = v.y; 35 | z = v.z; 36 | w = v.w; 37 | return *this; 38 | } 39 | 40 | THREE_DECL Vector3 getEuler( THREE::Order order = THREE::XYZ ) const; 41 | THREE_DECL Quaternion& setFromEuler( const Vector3& v, THREE::Order order = THREE::XYZ ); 42 | THREE_DECL Quaternion& setFromAxisAngle( const Vector3& axis, float angle ); 43 | THREE_DECL Quaternion& calculateW(); 44 | THREE_DECL Quaternion& inverse(); 45 | THREE_DECL float length() const; 46 | THREE_DECL Quaternion& normalize(); 47 | THREE_DECL Quaternion& multiply( const Quaternion& a, const Quaternion& b ); 48 | THREE_DECL Quaternion& multiplySelf( const Quaternion& b ); 49 | THREE_DECL Vector3 multiplyVector3( const Vector3& v ); 50 | THREE_DECL Quaternion& slerpSelf( const Quaternion& qb, float t ); 51 | 52 | Quaternion clone() { 53 | return *this; 54 | } 55 | 56 | private: 57 | 58 | THREE_DECL float lengthSq() const; 59 | THREE_DECL Quaternion& multiplyScalar( float s ); 60 | THREE_DECL Quaternion& divideScalar( float s ); 61 | 62 | }; 63 | 64 | } // namespace three 65 | 66 | #if defined(THREE_HEADER_ONLY) 67 | # include 68 | #endif // defined(THREE_HEADER_ONLY) 69 | 70 | #endif // THREE_QUATERNION_HPP -------------------------------------------------------------------------------- /three/core/uv.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_UV_HPP 2 | #define THREE_UV_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | 8 | class UV { 9 | public: 10 | 11 | union { 12 | struct { float u, v; }; 13 | float uv[2]; 14 | }; 15 | 16 | UV( float u = 0, float v = 0 ) 17 | : u( u ), v( v ) { } 18 | 19 | UV& set( float uIn, float vIn ) { 20 | 21 | u = uIn; 22 | v = vIn; 23 | 24 | return *this; 25 | 26 | } 27 | 28 | UV& copy( const UV& uv ) { 29 | 30 | u = uv.u; 31 | v = uv.v; 32 | 33 | return *this; 34 | 35 | } 36 | 37 | UV& lerpSelf( const UV& uv, float alpha ) { 38 | 39 | u += ( uv.u - u ) * alpha; 40 | v += ( uv.v - v ) * alpha; 41 | 42 | return *this; 43 | 44 | } 45 | 46 | UV clone() { 47 | 48 | return UV( *this ); 49 | 50 | } 51 | 52 | }; 53 | 54 | } // namespace three 55 | 56 | #endif // THREE_UV_HPP -------------------------------------------------------------------------------- /three/core/vertex.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_VERTEX_HPP 2 | #define THREE_VERTEX_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | //typedef Vector3 Vertex; 11 | 12 | } // namespace three 13 | 14 | #endif // THREE_VERTEX_HPP -------------------------------------------------------------------------------- /three/extras.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_EXTRAS_HPP 2 | #define THREE_EXTRAS_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #endif // THREE_EXTRAS_HPP -------------------------------------------------------------------------------- /three/extras/anim.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_ANIM_HPP 2 | #define THREE_ANIM_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | namespace anim { 8 | 9 | typedef std::function Update; 10 | typedef std::function Render; 11 | 12 | THREE_DECL void gameLoop( Update update, float frameRate = 60 ); 13 | THREE_DECL void gameLoop( Update update, Render render, float frameRate = 60 ); 14 | 15 | } // namespace anim 16 | } // namespace three 17 | 18 | #if defined(THREE_HEADER_ONLY) 19 | # include 20 | #endif // defined(THREE_HEADER_ONLY) 21 | 22 | #endif // THREE_ANIM_HPP -------------------------------------------------------------------------------- /three/extras/events.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_EVENTS_HPP 2 | #define THREE_EVENTS_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | namespace events { 8 | 9 | enum EventType { 10 | KeyDownEvent = 0, 11 | KeyUpEvent, 12 | MouseDownEvent, 13 | MouseUpEvent, 14 | MouseMoveEvent, 15 | MouseScrollEvent, 16 | ResizeEvent, 17 | QuitEvent 18 | }; 19 | 20 | enum MouseButtonType { 21 | LeftMouseButton = 0, 22 | MiddleMouseButton, 23 | RightMouseButton, 24 | ScrollMouseButton 25 | }; 26 | 27 | struct KeyboardEvent { 28 | char type; 29 | char state; 30 | }; 31 | 32 | } 33 | 34 | class EventHandler { 35 | public: 36 | THREE_DECL static EventHandler& instance(); 37 | 38 | THREE_DECL EventKey addEventListener( EventType, EventListener ) = 0; 39 | THREE_DECL void removeEventListener( EventKey ) = 0; 40 | THREE_DECL void clearEventListeners() = 0; 41 | THREE_DECL void processEvents() = 0; 42 | }; 43 | 44 | ///////////////////////////////////////////////////////////////////////// 45 | 46 | class ScopedEventListener : public NonCopyable { 47 | public: 48 | THREE_DECL ScopedEventListener( EventType, EventListener ); 49 | THREE_DECL ~ScopedEventListener(); 50 | private: 51 | EventKey eventKey; 52 | }; 53 | 54 | } // namespace sdl 55 | } // namespace three 56 | 57 | #if defined(THREE_HEADER_ONLY) 58 | # include 59 | #endif // defined(THREE_HEADER_ONLY) 60 | 61 | #endif // THREE_SDL_HPP -------------------------------------------------------------------------------- /three/extras/geometries/impl/text_2d_geometry.ipp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_TEXT_2D_GEOMETRY_IPP 2 | #define THREE_TEXT_2D_GEOMETRY_IPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | Text2DGeometry::Ptr Text2DGeometry::create( const std::string& text, 11 | const Font::Ptr& font ) { 12 | 13 | auto geometry = three::make_shared( text, font ); 14 | geometry->update(); 15 | 16 | return geometry; 17 | } 18 | 19 | ///////////////////////////////////////////////////////////////////////// 20 | 21 | Text2DGeometry::Text2DGeometry( const std::string& text, 22 | const Font::Ptr& font ) 23 | : Geometry(), text( text ), font( font ) { } 24 | 25 | #ifdef TODO_THREE_DYNAMIC_GEOMETRY 26 | void Text2DGeometry::update( const std::string& text ) { 27 | 28 | if ( this->text == text ) 29 | return; 30 | 31 | this->text = text; 32 | 33 | update(); 34 | 35 | } 36 | #endif 37 | 38 | void Text2DGeometry::update() { 39 | 40 | if ( !font ) { 41 | console().warn( "Text2DGeometry: Invalid font" ); 42 | return; 43 | } 44 | 45 | font->generate( text, 46 | vertices, 47 | faces, 48 | faceVertexUvs[ 0 ] ); 49 | 50 | computeCentroids(); 51 | 52 | verticesNeedUpdate = true; 53 | uvsNeedUpdate = true; 54 | 55 | } 56 | 57 | } // namespace three 58 | 59 | #endif // THREE_TEXT_2D_GEOMETRY_IPP -------------------------------------------------------------------------------- /three/extras/geometries/text_2d_geometry.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_TEXT_2D_GEOMETRY_HPP 2 | #define THREE_TEXT_2D_GEOMETRY_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class Text2DGeometry : public Geometry { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | THREE_DECL static Ptr create( const std::string& text, 16 | const Font::Ptr& font ); 17 | 18 | #ifdef TODO_THREE_DYNAMIC_GEOMETRY 19 | THREE_DECL void update( const std::string& text ); 20 | #endif 21 | 22 | protected: 23 | 24 | THREE_DECL Text2DGeometry( const std::string& text, 25 | const Font::Ptr& font ); 26 | 27 | THREE_DECL void update(); 28 | 29 | std::string text; 30 | Font::Ptr font; 31 | 32 | }; 33 | 34 | } // namespace three 35 | 36 | #if defined(THREE_HEADER_ONLY) 37 | # include 38 | #endif // defined(THREE_HEADER_ONLY) 39 | 40 | #endif // THREE_TEXT_2D_GEOMETRY_HPP -------------------------------------------------------------------------------- /three/extras/glew.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_GLEW_HPP 2 | #define THREE_GLEW_HPP 3 | 4 | #include 5 | #include 6 | 7 | namespace three { 8 | namespace glew { 9 | 10 | inline bool init( RendererParameters& parameters ) { 11 | 12 | auto err = glewInit(); 13 | 14 | if ( GLEW_OK != err ) { 15 | console().error() << "Error initializing glew: " << glewGetErrorString( err ); 16 | return false; 17 | } 18 | 19 | console().log() << "GLEW initialized"; 20 | 21 | return true; 22 | } 23 | 24 | } // namespace glew 25 | } // namespace three 26 | 27 | #endif // THREE_GLEW_HPP -------------------------------------------------------------------------------- /three/extras/image_utils.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_IMAGE_UTILS_HPP 2 | #define THREE_IMAGE_UTILS_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class ImageUtils { 11 | public: 12 | 13 | THREE_DECL static Texture::Ptr loadTexture( 14 | const std::string& url 15 | //,THREE::Mapping mapping = THREE::UVMapping 16 | ); 17 | 18 | THREE_DECL static Texture::Ptr loadCompressedTexture( 19 | const std::string& url, 20 | THREE::Mapping mapping = THREE::UVMapping 21 | ); 22 | 23 | THREE_DECL static Texture::Ptr generateDataTexture( 24 | int width, 25 | int height, 26 | Color color 27 | ); 28 | 29 | #ifdef TODO_LOAD_TEXTURE_CUBE 30 | 31 | THREE_DECL static Texture::Ptr loadTextureCube( 32 | std::array array, 33 | THREE::Mapping mapping = THREE::UVMapping 34 | ); 35 | 36 | THREE_DECL static Texture::Ptr loadCompressedTextureCube( 37 | std::array array, 38 | THREE::Mapping mapping = THREE::UVMapping 39 | ); 40 | 41 | #endif // TODO_LOAD_TEXTURE_CUBE 42 | 43 | }; // ImageUtils 44 | 45 | } // namespace three 46 | 47 | #if defined(THREE_HEADER_ONLY) 48 | # include 49 | #endif // defined(THREE_HEADER_ONLY) 50 | 51 | #endif // THREE_IMAGE_UTILS_HPP 52 | -------------------------------------------------------------------------------- /three/extras/impl/anim.ipp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_ANIM_IPP 2 | #define THREE_ANIM_IPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | 13 | namespace three { 14 | namespace anim { 15 | 16 | namespace detail { 17 | 18 | typedef std::function Callback; 19 | 20 | class ScopedTimer : public NonCopyable{ 21 | public: 22 | 23 | ScopedTimer( Clock& clock, Callback callback ) 24 | : clock( clock ), startTime( clock.getElapsedTime() ), callback ( std::move( callback ) ) { } 25 | 26 | ~ScopedTimer() { 27 | if ( callback ) 28 | callback( clock.getElapsedTime() - startTime ); 29 | } 30 | 31 | private: 32 | Clock& clock; 33 | float startTime; 34 | Callback callback; 35 | }; 36 | 37 | class AnimFrameRequest : public NonCopyable { 38 | public: 39 | AnimFrameRequest( float frameRate = 60 ) 40 | : targetDeltaTime( 1.f / frameRate ), 41 | lastTime( clock.getElapsedTime() ) { } 42 | 43 | Clock clock; 44 | float targetDeltaTime; 45 | float lastTime; 46 | 47 | bool operator()( const Update& update ) { 48 | 49 | detail::ScopedTimer onFrameEnd( clock, [this]( float deltaTime ) { 50 | // Throttle the thread at the end of the frame 51 | auto sleepTime = targetDeltaTime - deltaTime; 52 | if ( sleepTime > 0 ) { 53 | std::this_thread::sleep_for( std::chrono::milliseconds( ( int )( sleepTime * 1000 ) ) ); 54 | } 55 | } ); 56 | 57 | sdl::processEvents(); 58 | 59 | { 60 | auto time = clock.getElapsedTime(); 61 | auto deltaTime = time - lastTime; 62 | lastTime = time; 63 | 64 | if ( !update( deltaTime ) ) 65 | return false; 66 | } 67 | 68 | sdl::swapBuffers(); 69 | 70 | return true; 71 | 72 | } 73 | 74 | }; // AnimFrameRequest 75 | 76 | } // namespace detail 77 | 78 | ///////////////////////////////////////////////////////////////////////// 79 | 80 | void gameLoop( Update update, float frameRate /*= 60*/ ) { 81 | detail::AnimFrameRequest requestAnimFrame( frameRate ); 82 | while ( requestAnimFrame( update ) ) ; 83 | } 84 | 85 | void gameLoop( Update update, Render render, float frameRate /*= 60*/ ) { 86 | return gameLoop( [&]( float dt ) { 87 | return update( dt ) && render( dt ); 88 | }, frameRate ); 89 | } 90 | 91 | } // namespace anim 92 | } // namespace three 93 | 94 | #endif // THREE_ANIM_IPP -------------------------------------------------------------------------------- /three/extras/sdl.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_SDL_HPP 2 | #define THREE_SDL_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | namespace three { 15 | namespace sdl { 16 | 17 | typedef SDL_Event Event; 18 | typedef SDL_EventType EventType; 19 | typedef std::pair EventKey; 20 | typedef std::function EventListener; 21 | 22 | ///////////////////////////////////////////////////////////////////////// 23 | 24 | THREE_DECL bool init( RendererParameters& parameters ); 25 | THREE_DECL bool swapBuffers(); 26 | THREE_DECL void quit(); 27 | 28 | ///////////////////////////////////////////////////////////////////////// 29 | 30 | THREE_DECL EventKey addEventListener( EventType, EventListener ); 31 | THREE_DECL void removeEventListener( EventKey ); 32 | THREE_DECL void clearEventListeners(); 33 | THREE_DECL void processEvents(); 34 | 35 | ///////////////////////////////////////////////////////////////////////// 36 | 37 | class ScopedEventListener : public NonCopyable { 38 | public: 39 | THREE_DECL ScopedEventListener( EventType, EventListener ); 40 | THREE_DECL ~ScopedEventListener(); 41 | private: 42 | EventKey eventKey; 43 | }; 44 | 45 | } // namespace sdl 46 | } // namespace three 47 | 48 | #if defined(THREE_HEADER_ONLY) 49 | # include 50 | #endif // defined(THREE_HEADER_ONLY) 51 | 52 | #endif // THREE_SDL_HPP 53 | -------------------------------------------------------------------------------- /three/extras/stats.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_STATS_HPP 2 | #define THREE_STATS_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | class GLRenderer; 10 | 11 | namespace stats { 12 | 13 | class Stats : public NonCopyable { 14 | public: 15 | THREE_DECL Stats( GLRenderer& renderer ); 16 | THREE_DECL ~Stats(); 17 | 18 | THREE_DECL void update( float deltaTime, bool render = true ); 19 | 20 | private: 21 | 22 | struct Impl; 23 | std::unique_ptr impl; 24 | }; 25 | 26 | } // namespace stats 27 | } // namespace three 28 | 29 | #if defined(THREE_HEADER_ONLY) 30 | # include 31 | #endif // defined(THREE_HEADER_ONLY) 32 | 33 | #endif // THREE_ANIM_HPP -------------------------------------------------------------------------------- /three/extras/utils/font.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_FONT_HPP 2 | #define THREE_FONT_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | namespace three { 15 | 16 | class Font : NonCopyable { 17 | public: 18 | 19 | typedef std::shared_ptr Ptr; 20 | 21 | THREE_DECL static Ptr create( const std::string& ttf, 22 | float fontSize = 30, 23 | int textureWidth = 512, 24 | int textureHeight = 512, 25 | int firstCharacter = 32, 26 | int countCharacter = 96 ); 27 | 28 | THREE_DECL void generate( const std::string& text, 29 | std::vector& vertices, 30 | std::vector& faces, 31 | std::vector>& faceUvs ); 32 | 33 | THREE_DECL const Texture::Ptr& texture() const; 34 | 35 | THREE_DECL ~Font(); 36 | 37 | protected: 38 | 39 | THREE_DECL Font(); 40 | THREE_DECL bool initialize( const std::string& ttf, 41 | float fontSize, 42 | int textureWidth, 43 | int textureHeight, 44 | int firstCharacter, 45 | int countCharacter ); 46 | 47 | private: 48 | struct Impl; 49 | std::unique_ptr impl; 50 | 51 | }; 52 | 53 | } // namespace three 54 | 55 | #if defined(THREE_HEADER_ONLY) 56 | # include 57 | #endif // defined(THREE_HEADER_ONLY) 58 | 59 | #endif // THREE_FONT_HPP -------------------------------------------------------------------------------- /three/fwd.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_FWD_HPP 2 | #define THREE_FWD_HPP 3 | 4 | namespace three { 5 | 6 | class Object3D; 7 | class Bone; 8 | class Camera; 9 | class Light; 10 | class Scene; 11 | class Particle; 12 | class Sprite; 13 | class Mesh; 14 | class Face; 15 | class Line; 16 | class Rectangle; 17 | class Color; 18 | class Vector2; 19 | class Vector3; 20 | class Vector4; 21 | class Matrix4; 22 | class Quaternion; 23 | class Ray; 24 | class Frustum; 25 | 26 | class Visitor; 27 | class ConstVisitor; 28 | 29 | class Font; 30 | 31 | class RenderableFace; 32 | class RenderableObject; 33 | class RenderableLine; 34 | class RenderableParticle; 35 | class RenderableVertex; 36 | 37 | class Spline; 38 | 39 | class BufferGeometry; 40 | class Geometry; 41 | class GeometryBuffer; 42 | class GeometryGroup; 43 | //class Vertex; 44 | typedef Vector3 Vertex; 45 | class Material; 46 | class Program; 47 | class Texture; 48 | class Shader; 49 | class Uniform; 50 | 51 | class GLRenderer; 52 | 53 | template < typename Key, typename Value > 54 | class Properties; 55 | 56 | } // namespace three 57 | 58 | #endif // THREE_FWD_HPP -------------------------------------------------------------------------------- /three/impl/src.cpp: -------------------------------------------------------------------------------- 1 | // Included once for non-header-only compilation 2 | #include -------------------------------------------------------------------------------- /three/impl/src.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_SRC_HPP 2 | #define THREE_SRC_HPP 3 | 4 | #include 5 | 6 | #if defined(THREE_HEADER_ONLY) 7 | # error Do not compile Three.cpp library source with THREE_HEADER_ONLY defined 8 | #endif 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | #endif -------------------------------------------------------------------------------- /three/impl/src_extras.cpp: -------------------------------------------------------------------------------- 1 | // Included once for non-header-only compilation 2 | #include -------------------------------------------------------------------------------- /three/impl/src_extras.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_SRC_EXTRAS_HPP 2 | #define THREE_SRC_EXTRAS_HPP 3 | 4 | #include 5 | 6 | #if defined(THREE_HEADER_ONLY) 7 | # error Do not compile Three.cpp library source with THREE_HEADER_ONLY defined 8 | #endif 9 | 10 | #include 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | 20 | #endif -------------------------------------------------------------------------------- /three/lights/ambient_light.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_AMBIENT_LIGHT_HPP 2 | #define THREE_AMBIENT_LIGHT_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class AmbientLight : public Light { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | static Ptr create( int hex ) { return make_shared( hex ); } 16 | 17 | virtual THREE::Type type() const { return THREE::AmbientLight; } 18 | 19 | protected: 20 | 21 | AmbientLight( int hex ) : Light( hex ) { } 22 | 23 | }; 24 | 25 | } // namespace three 26 | 27 | #endif // THREE_AMBIENT_LIGHT_HPP -------------------------------------------------------------------------------- /three/lights/directional_light.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_DIRECTIONAL_LIGHT_HPP 2 | #define THREE_DIRECTIONAL_LIGHT_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class DirectionalLight : public Light { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | static Ptr create( int hex, float intensity = 1, float distance = 0 ) { 16 | return make_shared( hex, intensity, distance ); 17 | } 18 | 19 | virtual THREE::Type type() const { return THREE::DirectionalLight; } 20 | 21 | ///////////////////////////////////////////////////////////////////////// 22 | 23 | float shadowCameraNear; 24 | float shadowCameraFar; 25 | 26 | float shadowCameraLeft; 27 | float shadowCameraRight; 28 | float shadowCameraTop; 29 | float shadowCameraBottom; 30 | 31 | bool shadowCameraVisible; 32 | 33 | float shadowBias; 34 | float shadowDarkness; 35 | 36 | int shadowMapWidth; 37 | int shadowMapHeight; 38 | 39 | Vector3 shadowCascadeOffset; 40 | int shadowCascadeCount; 41 | 42 | std::array shadowCascadeBias; 43 | std::array shadowCascadeWidth; 44 | std::array shadowCascadeHeight; 45 | 46 | Vector3 shadowCascadeNearZ; 47 | Vector3 shadowCascadeFarZ; 48 | 49 | std::vector shadowCascadeArray; 50 | 51 | // 52 | 53 | Texture::Ptr shadowMap; 54 | std::array shadowMapSize; 55 | Camera::Ptr shadowCamera; 56 | Matrix4 shadowMatrix; 57 | 58 | ///////////////////////////////////////////////////////////////////////// 59 | 60 | protected: 61 | 62 | DirectionalLight( int hex, float intensity, float distance ) 63 | : Light( hex, intensity, distance ), 64 | shadowCameraNear( 50 ), shadowCameraFar( 5000 ), 65 | shadowCameraLeft( -500 ), shadowCameraRight( 500 ), 66 | shadowCameraTop( 500 ), shadowCameraBottom( -500 ), 67 | shadowCameraVisible( false ), 68 | shadowBias( 0 ), 69 | shadowDarkness( 0.5 ), 70 | shadowMapWidth( 512 ), 71 | shadowMapHeight( 512 ), 72 | shadowCascadeOffset( 0, 0, -1000 ), 73 | shadowCascadeCount( 2 ), 74 | shadowCascadeNearZ( -1.f, 0.99f, 0.998f ), 75 | shadowCascadeFarZ( 0.99f, 0.998f, 1.f ) { 76 | 77 | shadowCascadeBias.fill( 0 ); 78 | shadowCascadeWidth.fill( 512 ); 79 | shadowCascadeHeight.fill( 512 ); 80 | 81 | target = Object3D::create(); 82 | 83 | position.set( 0, 1, 0 ); 84 | 85 | } 86 | 87 | }; 88 | 89 | } // namespace three 90 | 91 | #endif // THREE_DIRECTIONAL_LIGHT_HPP -------------------------------------------------------------------------------- /three/lights/hemisphere_light.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_HEMISPHERE_LIGHT_HPP 2 | #define THREE_HEMISPHERE_LIGHT_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class HemisphereLight : public Light { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | static Ptr create( int skyColorHex, int groundColorHex, float intensity = 1 ) { 16 | return make_shared( skyColorHex, groundColorHex, intensity ); 17 | } 18 | 19 | virtual THREE::Type type() const { return THREE::HemisphereLight; } 20 | 21 | ////////////////////////////////////////////////////////////////////////// 22 | 23 | Color groundColor; 24 | 25 | ////////////////////////////////////////////////////////////////////////// 26 | 27 | protected: 28 | 29 | HemisphereLight( int skyColorHex, int groundColorHex, float intensity ) 30 | : Light( skyColorHex, intensity ), 31 | groundColor( groundColorHex ) { 32 | 33 | position = Vector3( 0, 100, 0 ); 34 | 35 | } 36 | 37 | }; 38 | 39 | } // namespace three 40 | 41 | #endif // THREE_HEMISPHERE_LIGHT_HPP -------------------------------------------------------------------------------- /three/lights/light.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_LIGHT_HPP 2 | #define THREE_LIGHT_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace three { 11 | 12 | class Light : public Object3D { 13 | public: 14 | 15 | typedef std::shared_ptr Ptr; 16 | 17 | virtual THREE::Type type() const { return THREE::Light; } 18 | 19 | ///////////////////////////////////////////////////////////////////////// 20 | 21 | Color color; 22 | float intensity; 23 | float distance; 24 | 25 | Object3D::Ptr target; 26 | 27 | bool castShadow, onlyShadow, shadowCascade; 28 | 29 | ///////////////////////////////////////////////////////////////////////// 30 | 31 | protected: 32 | 33 | explicit Light( int hex, float intensity = 1, float distance = 0 ) 34 | : Object3D(), 35 | color( hex ), 36 | intensity( intensity ), 37 | distance( distance ), 38 | target( nullptr ), 39 | castShadow( false ), 40 | onlyShadow( false ), 41 | shadowCascade( false ) { } 42 | 43 | virtual void visit( Visitor& v ) { v( *this ); } 44 | virtual void visit( ConstVisitor& v ) const { v( *this ); } 45 | 46 | }; 47 | 48 | } // namespace three 49 | 50 | #endif // THREE_LIGHT_HPP -------------------------------------------------------------------------------- /three/lights/point_light.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_POINT_LIGHT_HPP 2 | #define THREE_POINT_LIGHT_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class PointLight : public Light { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | static Ptr create( int hex, float intensity = 1, float distance = 0 ) { 16 | return make_shared( hex, intensity, distance ); 17 | } 18 | 19 | virtual THREE::Type type() const { return THREE::PointLight; } 20 | 21 | protected: 22 | 23 | PointLight( int hex, float intensity, float distance ) 24 | : Light( hex, intensity, distance ) { 25 | 26 | position.set( 0, 0, 0 ); 27 | 28 | } 29 | 30 | }; 31 | 32 | } // namespace three 33 | 34 | #endif // THREE_POINT_LIGHT_HPP -------------------------------------------------------------------------------- /three/lights/spot_light.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_SPOT_LIGHT_HPP 2 | #define THREE_SPOT_LIGHT_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class SpotLight : public Light { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | static Ptr create( int hex, float intensity = 1, float distance = 0, float angle = Math::PI() / 2, float exponent = 10 ) { 16 | return make_shared( hex, intensity, distance, angle, exponent ); 17 | } 18 | 19 | virtual THREE::Type type() const { return THREE::SpotLight; } 20 | 21 | ///////////////////////////////////////////////////////////////////////// 22 | 23 | float angle; 24 | float exponent; 25 | 26 | float shadowCameraNear; 27 | float shadowCameraFar; 28 | float shadowCameraFov; 29 | 30 | bool shadowCameraVisible; 31 | 32 | float shadowBias; 33 | float shadowDarkness; 34 | 35 | int shadowMapWidth; 36 | int shadowMapHeight; 37 | 38 | // TODO: 39 | 40 | // shadowMap = null; 41 | //this.shadowMapSize = null; 42 | //this.shadowCamera = null; 43 | //this.shadowMatrix = null; 44 | 45 | ///////////////////////////////////////////////////////////////////////// 46 | 47 | protected: 48 | 49 | SpotLight( int hex, float intensity, float distance, float angle, float exponent ) 50 | : Light( hex, intensity, distance ), 51 | angle( angle ), exponent( exponent ), 52 | shadowCameraNear( 50 ), shadowCameraFar( 5000 ), shadowCameraFov( 50 ), 53 | shadowCameraVisible( false ), 54 | shadowBias( 0 ), 55 | shadowDarkness( 0.5 ), 56 | shadowMapWidth( 512 ), 57 | shadowMapHeight( 512 ) { 58 | 59 | position.set( 0, 1, 0 ); 60 | 61 | } 62 | 63 | }; 64 | 65 | } // namespace three 66 | 67 | #endif // THREE_SPOT_LIGHT_HPP -------------------------------------------------------------------------------- /three/loaders/image_loader.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.ImageLoader = function() { 6 | 7 | THREE.EventTarget.call( this ); 8 | 9 | this.crossOrigin = null; 10 | 11 | }; 12 | 13 | THREE.ImageLoader.prototype = { 14 | 15 | constructor: THREE.ImageLoader, 16 | 17 | load: function( url, image ) { 18 | 19 | var scope = this; 20 | 21 | if ( image == = undefined ) image = new Image(); 22 | 23 | image.addEventListener( 'load', function() { 24 | 25 | scope.dispatchEvent( { type: 'load', content: image } ); 26 | 27 | }, false ); 28 | 29 | image.addEventListener( 'error', function() { 30 | 31 | scope.dispatchEvent( { type: 'error', message: 'Couldn\'t load URL [' + url + ']' } ); 32 | 33 | }, false ); 34 | 35 | if ( scope.crossOrigin ) image.crossOrigin = scope.crossOrigin; 36 | 37 | image.src = url; 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /three/loaders/loader_monitor.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.LoadingMonitor = function() { 6 | 7 | THREE.EventTarget.call( this ); 8 | 9 | var scope = this; 10 | 11 | var loaded = 0; 12 | var total = 0; 13 | 14 | var onLoad = function( event ) { 15 | 16 | loaded ++; 17 | 18 | scope.dispatchEvent( { type: 'progress', loaded: loaded, total: total } ); 19 | 20 | if ( loaded == = total ) { 21 | 22 | scope.dispatchEvent( { type: 'load' } ); 23 | 24 | } 25 | 26 | }; 27 | 28 | this.add = function( loader ) { 29 | 30 | total ++; 31 | 32 | loader.addEventListener( 'load', onLoad, false ); 33 | 34 | }; 35 | 36 | }; 37 | -------------------------------------------------------------------------------- /three/loaders/texture_loader.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.TextureLoader = function() { 6 | 7 | THREE.EventTarget.call( this ); 8 | 9 | this.crossOrigin = null; 10 | 11 | }; 12 | 13 | THREE.TextureLoader.prototype = { 14 | 15 | constructor: THREE.TextureLoader, 16 | 17 | load: function( url ) { 18 | 19 | var scope = this; 20 | 21 | var image = new Image(); 22 | 23 | image.addEventListener( 'load', function() { 24 | 25 | var texture = new THREE.Texture( image ); 26 | texture.needsUpdate = true; 27 | 28 | scope.dispatchEvent( { type: 'load', content: texture } ); 29 | 30 | }, false ); 31 | 32 | image.addEventListener( 'error', function() { 33 | 34 | scope.dispatchEvent( { type: 'error', message: 'Couldn\'t load URL [' + url + ']' } ); 35 | 36 | }, false ); 37 | 38 | if ( scope.crossOrigin ) image.crossOrigin = scope.crossOrigin; 39 | 40 | image.src = url; 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /three/materials/impl/text_2d_material.ipp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_TEXT_2D_MATERIAL_IPP 2 | #define THREE_TEXT_2D_MATERIAL_IPP 3 | 4 | #include 5 | 6 | #include 7 | namespace three { 8 | 9 | namespace detail { 10 | 11 | inline const char* textVertexShader() { 12 | return 13 | "\ 14 | varying vec2 vUv;\ 15 | void main() {\ 16 | vUv = uv;\ 17 | vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ 18 | gl_Position = projectionMatrix * mvPosition;\ 19 | }\ 20 | "; 21 | } 22 | 23 | inline const char* textFragmentShader() { 24 | return 25 | "\ 26 | uniform sampler2D texture;\ 27 | uniform vec3 diffuse;\ 28 | uniform float opacity;\ 29 | varying vec2 vUv;\ 30 | void main() {\ 31 | float texOpacity = texture2D( texture, vUv ).a;\ 32 | gl_FragColor = vec4( diffuse, opacity * texOpacity );\ 33 | }\ 34 | "; 35 | } 36 | 37 | } 38 | 39 | ShaderMaterial::Ptr Text2DMaterial::create( const Font& font, 40 | const Color& color, 41 | float opacity ) { 42 | 43 | auto material = ShaderMaterial::create( 44 | std::string(detail::textVertexShader()), 45 | std::string(detail::textFragmentShader()), 46 | Uniforms().add( UniformKey::diffuse(), Uniform( THREE::c, color ) ) 47 | .add( UniformKey::opacity(), Uniform( THREE::f, opacity ) ) 48 | .add( "texture", Uniform( THREE::t, font.texture().get() ) ) 49 | ); 50 | 51 | //material->map = font.texture(); 52 | material->depthTest = material->depthWrite = false; 53 | material->side = THREE::NoSide; 54 | material->transparent = true; 55 | 56 | return material; 57 | 58 | } 59 | 60 | } // namespace three 61 | 62 | #endif // THREE_TEXT_2D_MATERIAL_IPP 63 | 64 | -------------------------------------------------------------------------------- /three/materials/line_basic_material.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_LINE_BASIC_MATERIAL_HPP 2 | #define THREE_LINE_BASIC_MATERIAL_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class LineBasicMaterial : public Material { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | static Ptr create( const Parameters& parameters = Parameters() ) { 16 | return three::make_shared( parameters ); 17 | } 18 | 19 | virtual THREE::MaterialType type() const { return THREE::LineBasicMaterial; } 20 | 21 | ///////////////////////////////////////////////////////////////////////// 22 | 23 | Ptr clone( ) { 24 | return Material::clone( *this ); 25 | } 26 | 27 | protected: 28 | 29 | LineBasicMaterial( const Parameters& parameters ) 30 | : Material() { 31 | fog = true; 32 | setParameters( parameters, defaultKeys() ); 33 | } 34 | 35 | static const ParameterKeys& defaultKeys() { 36 | static std::array sKeys = { 37 | "color", 38 | "linewidth", 39 | "linecap", 40 | "linejoin", 41 | "vertexColors", 42 | "fog" 43 | }; 44 | static ParameterKeys sKeysSet( sKeys.begin(), sKeys.end() ); 45 | return sKeysSet; 46 | } 47 | 48 | }; 49 | 50 | } // namespace three 51 | 52 | #endif // THREE_LINE_BASIC_MATERIAL_HPP 53 | 54 | -------------------------------------------------------------------------------- /three/materials/mesh_basic_material.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_MESH_BASIC_MATERIAL_HPP 2 | #define THREE_MESH_BASIC_MATERIAL_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class MeshBasicMaterial : public Material { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | static Ptr create( const Parameters& parameters = Parameters() ) { 16 | return three::make_shared( parameters ); 17 | } 18 | 19 | virtual THREE::MaterialType type() const { return THREE::MeshBasicMaterial; } 20 | 21 | ///////////////////////////////////////////////////////////////////////// 22 | 23 | Ptr clone( ) { 24 | return Material::clone( *this ); 25 | } 26 | 27 | protected: 28 | 29 | MeshBasicMaterial( const Parameters& parameters ) 30 | : Material() { 31 | //fog = true; 32 | setParameters( parameters, DefaultKeys() ); 33 | } 34 | 35 | static const ParameterKeys& DefaultKeys() { 36 | static std::array sKeys = { 37 | "color", 38 | "map", 39 | "lightMap", 40 | "specularMap", 41 | "envMap", 42 | "combine", 43 | "reflectivity", 44 | "refractionRatio", 45 | "fog", 46 | "shading", 47 | "wireframe", 48 | "wireframeLinewidth", 49 | "wireframeLinecap", 50 | "wireframeLinejoin", 51 | "vertexColors", 52 | "skinning", 53 | "morphTargets" 54 | }; 55 | static ParameterKeys sKeysSet( sKeys.begin(), sKeys.end() ); 56 | return sKeysSet; 57 | } 58 | 59 | }; 60 | 61 | } // namespace three 62 | 63 | #endif // THREE_MESH_BASIC_MATERIAL_HPP 64 | 65 | -------------------------------------------------------------------------------- /three/materials/mesh_depth_material.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_MESH_DEPTH_MATERIAL_HPP 2 | #define THREE_MESH_DEPTH_MATERIAL_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class MeshDepthMaterial : public Material { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | static Ptr create( const Parameters& parameters = Parameters() ) { 16 | return three::make_shared( parameters ); 17 | } 18 | 19 | virtual THREE::MaterialType type() const { return THREE::MeshDepthMaterial; } 20 | 21 | ///////////////////////////////////////////////////////////////////////// 22 | 23 | Ptr clone( ) { 24 | return Material::clone( *this ); 25 | } 26 | 27 | protected: 28 | 29 | MeshDepthMaterial( const Parameters& parameters ) 30 | : Material() { 31 | setParameters( parameters, DefaultKeys() ); 32 | } 33 | 34 | static const ParameterKeys& DefaultKeys() { 35 | static std::array sKeys = { 36 | "wireframe", 37 | "wireframeLinewidth" 38 | }; 39 | static ParameterKeys sKeysSet( sKeys.begin(), sKeys.end() ); 40 | return sKeysSet; 41 | } 42 | 43 | }; 44 | 45 | } // namespace three 46 | 47 | #endif // THREE_MESH_DEPTH_MATERIAL_HPP 48 | 49 | -------------------------------------------------------------------------------- /three/materials/mesh_face_material.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_MESH_FACE_MATERIAL_HPP 2 | #define THREE_MESH_FACE_MATERIAL_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class MeshFaceMaterial : public Material { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | static Ptr create( const Parameters& parameters = Parameters() ) { 16 | return three::make_shared( parameters ); 17 | } 18 | 19 | virtual THREE::MaterialType type() const { return THREE::MeshFaceMaterial; } 20 | 21 | ///////////////////////////////////////////////////////////////////////// 22 | 23 | Ptr clone( ) { 24 | return Material::clone( *this ); 25 | } 26 | 27 | protected: 28 | 29 | MeshFaceMaterial( const Parameters& parameters ) 30 | : Material() { 31 | setParameters( parameters, DefaultKeys() ); 32 | } 33 | 34 | static const ParameterKeys& DefaultKeys() { 35 | static ParameterKeys sKeysSet; 36 | return sKeysSet; 37 | } 38 | 39 | }; 40 | 41 | } // namespace three 42 | 43 | #endif // THREE_MATERIAL_HPP 44 | 45 | -------------------------------------------------------------------------------- /three/materials/mesh_lambert_material.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_MESH_LAMBERT_MATERIAL_HPP 2 | #define THREE_MESH_LAMBERT_MATERIAL_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class MeshLambertMaterial : public Material { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | static Ptr create( const Parameters& parameters = Parameters() ) { 16 | return three::make_shared( parameters ); 17 | } 18 | 19 | virtual THREE::MaterialType type() const { return THREE::MeshLambertMaterial; } 20 | 21 | ///////////////////////////////////////////////////////////////////////// 22 | 23 | Ptr clone( ) { 24 | return Material::clone( *this ); 25 | } 26 | 27 | protected: 28 | 29 | MeshLambertMaterial( const Parameters& parameters ) 30 | : Material() { 31 | fog = true; 32 | setParameters( parameters, DefaultKeys() ); 33 | } 34 | 35 | static const ParameterKeys& DefaultKeys() { 36 | static std::array sKeys = { 37 | "color", 38 | "ambient", 39 | "emissive", 40 | "wrapAround", 41 | "wrapRGB", 42 | "map", 43 | "lightMap", 44 | "specularMap", 45 | "envMap" 46 | "combine", 47 | "reflectivity", 48 | "refractionRatio", 49 | "fog", 50 | "shading", 51 | "wireframe", 52 | "wireframeLinewidth", 53 | "wireframeLinecap", 54 | "wireframeLinejoin", 55 | "vertexColors", 56 | "skinning", 57 | "morphTargets", 58 | "morphNormals" 59 | }; 60 | static ParameterKeys sKeysSet( sKeys.begin(), sKeys.end() ); 61 | return sKeysSet; 62 | } 63 | 64 | }; 65 | 66 | } // namespace three 67 | 68 | #endif // THREE_MESH_LAMBERT_MATERIAL_HPP 69 | 70 | -------------------------------------------------------------------------------- /three/materials/mesh_normal_material.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_MESH_NORMAL_MATERIAL_HPP 2 | #define THREE_MESH_NORMAL_MATERIAL_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | class MeshNormalMaterial : public Material { 10 | public: 11 | 12 | typedef std::shared_ptr Ptr; 13 | 14 | static Ptr create( const Parameters& parameters = Parameters() ) { 15 | return three::make_shared( parameters ); 16 | } 17 | 18 | virtual THREE::MaterialType type() const { return THREE::MeshNormalMaterial; } 19 | 20 | ///////////////////////////////////////////////////////////////////////// 21 | 22 | Ptr clone( ) { 23 | return Material::clone( *this ); 24 | } 25 | 26 | protected: 27 | 28 | MeshNormalMaterial( const Parameters& parameters ) 29 | : Material() { 30 | shading = THREE::FlatShading; 31 | setParameters( parameters, DefaultKeys() ); 32 | } 33 | 34 | static const ParameterKeys& DefaultKeys() { 35 | static std::array sKeys = { 36 | "shading", 37 | "wireframe", 38 | "wireframeLinewidth" 39 | }; 40 | static ParameterKeys sKeysSet( sKeys.begin(), sKeys.end() ); 41 | return sKeysSet; 42 | } 43 | 44 | }; 45 | 46 | } // namespace three 47 | 48 | #endif // THREE_MESH_NORMAL_MATERIAL_HPP 49 | 50 | -------------------------------------------------------------------------------- /three/materials/mesh_phong_material.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_MESH_PHONG_MATERIAL_HPP 2 | #define THREE_MESH_PHONG_MATERIAL_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class MeshPhongMaterial : public Material { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | static Ptr create( const Parameters& parameters = Parameters() ) { 16 | return three::make_shared( parameters ); 17 | } 18 | 19 | virtual THREE::MaterialType type() const { return THREE::MeshPhongMaterial; } 20 | 21 | ///////////////////////////////////////////////////////////////////////// 22 | 23 | Ptr clone( ) { 24 | return Material::clone( *this ); 25 | } 26 | 27 | protected: 28 | 29 | MeshPhongMaterial( const Parameters& parameters ) 30 | : Material() { 31 | fog = true; 32 | setParameters( parameters, DefaultKeys() ); 33 | } 34 | 35 | static const ParameterKeys& DefaultKeys() { 36 | static std::array sKeys = { 37 | "color", 38 | "ambient", 39 | "emissive", 40 | "specular", 41 | "shininess", 42 | "metal", 43 | "perPixel", 44 | "wrapAround", 45 | "wrapRGB", 46 | "map", 47 | "lightMap", 48 | "bumpMap", 49 | "bumpScale", 50 | "normalMap", 51 | "normalScale", 52 | "specularMap", 53 | "envMap", 54 | "combine", 55 | "reflectivity", 56 | "refractionRatio", 57 | "fog", 58 | "shading", 59 | "wireframe", 60 | "wireframeLinewidth", 61 | "wireframeLinecap", 62 | "wireframeLinejoin", 63 | "vertexColors", 64 | "skinning", 65 | "morphTargets", 66 | "morphNormals" 67 | }; 68 | static ParameterKeys sKeysSet( sKeys.begin(), sKeys.end() ); 69 | return sKeysSet; 70 | } 71 | 72 | }; 73 | 74 | } // namespace three 75 | 76 | #endif // THREE_MESH_PHONG_MATERIAL_HPP 77 | 78 | -------------------------------------------------------------------------------- /three/materials/particle_basic_material.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_PARTICLE_BASIC_MATERIAL_HPP 2 | #define THREE_PARTICLE_BASIC_MATERIAL_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class ParticleBasicMaterial : public Material { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | static Ptr create( const Parameters& parameters = Parameters() ) { 16 | return three::make_shared( parameters ); 17 | } 18 | 19 | virtual THREE::MaterialType type() const { return THREE::ParticleBasicMaterial; } 20 | 21 | ///////////////////////////////////////////////////////////////////////// 22 | 23 | Ptr clone( ) { 24 | return Material::clone( *this ); 25 | } 26 | 27 | protected: 28 | 29 | ParticleBasicMaterial( const Parameters& parameters ) 30 | : Material() { 31 | fog = true; 32 | setParameters( parameters, DefaultKeys() ); 33 | } 34 | 35 | static const ParameterKeys& DefaultKeys() { 36 | static std::array sKeys = { 37 | "color", 38 | "map", 39 | "size", 40 | "sizeAttenuation", 41 | "opacity", 42 | "depthTest", 43 | "vertexColors", 44 | "fog" 45 | }; 46 | static ParameterKeys sKeysSet( sKeys.begin(), sKeys.end() ); 47 | return sKeysSet; 48 | } 49 | 50 | }; 51 | 52 | } // namespace three 53 | 54 | #endif // THREE_MATERIAL_HPP 55 | 56 | -------------------------------------------------------------------------------- /three/materials/program.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_PROGRAM_HPP 2 | #define THREE_PROGRAM_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | namespace three { 16 | 17 | class Program : public NonCopyable { 18 | public: 19 | 20 | typedef std::shared_ptr Ptr; 21 | 22 | static Ptr create( Buffer program, int id ) { 23 | return three::make_shared( program, id ); 24 | } 25 | 26 | ///////////////////////////////////////////////////////////////////////// 27 | 28 | UniformLocations uniforms; 29 | AttributeLocations attributes; 30 | 31 | Buffer program; 32 | int id; 33 | 34 | protected: 35 | 36 | Program( Buffer program, int id ) 37 | : program( program ), id( id ) { } 38 | }; 39 | 40 | ////////////////////////////////////////////////////////////////////////// 41 | 42 | } // namespace three 43 | 44 | #endif // THREE_PROGRAM_HPP -------------------------------------------------------------------------------- /three/materials/text_2d_material.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_TEXT_2D_MATERIAL_HPP 2 | #define THREE_TEXT_2D_MATERIAL_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class Text2DMaterial { 11 | public: 12 | 13 | typedef std::shared_ptr Ptr; 14 | 15 | static Ptr create( const Font& font, 16 | const Color& color = Color( 0xffffff ), 17 | float opacity = 1.f ); 18 | 19 | }; 20 | 21 | } // namespace three 22 | 23 | #if defined(THREE_HEADER_ONLY) 24 | # include 25 | #endif // defined(THREE_HEADER_ONLY) 26 | 27 | #endif // THREE_TEXT_2D_MATERIAL_HPP 28 | 29 | -------------------------------------------------------------------------------- /three/objects/bone.hpp: -------------------------------------------------------------------------------- 1 | /*#ifndef THREE_MESH_HPP 2 | #define THREE_MESH_HPP 3 | 4 | namespace three { 5 | 6 | class Bone : public Object3D { 7 | 8 | typedef std::shared_ptrPtr 9 | THREE.Bone = function( belongsToSkin ) { 10 | 11 | THREE.Object3D.call( this ); 12 | 13 | this.skin = belongsToSkin; 14 | this.skinMatrix = new THREE.Matrix4(); 15 | 16 | }; 17 | 18 | THREE.Bone.prototype = Object.create( THREE.Object3D.prototype ); 19 | 20 | THREE.Bone.prototype.update = function( parentSkinMatrix, forceUpdate ) { 21 | 22 | // update local 23 | 24 | if ( this.matrixAutoUpdate ) { 25 | 26 | forceUpdate |= this.updateMatrix(); 27 | 28 | } 29 | 30 | // update skin matrix 31 | 32 | if ( forceUpdate || this.matrixWorldNeedsUpdate ) { 33 | 34 | if( parentSkinMatrix ) { 35 | 36 | this.skinMatrix.multiply( parentSkinMatrix, this.matrix ); 37 | 38 | } else { 39 | 40 | this.skinMatrix.copy( this.matrix ); 41 | 42 | } 43 | 44 | this.matrixWorldNeedsUpdate = false; 45 | forceUpdate = true; 46 | 47 | } 48 | 49 | // update children 50 | 51 | var child, i, l = this.children.length; 52 | 53 | for ( i = 0; i < l; i ++ ) { 54 | 55 | this.children[ i ].update( this.skinMatrix, forceUpdate ); 56 | 57 | } 58 | 59 | }; 60 | 61 | } // namespace three 62 | #endif // THREE_MESH_HPP*/ -------------------------------------------------------------------------------- /three/objects/impl/mesh.ipp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_MESH_IPP 2 | #define THREE_MESH_IPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | Mesh::Ptr Mesh::create( const Geometry::Ptr& geometry, const Material::Ptr& material ) { 11 | return three::make_shared( geometry, material ); 12 | } 13 | 14 | int Mesh::getMorphTargetIndexByName( const std::string& name ) { 15 | auto morphTargetIndexIter = morphTargetDictionary.find( name ); 16 | if ( morphTargetIndexIter != morphTargetDictionary.end() ) 17 | return morphTargetIndexIter->second; 18 | 19 | console().log( "Three.Mesh.getMorphTargetIndexByName: morph target does not exist, returning 0" ); 20 | return 0; 21 | } 22 | 23 | Mesh::Mesh( const Geometry::Ptr& geometry, const Material::Ptr& material ) 24 | : Object3D( material, geometry ), 25 | boundRadius( 0 ), morphTargetBase( -1 ) { 26 | 27 | if ( geometry ) { 28 | 29 | if ( geometry->boundingSphere.radius == 0 ) { 30 | geometry->computeBoundingSphere(); 31 | } 32 | 33 | boundRadius = geometry->boundingSphere.radius; 34 | 35 | // setup morph targets 36 | 37 | if ( geometry->morphTargets.size() > 0 ) { 38 | 39 | morphTargetBase = -1; 40 | int m = 0; 41 | 42 | for ( const auto& morphTarget : geometry->morphTargets ) { 43 | morphTargetInfluences.push_back( 0 ); 44 | morphTargetDictionary[ morphTarget.name ] = m++; 45 | } 46 | } 47 | } 48 | } 49 | 50 | } // namespace three 51 | 52 | #endif // THREE_MESH_IPP -------------------------------------------------------------------------------- /three/objects/line.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_LINE_HPP 2 | #define THREE_LINE_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace three { 11 | 12 | class Line : public Object3D { 13 | public: 14 | 15 | typedef std::shared_ptr Ptr; 16 | 17 | static Ptr create( const Geometry::Ptr& geometry, 18 | const Material::Ptr& material, 19 | THREE::LineType lineType = THREE::LineStrip ) { 20 | if ( material ) { 21 | return three::make_shared( geometry, material, lineType ); 22 | } else { 23 | return three::make_shared( geometry, defaultMaterial(), lineType ); 24 | } 25 | } 26 | 27 | ///////////////////////////////////////////////////////////////////////// 28 | 29 | THREE_IMPL_OBJECT(Line) 30 | 31 | ///////////////////////////////////////////////////////////////////////// 32 | 33 | THREE::LineType lineType; 34 | 35 | protected: 36 | 37 | Line( const Geometry::Ptr& geometry, const Material::Ptr& material, THREE::LineType lineType ) 38 | : Object3D( material, geometry ), lineType( lineType ) { 39 | 40 | if ( geometry ) { 41 | 42 | if ( geometry->boundingSphere.radius == 0 ) { 43 | geometry->computeBoundingSphere(); 44 | } 45 | 46 | } 47 | } 48 | 49 | static Material::Ptr defaultMaterial() { 50 | return LineBasicMaterial::create( 51 | Material::Parameters().add( "color", Color( (int)(Math::random() * 0xFFFFFF) ) ) 52 | ); 53 | } 54 | }; 55 | 56 | } // namespace three 57 | 58 | #endif // THREE_MESH_HPP -------------------------------------------------------------------------------- /three/objects/mesh.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_MESH_HPP 2 | #define THREE_MESH_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace three { 14 | 15 | class Mesh : public Object3D { 16 | public: 17 | 18 | typedef std::shared_ptr Ptr; 19 | 20 | THREE_DECL static Ptr create( const Geometry::Ptr& geometry, const Material::Ptr& material ); 21 | 22 | ///////////////////////////////////////////////////////////////////////// 23 | 24 | virtual THREE::Type type() const { return THREE::Mesh; } 25 | virtual void visit( Visitor& v ) { v( *this ); } 26 | virtual void visit( ConstVisitor& v ) const { v( *this ); } 27 | 28 | ///////////////////////////////////////////////////////////////////////// 29 | 30 | float boundRadius; 31 | int morphTargetBase; 32 | 33 | std::vector morphTargetForcedOrder; 34 | std::vector morphTargetInfluences; 35 | std::unordered_map morphTargetDictionary; 36 | 37 | ///////////////////////////////////////////////////////////////////////// 38 | 39 | THREE_DECL int getMorphTargetIndexByName( const std::string& name ); 40 | 41 | protected: 42 | 43 | THREE_DECL Mesh( const Geometry::Ptr& geometry, const Material::Ptr& material ); 44 | 45 | }; 46 | 47 | } // namespace three 48 | 49 | 50 | #if defined(THREE_HEADER_ONLY) 51 | # include 52 | #endif // defined(THREE_HEADER_ONLY) 53 | 54 | #endif // THREE_MESH_HPP -------------------------------------------------------------------------------- /three/objects/particle.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_PARTICLE_HPP 2 | #define THREE_PARTICLE_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | namespace three { 10 | 11 | class Particle : public Object3D { 12 | public: 13 | 14 | typedef std::shared_ptr Ptr; 15 | 16 | static Ptr create( const Material::Ptr& material ) { 17 | return three::make_shared( material ); 18 | } 19 | 20 | ///////////////////////////////////////////////////////////////////////// 21 | 22 | THREE_IMPL_OBJECT(Particle) 23 | 24 | ///////////////////////////////////////////////////////////////////////// 25 | 26 | protected: 27 | 28 | Particle( const Material::Ptr& material ) 29 | : Object3D( material ) { } 30 | 31 | }; 32 | 33 | } // namespace three 34 | 35 | #endif // THREE_PARTICLE_HPP -------------------------------------------------------------------------------- /three/objects/particle_system.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_PARTICLE_SYSTEM_HPP 2 | #define THREE_PARTICLE_SYSTEM_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace three { 11 | 12 | class ParticleSystem : public Object3D { 13 | public: 14 | 15 | typedef std::shared_ptr Ptr; 16 | 17 | static Ptr create( const Geometry::Ptr& geometry, const Material::Ptr& material ) { 18 | return three::make_shared ( geometry, material ); 19 | } 20 | 21 | ///////////////////////////////////////////////////////////////////////// 22 | 23 | THREE_IMPL_OBJECT(ParticleSystem) 24 | 25 | ///////////////////////////////////////////////////////////////////////// 26 | 27 | protected: 28 | 29 | ParticleSystem( const Geometry::Ptr& geometry, const Material::Ptr& material ) 30 | : Object3D( material, geometry ) { 31 | 32 | if ( geometry ) { 33 | if ( geometry->boundingSphere.radius <= 0.0001f ) { 34 | geometry->computeBoundingSphere(); 35 | } 36 | boundRadius = geometry->boundingSphere.radius; 37 | } 38 | 39 | frustumCulled = false; 40 | 41 | } 42 | 43 | }; 44 | 45 | } // namespace three 46 | 47 | #endif // THREE_PARTICLE_SYSTEM_HPP -------------------------------------------------------------------------------- /three/renderers/gl_render_target_buffer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_GL_RENDER_TARGET_BUFFER_HPP 2 | #define THREE_GL_RENDER_TARGET_BUFFER_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | 8 | struct GLRenderTargetBuffer : NonCopyable { 9 | 10 | typedef unsigned GLBuffer; 11 | 12 | GLBuffer __glTexture; 13 | std::vector __glFramebuffer; 14 | std::vector __glRenderbuffer; 15 | 16 | mutable float __oldAnisotropy; 17 | 18 | GLRenderTargetBuffer() 19 | : __glTexture( 0 ), 20 | __oldAnisotropy( -1 ) { } 21 | 22 | }; 23 | 24 | } // namespace three 25 | 26 | #endif // THREE_GL_RENDER_TARGET_BUFFER_HPP -------------------------------------------------------------------------------- /three/renderers/renderables/renderable.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_RENDERABLE_HPP 2 | #define THREE_RENDERABLE_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | 8 | class Renderable { 9 | public: 10 | 11 | float z; 12 | 13 | protected: 14 | 15 | Renderable( float z ) : z( z ) { } 16 | }; 17 | 18 | } // namespace three 19 | 20 | #endif // THREE_RENDERABLE_OBJECT_HPP -------------------------------------------------------------------------------- /three/renderers/renderables/renderable_face.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_RENDERABLE_FACE_HPP 2 | #define THREE_RENDERABLE_FACE_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | namespace three { 10 | 11 | class RenderableFace : public Renderable { 12 | public: 13 | 14 | RenderableFace( THREE::FaceType type = THREE::Face3 ) 15 | : Renderable( 0 ), material( nullptr ), faceMaterial( nullptr ), 16 | mType( type ), mSize( type == THREE::Face3 ? 3 : 4 ) { } 17 | 18 | ///////////////////////////////////////////////////////////////////////// 19 | 20 | RenderableVertex v1, v2, v3, v4; 21 | 22 | Vector3 centroidWorld; 23 | Vector3 centroidScreen; 24 | 25 | Vector3 normalWorld; 26 | Vector3 vertexNormalsWorld[ 4 ]; 27 | 28 | Material* material; 29 | Material* faceMaterial; 30 | 31 | std::array, 4> uvs; 32 | 33 | THREE::FaceType type() const { return mType; } 34 | 35 | int size() { return mSize; } 36 | 37 | private: 38 | 39 | THREE::FaceType mType; 40 | int mSize; 41 | }; 42 | 43 | } // namespace three 44 | 45 | #endif // THREE_RENDERABLE_FACE_HPP -------------------------------------------------------------------------------- /three/renderers/renderables/renderable_face3.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_RENDERABLE_FACE3_HPP 2 | #define THREE_RENDERABLE_FACE3_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | 8 | class RenderableFace3 : public RenderableFace { 9 | public: 10 | RenderableFace3() : RenderableFace( THREE::Face3 ) { } 11 | }; 12 | 13 | } // namespace three 14 | 15 | #endif // THREE_RENDERABLE_FACE3_HPP -------------------------------------------------------------------------------- /three/renderers/renderables/renderable_face4.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_RENDERABLE_FACE4_HPP 2 | #define THREE_RENDERABLE_FACE4_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | 8 | class RenderableFace4 : public RenderableFace { 9 | public: 10 | RenderableFace4() : RenderableFace( THREE::Face4 ) { } 11 | }; 12 | 13 | } // namespace three 14 | 15 | #endif // THREE_RENDERABLE_FACE4_HPP -------------------------------------------------------------------------------- /three/renderers/renderables/renderable_line.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_RENDERABLE_LINE_HPP 2 | #define THREE_RENDERABLE_LINE_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | namespace three { 10 | 11 | class RenderableLine : public Renderable { 12 | public: 13 | 14 | RenderableLine() : Renderable( 0 ), material( nullptr ) { } 15 | 16 | RenderableVertex v1, v2; 17 | Material* material; 18 | }; 19 | 20 | } // namespace three 21 | 22 | #endif // THREE_RENDERABLE_LINE_HPP -------------------------------------------------------------------------------- /three/renderers/renderables/renderable_object.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_RENDERABLE_OBJECT_HPP 2 | #define THREE_RENDERABLE_OBJECT_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | namespace three { 9 | 10 | class RenderableObject : public Renderable { 11 | public: 12 | 13 | Object3D* object; 14 | 15 | explicit RenderableObject( Object3D* object = nullptr, float z = 0 ) 16 | : Renderable( z ), object( object ) { } 17 | }; 18 | 19 | struct PainterSort { 20 | bool operator()( const RenderableObject& a, const RenderableObject& b ) const { 21 | return b.z > a.z; 22 | } 23 | bool operator()( const Renderable* a, const Renderable* b ) const { 24 | return b->z > a->z; 25 | } 26 | }; 27 | 28 | } // namespace three 29 | 30 | #endif // THREE_RENDERABLE_OBJECT_HPP -------------------------------------------------------------------------------- /three/renderers/renderables/renderable_particle.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_RENDERABLE_PARTICLE_HPP 2 | #define THREE_RENDERABLE_PARTICLE_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | namespace three { 11 | 12 | class RenderableParticle : public Renderable { 13 | public: 14 | 15 | RenderableParticle() 16 | : Renderable( 0 ), 17 | object( nullptr ), 18 | x( 0 ), y( 0 ), rotation( 0 ), material( nullptr ) { } 19 | 20 | Object3D* object; 21 | 22 | float x, y; 23 | 24 | float rotation; 25 | Vector2 scale; 26 | 27 | Material* material; 28 | }; 29 | 30 | } // namespace three 31 | 32 | #endif // THREE_RENDERABLE_LINE_HPP -------------------------------------------------------------------------------- /three/renderers/renderables/renderable_vertex.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_RENDERABLE_VERTEX_HPP 2 | #define THREE_RENDERABLE_VERTEX_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | 8 | class RenderableVertex { 9 | public: 10 | 11 | Vector3 positionWorld; 12 | Vector4 positionScreen; 13 | 14 | bool visible; 15 | 16 | RenderableVertex() : visible( true ) { } 17 | 18 | RenderableVertex& copy( const RenderableVertex& vertex ) { 19 | return ( *this ) = vertex; 20 | } 21 | }; 22 | 23 | } // namespace three 24 | 25 | #endif // THREE_RENDERABLE_VERTEX_HPP -------------------------------------------------------------------------------- /three/renderers/renderer_parameters.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_RENDERER_PARAMETERS_HPP 2 | #define THREE_RENDERER_PARAMETERS_HPP 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | namespace three { 10 | 11 | struct RendererParameters { 12 | RendererParameters() 13 | : width( 1024 ), height( 768 ), 14 | vsync ( true ), 15 | precision( THREE::PrecisionHigh ), 16 | alpha( true ), 17 | premultipliedAlpha( true ), 18 | antialias( false ), 19 | stencil( true ), 20 | preserveDrawingBuffer( false ), 21 | clearColor( 0 ), 22 | clearAlpha( 0 ), 23 | maxLights( 4 ) { } 24 | 25 | int width, height; 26 | bool vsync; 27 | THREE::PrecisionType precision; 28 | bool alpha; 29 | bool premultipliedAlpha; 30 | bool antialias; 31 | bool stencil; 32 | bool preserveDrawingBuffer; 33 | Color clearColor; 34 | float clearAlpha; 35 | int maxLights; 36 | }; 37 | 38 | } // namespace three 39 | 40 | #endif // THREE_RENDERER_PARAMETERS_HPP -------------------------------------------------------------------------------- /three/scenes/fog.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_FOG_HPP 2 | #define THREE_FOG_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | namespace three { 11 | 12 | class Fog : public IFog, NonCopyable { 13 | public: 14 | 15 | typedef std::shared_ptr Ptr; 16 | 17 | static Ptr create( int hex, float near = 1, float far = 1000 ) { 18 | return three::make_shared( hex, near, far ); 19 | } 20 | 21 | THREE::FogType type() const { return THREE::Fog; } 22 | 23 | ///////////////////////////////////////////////////////////////////////// 24 | 25 | Color color; 26 | float near, far; 27 | 28 | protected: 29 | 30 | Fog( int hex, float near, float far ) 31 | : IFog(), color( hex ), near( near ), far( far ) { } 32 | 33 | }; 34 | 35 | } // namespace three 36 | 37 | #endif // THREE_FOG_HPP -------------------------------------------------------------------------------- /three/scenes/fog_exp2.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_FOG_EXP2_HPP 2 | #define THREE_FOG_EXP2_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | namespace three { 11 | 12 | class FogExp2 : public IFog, NonCopyable { 13 | public: 14 | 15 | typedef std::shared_ptr Ptr; 16 | 17 | static Ptr create( int hex, float density = 0.00025f ) { 18 | return three::make_shared( hex, density ); 19 | } 20 | 21 | THREE::FogType type() const { return THREE::FogExp2; } 22 | 23 | ///////////////////////////////////////////////////////////////////////// 24 | 25 | Color color; 26 | float density; 27 | 28 | protected: 29 | 30 | FogExp2( int hex, float density ) 31 | : IFog(), color( hex ), density( density ) { } 32 | 33 | }; 34 | 35 | } // namespace three 36 | 37 | #endif // THREE_FOG_EXP2_HPP -------------------------------------------------------------------------------- /three/scenes/scene.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_SCENE_HPP 2 | #define THREE_SCENE_HPP 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | 10 | namespace three { 11 | 12 | class Scene : public Object3D { 13 | public: 14 | 15 | typedef std::shared_ptr Ptr; 16 | 17 | static Ptr create() { return make_shared(); } 18 | 19 | ///////////////////////////////////////////////////////////////////////// 20 | 21 | IFog::Ptr fog; 22 | Material* overrideMaterial; 23 | bool matrixAutoUpdate; 24 | 25 | ///////////////////////////////////////////////////////////////////////// 26 | 27 | struct GLObject : RenderableObject { 28 | explicit GLObject( GeometryBuffer* buffer = nullptr, 29 | Object3D* object = nullptr, 30 | bool render = false, 31 | Material* opaque = nullptr, 32 | Material* transparent = nullptr, 33 | float z = 0.f ) 34 | : RenderableObject( object, z ), 35 | buffer( buffer ), 36 | render( render ), 37 | opaque( opaque ), 38 | transparent( transparent ) { } 39 | 40 | GeometryBuffer* buffer; 41 | bool render; 42 | Material* opaque; 43 | Material* transparent; 44 | }; 45 | 46 | std::vector __glObjects; 47 | std::vector __glObjectsImmediate; 48 | std::vector __glSprites; 49 | std::vector __glFlares; 50 | 51 | std::vector __objects; 52 | std::vector __lights; 53 | 54 | std::vector __objectsAdded; 55 | std::vector __objectsRemoved; 56 | 57 | ////////////////////////////////////////////////////////////////////////// 58 | 59 | protected: 60 | 61 | THREE_DECL virtual void __addObject( const Object3D::Ptr& object ); 62 | THREE_DECL virtual void __removeObject( const Object3D::Ptr& object ); 63 | 64 | protected: 65 | 66 | THREE_DECL Scene(); 67 | THREE_DECL ~Scene(); 68 | 69 | virtual THREE::Type type() const { return THREE::Scene; } 70 | 71 | THREE_DECL virtual void visit( Visitor& v ); 72 | THREE_DECL virtual void visit( ConstVisitor& v ) const; 73 | }; 74 | 75 | } // namespace three 76 | 77 | 78 | #if defined(THREE_HEADER_ONLY) 79 | # include 80 | #endif // defined(THREE_HEADER_ONLY) 81 | 82 | #endif // THREE_SCENE_HPP -------------------------------------------------------------------------------- /three/textures/texture_buffer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_TEXTURE_BUFFER_HPP 2 | #define THREE_TEXTURE_BUFFER_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | 8 | // TODO: Make this a member of Texture, rather than a parent... 9 | struct TextureBuffer : NonCopyable { 10 | 11 | typedef unsigned GLBuffer; 12 | 13 | mutable bool __glInit; 14 | mutable GLBuffer __glTexture; 15 | mutable GLBuffer __glTextureCube; 16 | mutable float __oldAnisotropy; 17 | 18 | TextureBuffer() 19 | : __glInit( false ), 20 | __glTexture( 0 ), 21 | __glTextureCube( 0 ), 22 | __oldAnisotropy( -1 ) { } 23 | 24 | }; 25 | 26 | } 27 | 28 | #endif // THREE_TEXTURE_BUFFER_HPP -------------------------------------------------------------------------------- /three/utils/conversion.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_CONVERSION_UTILS_HPP 2 | #define THREE_CONVERSION_UTILS_HPP 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace three { 11 | 12 | inline const std::string& threeDataDir() { 13 | static std::string sThreeDataDir(THREE_DATA_DIR); 14 | return sThreeDataDir; 15 | } 16 | 17 | inline std::string threeDataPath( const std::string& relativePath ) { 18 | auto path = threeDataDir(); 19 | path += "/"; 20 | path += relativePath; 21 | return path; 22 | } 23 | 24 | ///////////////////////////////////////////////////////////////////////// 25 | 26 | template < typename T > 27 | inline std::array toArray( const T& t0, const T& t1, const T& t2, const T& t3 = T() ) { 28 | std::array a = { t0, t1, t2, t3 }; 29 | return a; 30 | } 31 | 32 | template < typename T > 33 | void* toOffset( T t ) { return reinterpret_cast( t ); } 34 | 35 | inline int toInt( bool b ) { return b ? 1 : 0; } 36 | 37 | template < typename T, typename U > 38 | inline std::string toString( const T& t, const U& u ) { 39 | std::stringstream ss; 40 | ss << t << u; 41 | return ss.str(); 42 | } 43 | 44 | template < typename T, typename U > 45 | inline std::string toString( const std::pair& p ) { 46 | std::stringstream ss; 47 | ss << p.first << "_" << p.second; 48 | return ss.str(); 49 | } 50 | 51 | } // namespace three 52 | 53 | #endif // THREE_UTILS_HPP -------------------------------------------------------------------------------- /three/utils/hash.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_HASH_HPP 2 | #define THREE_HASH_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | 8 | #define JENKINS_MIX(a,b,c) { \ 9 | a -= b; a -= c; a ^= (c>>13); \ 10 | b -= c; b -= a; b ^= (a<<8); \ 11 | c -= a; c -= b; c ^= (b>>13); \ 12 | a -= b; a -= c; a ^= (c>>12); \ 13 | b -= c; b -= a; b ^= (a<<16); \ 14 | c -= a; c -= b; c ^= (b>>5); \ 15 | a -= b; a -= c; a ^= (c>>3); \ 16 | b -= c; b -= a; b ^= (a<<10); \ 17 | c -= a; c -= b; c ^= (b>>15); \ 18 | } 19 | 20 | #define JENKINS_32(d) (*((const std::uint32_t *) (d))) 21 | 22 | template < typename T > 23 | static unsigned jenkins_hash(const T& value, unsigned initval = 0) { 24 | 25 | typedef std::uint32_t ub4; 26 | 27 | int length = sizeof(T); 28 | unsigned char* k = (unsigned char*)(&value); 29 | 30 | register ub4 a,b,c,len; 31 | 32 | /* Set up the internal state */ 33 | len = length; 34 | a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */ 35 | c = initval; /* the previous hash value */ 36 | 37 | /*---------------------------------------- handle most of the key */ 38 | while (len >= 12) { 39 | a += JENKINS_32(k); 40 | b += JENKINS_32(k+4); 41 | c += JENKINS_32(k+8); 42 | JENKINS_MIX(a,b,c); 43 | k += 12; len -= 12; 44 | } 45 | 46 | /*------------------------------------- handle the last 11 bytes */ 47 | c += length; 48 | switch(len) { /* all the case statements fall through */ 49 | case 11: c+=((ub4)k[10]<<24); 50 | case 10: c+=((ub4)k[9]<<16); 51 | case 9 : c+=((ub4)k[8]<<8); 52 | /* the first byte of c is reserved for the length */ 53 | case 8 : b+=((ub4)k[7]<<24); 54 | case 7 : b+=((ub4)k[6]<<16); 55 | case 6 : b+=((ub4)k[5]<<8); 56 | case 5 : b+=k[4]; 57 | case 4 : a+=((ub4)k[3]<<24); 58 | case 3 : a+=((ub4)k[2]<<16); 59 | case 2 : a+=((ub4)k[1]<<8); 60 | case 1 : a+=k[0]; 61 | /* case 0: nothing left to add */ 62 | }; 63 | 64 | JENKINS_MIX(a,b,c); 65 | 66 | return c; 67 | } 68 | 69 | #undef JENKINS_MIX 70 | #undef JENKINS_32 71 | 72 | } 73 | 74 | #endif // THREE_HASH_HPP -------------------------------------------------------------------------------- /three/utils/index.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_INDEX_HPP 2 | #define THREE_INDEX_HPP 3 | 4 | #include 5 | 6 | namespace three { 7 | 8 | template < typename T, T invalid > 9 | struct IndexT { 10 | explicit IndexT( T t = invalid ) : value( t ) { } 11 | IndexT( const IndexT& other ) : value( other.value ) { } 12 | 13 | IndexT& operator=( T t ) { value = t; return *this; } 14 | IndexT& operator=( const IndexT& other ) { value = other.value; return *this; } 15 | 16 | //THREE_EXPLICIT operator bool() const { return value != invalid; } 17 | bool valid() const { return value != invalid; } 18 | 19 | struct IncompleteType; 20 | 21 | operator T() const { return value; } 22 | operator uint32_t() const { return static_cast(value); } 23 | operator uint64_t() const { return static_cast(value); } 24 | 25 | T value; 26 | }; 27 | 28 | typedef IndexT Index; 29 | 30 | } // namespace three 31 | 32 | namespace std { 33 | template <> 34 | struct hash { 35 | size_t operator()( const three::Index& index ) { 36 | return hash()( index.value ); 37 | } 38 | }; 39 | } // namespace std 40 | 41 | #endif // THREE_PROPERTIES_HPP 42 | -------------------------------------------------------------------------------- /three/utils/noncopyable.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_NONCOPYABLE_HPP 2 | #define THREE_NONCOPYABLE_HPP 3 | 4 | namespace three { 5 | 6 | class NonCopyable { 7 | protected: 8 | NonCopyable() {} 9 | ~NonCopyable() {} 10 | private: 11 | NonCopyable( const NonCopyable& ) THREE_DECL_DELETE; 12 | const NonCopyable& operator=( const NonCopyable& ) THREE_DECL_DELETE; 13 | }; 14 | 15 | } // namespace three 16 | 17 | #endif // THREE_NONCOPYABLE_HPP 18 | -------------------------------------------------------------------------------- /three/utils/template.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_TEMPLATE_UTILS_HPP 2 | #define THREE_TEMPLATE_UTILS_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace three { 10 | 11 | template < typename C > 12 | inline C& concat( C& a, const C& b ) { 13 | a.insert( a.end(), b.begin(), b.end() ); 14 | return a; 15 | } 16 | 17 | template < typename C > 18 | inline void grow( C& c, size_t size, float factor = 1.5f ) { 19 | if ( c.size() < size ) 20 | c.resize( ( int )( factor * size ) ); 21 | } 22 | 23 | template < typename C, typename T > 24 | inline bool contains( const C& c, const T& elem ) { 25 | return std::find( c.begin(), c.end(), elem ) != c.end(); 26 | } 27 | 28 | template < typename T > 29 | inline bool contains( const std::unordered_map& c, const std::string& elem ) { 30 | return c.find( elem ) != c.end(); 31 | } 32 | 33 | template < typename T > 34 | inline bool contains( const std::unordered_map& c, const char* elem ) { 35 | return contains ( c, std::string( elem ) ); 36 | } 37 | 38 | template < typename C, typename T > 39 | inline bool erase( C& c, const T& elem ) { 40 | auto i = std::find( c.begin(), c.end(), elem ); 41 | if ( i != c.end() ) { 42 | c.erase( i ); 43 | return true; 44 | } 45 | return false; 46 | } 47 | 48 | template < typename C, typename T > 49 | inline bool push_unique( C& c, T && elem ) { 50 | if ( !contains( c, elem ) ) { 51 | c.push_back( std::move( elem ) ); 52 | return true; 53 | } 54 | return false; 55 | } 56 | 57 | ///////////////////////////////////////////////////////////////////////// 58 | 59 | struct Deferred { 60 | typedef std::function DeferredFunc; 61 | explicit Deferred( DeferredFunc&& f ) : f ( std::move(f) ) { } 62 | Deferred( Deferred&& other ) { std::swap( f, other.f ); } 63 | private: 64 | DeferredFunc f; 65 | Deferred(); 66 | Deferred( const Deferred& ); 67 | Deferred& operator=( const Deferred& ); 68 | Deferred& operator=( Deferred&& other ); 69 | }; 70 | 71 | template < typename F > 72 | Deferred defer( F&& f ) { 73 | return Deferred( std::move(f) ); 74 | } 75 | 76 | } // namespace three 77 | 78 | #endif // THREE_TEMPLATE_UTILS_HPP -------------------------------------------------------------------------------- /three/visitor.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREE_VISITOR_HPP 2 | #define THREE_VISITOR_HPP 3 | 4 | #include 5 | #include 6 | 7 | namespace three { 8 | 9 | class Visitor { 10 | public: 11 | virtual void operator()( Object3D& ) { } 12 | virtual void operator()( Bone& ) { } 13 | virtual void operator()( Camera& ) { } 14 | virtual void operator()( Light& ) { } 15 | virtual void operator()( Scene& ) { } 16 | virtual void operator()( Particle& ) { } 17 | virtual void operator()( Sprite& ) { } 18 | virtual void operator()( Mesh& ) { } 19 | virtual void operator()( Line& ) { } 20 | virtual ~Visitor() { } 21 | template < typename T > 22 | void fallback( T& object ) { ( *this )( static_cast( object ) ); } 23 | }; 24 | 25 | class ConstVisitor { 26 | public: 27 | virtual void operator()( const Object3D& ) { } 28 | virtual void operator()( const Bone& ) { } 29 | virtual void operator()( const Camera& ) { } 30 | virtual void operator()( const Light& ) { } 31 | virtual void operator()( const Scene& ) { } 32 | virtual void operator()( const Particle& ) { } 33 | virtual void operator()( const Sprite& ) { } 34 | virtual void operator()( const Mesh& ) { } 35 | virtual void operator()( const Line& ) { } 36 | virtual ~ConstVisitor() { } 37 | template < typename T > 38 | void fallback( const T& object ) { ( *this )( static_cast( object ) ); } 39 | }; 40 | 41 | } // namespace three 42 | 43 | #endif // THREE_VISITOR_HPP 44 | --------------------------------------------------------------------------------