/SleekThink.cbp
Cannot display: file marked as a binary type.
svn:mime-type = application/xml
/SleekThink.depend
84545,7 → 84545,7
"node/engine.h"
"loader/loader.h"
 
1460654897 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/device.h
1463921446 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/device.h
"icone.h"
"device_stub.h"
"../define.h"
84578,7 → 84578,7
1453777819 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/define.h
"compile.h"
 
1453712621 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/compile.h
1463921068 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/compile.h
<windows.h>
<stdio.h>
<time.h>
84667,7 → 84667,7
1420774213 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/math/fps_counter.h
"timer.h"
 
1423266085 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/event.h
1463921201 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/event.h
"../os/os.h"
"../gui/type.h"
"keycode.h"
84881,7 → 84881,7
<vector>
"archive.h"
 
1422749737 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/io/directory.h
1463914723 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/io/directory.h
<string>
<memory>
"../define.h"
85003,7 → 85003,7
1420904477 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/common/win.cpp
"win.h"
 
1419890876 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/common/win.h
1463919107 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/common/win.h
"../device.h"
"../../define.h"
<windows.h>
85020,7 → 85020,7
"context.h"
"ogl3/ogl_context.h"
 
1422762183 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/driver/ogl3/ogl_context.h
1463919506 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/driver/ogl3/ogl_context.h
"ogl.h"
"../context.h"
 
85184,9 → 85184,10
"filewriter.h"
<unistd.h>
 
1422749944 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/io/std/directory.h
1463915120 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/io/std/directory.h
<vector>
"../directory.h"
<experimental/filesystem>
 
1422750550 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/io/std/filereader.h
"../filereader.h"
85331,7 → 85332,7
1420770430 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/reference.cpp
"reference.h"
 
1463261234 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/app/GameCore.cpp
1463921455 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/app/GameCore.cpp
"GameCore.h"
"../sleek/loader/texture_loader.h"
<string>
85342,7 → 85343,7
"GameEngine.h"
"../sleek/loader/texture_loader.h"
 
1463265929 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/app/GameMenu.cpp
1463591989 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/app/GameMenu.cpp
"nuklear/nuklear.h"
"GameCore.h"
"GameMenu.h"
85359,7 → 85360,7
1424959364 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/gui/colorpicker.h
"frame.h"
 
1425571751 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/common/sdl.cpp
1463922195 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/common/sdl.cpp
"sdl.h"
<X11/Xlib.h>
<SDL2/SDL.h>
85366,7 → 85367,7
<SDL2/SDL_video.h>
<SDL2/SDL_syswm.h>
 
1420768324 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/common/sdl.h
1463919107 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/common/sdl.h
"../../define.h"
"../../compile.h"
"../device.h"
85376,7 → 85377,7
<X11/Xlib.h>
<X11/extensions/xf86vmode.h>
 
1420844687 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/common/x11.h
1463919071 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/common/x11.h
"../device.h"
"../../define.h"
<stdio.h>
85391,9 → 85392,10
<unistd.h>
<sys/utsname.h>
 
1460654902 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/device.cpp
1463921446 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/device.cpp
"device.h"
"common/sdl.h"
"common/sdl2.h"
"common/win.h"
"common/x11.h"
"common/xf86.h"
85588,7 → 85590,7
"geometry.h"
<math.h>
 
1453771526 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/driver/ogl3/ogl_context.cpp
1463921410 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/driver/ogl3/ogl_context.cpp
"../../device/device.h"
"ogl_context.h"
"ogl_driver.h"
85607,7 → 85609,7
"ogl.h"
"../shader.h"
 
1462458929 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/driver/ogl3/ogl_driver.cpp
1463913378 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/driver/ogl3/ogl_driver.cpp
"../../device/device.h"
"ogl_context.h"
"ogl_driver.h"
86064,13 → 86066,13
"video.h"
<theora/TheoraDataSource.h>
 
1449260874 /usr/include/libpng16/png.h
1490129443 /usr/include/libpng16/png.h
"pnglibconf.h"
"pngconf.h"
 
1449260874 /usr/include/libpng16/pnglibconf.h
1490129443 /usr/include/libpng16/pnglibconf.h
 
1449260874 /usr/include/libpng16/pngconf.h
1490129443 /usr/include/libpng16/pngconf.h
<limits.h>
<stddef.h>
<stdio.h>
86104,3 → 86106,3785
 
1463263005 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/app/nuklear/calculator.cpp
 
1463921833 source:/mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/common/sdl2.cpp
"sdl2.h"
<X11/Xlib.h>
<SDL2/SDL.h>
<SDL2/SDL_video.h>
<SDL2/SDL_syswm.h>
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL.h
"SDL_main.h"
"SDL_stdinc.h"
"SDL_audio.h"
"SDL_cdrom.h"
"SDL_cpuinfo.h"
"SDL_endian.h"
"SDL_error.h"
"SDL_events.h"
"SDL_loadso.h"
"SDL_mutex.h"
"SDL_rwops.h"
"SDL_thread.h"
"SDL_timer.h"
"SDL_video.h"
"SDL_version.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_main.h
"SDL_stdinc.h"
"begin_code.h"
"close_code.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_stdinc.h
"SDL_config.h"
<sys/types.h>
<stdio.h>
<stdlib.h>
<stddef.h>
<stdarg.h>
<stdlib.h>
<malloc.h>
<stddef.h>
<stdarg.h>
<memory.h>
<string.h>
<strings.h>
<inttypes.h>
<stdint.h>
<ctype.h>
<iconv.h>
"begin_code.h"
<alloca.h>
<malloc.h>
<malloc.h>
<malloc.h>
<stdlib.h>
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_config.h
"SDL_platform.h"
<stdarg.h>
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_platform.h
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/begin_code.h
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/close_code.h
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_audio.h
"SDL_stdinc.h"
"SDL_error.h"
"SDL_endian.h"
"SDL_mutex.h"
"SDL_thread.h"
"SDL_rwops.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_error.h
"SDL_stdinc.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_endian.h
"SDL_stdinc.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_mutex.h
"SDL_stdinc.h"
"SDL_error.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_thread.h
"SDL_stdinc.h"
"SDL_error.h"
"SDL_mutex.h"
"begin_code.h"
<process.h>
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_rwops.h
"SDL_stdinc.h"
"SDL_error.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_cdrom.h
"SDL_stdinc.h"
"SDL_error.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_cpuinfo.h
"SDL_stdinc.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_events.h
"SDL_stdinc.h"
"SDL_error.h"
"SDL_active.h"
"SDL_keyboard.h"
"SDL_mouse.h"
"SDL_joystick.h"
"SDL_quit.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_active.h
"SDL_stdinc.h"
"SDL_error.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_keyboard.h
"SDL_stdinc.h"
"SDL_error.h"
"SDL_keysym.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_keysym.h
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_mouse.h
"SDL_stdinc.h"
"SDL_error.h"
"SDL_video.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_video.h
"SDL_stdinc.h"
"SDL_error.h"
"SDL_rwops.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_joystick.h
"SDL_stdinc.h"
"SDL_error.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_quit.h
"SDL_stdinc.h"
"SDL_error.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_loadso.h
"SDL_stdinc.h"
"SDL_error.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_timer.h
"SDL_stdinc.h"
"SDL_error.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_version.h
"SDL_stdinc.h"
"begin_code.h"
"close_code.h"
 
1324743646 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/lib/include/SDL/SDL_syswm.h
"SDL_stdinc.h"
"SDL_error.h"
"SDL_version.h"
"begin_code.h"
<X11/Xlib.h>
<X11/Xatom.h>
<microwin/nano-X.h>
<windows.h>
<sys/neutrino.h>
<Ph.h>
"close_code.h"
 
1463921511 /mnt/windows1/Development/Project/Xtrem-Coder/Sleek Think/src/sleek/device/common/sdl2.h
"../../define.h"
"../../compile.h"
"../device.h"
 
1487026014 source:/root/Documents/Sleek Think2/src/app/GameCore.cpp
"GameCore.h"
"../sleek/loader/texture_loader.h"
<string>
<sstream>
 
1486419323 /root/Documents/Sleek Think2/src/app/GameCore.h
"GameMenu.h"
"GameEngine.h"
"GameIntro.h"
 
1486419323 /root/Documents/Sleek Think2/src/app/GameMenu.h
"../sleek/start.h"
"../sleek/gui/interface.h"
"GuiEventMapper.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/start.h
"device/device.h"
"device/splash.h"
"driver/context.h"
"driver/driver.h"
"node/engine.h"
"loader/loader.h"
 
1486954740 /root/Documents/Sleek Think2/src/sleek/device/device.h
"icone.h"
"device_stub.h"
"../define.h"
"../driver/texture.h"
"../os/cpuid.h"
"../math/fps_counter.h"
"event.h"
<memory>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/icone.h
 
1487022844 /root/Documents/Sleek Think2/src/sleek/device/device_stub.h
"../math/timer.h"
"../math/vector2d.h"
<string>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/math/timer.h
"../os/os.h"
"../define.h"
<chrono>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/os/os.h
<time.h>
<fstream>
<iostream>
<string>
"../define.h"
<math.h>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/define.h
"compile.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/compile.h
<windows.h>
<stdio.h>
<time.h>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/math/vector2d.h
"../library/glm/vec2.hpp"
"../define.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/vec2.hpp
"detail/type_vec2.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_vec2.hpp
"type_vec.hpp"
"_swizzle.hpp"
"_swizzle_func.hpp"
<cstddef>
"type_vec2.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_vec.hpp
"precision.hpp"
"type_int.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/precision.hpp
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_int.hpp
"setup.hpp"
<type_traits>
<cstdint>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/setup.hpp
<cassert>
<cstddef>
<cuda.h>
<x86intrin.h>
<immintrin.h>
<immintrin.h>
<smmintrin.h>
<pmmintrin.h>
<emmintrin.h>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/_swizzle.hpp
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/_swizzle_func.hpp
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_vec2.inl
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/texture.h
<iosfwd>
<fstream>
<string>
<memory>
"../math/vector2d.h"
"../math/vector3d.h"
"../math/pixel.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/math/vector3d.h
"../library/glm/vec3.hpp"
"../define.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/vec3.hpp
"detail/type_vec3.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_vec3.hpp
"type_vec.hpp"
"_swizzle.hpp"
"_swizzle_func.hpp"
<cstddef>
"type_vec3.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_vec3.inl
 
1486419324 /root/Documents/Sleek Think2/src/sleek/math/pixel.h
"../define.h"
"../math/function.h"
"vector3d.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/math/function.h
<memory>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/os/cpuid.h
"os.h"
<string>
<vector>
<memory>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/math/fps_counter.h
"timer.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/event.h
"../os/os.h"
"../gui/type.h"
"keycode.h"
"../math/vector2d.h"
<vector>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/gui/type.h
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/keycode.h
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/splash.h
"device.h"
<functional>
 
1486960453 /root/Documents/Sleek Think2/src/sleek/driver/context.h
"../compile.h"
"../device/device_stub.h"
"../math/aabbox.h"
"identifier.h"
"shader.h"
"mesh.h"
"texture.h"
"texture_array.h"
"texture3d.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/math/aabbox.h
"vector2d.h"
"vector3d.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/identifier.h
<memory>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/shader.h
"texture.h"
"identifier.h"
"../math/vector3d.h"
<vector>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/mesh.h
"context.h"
"material.h"
"vertex.h"
"index.h"
 
1486957803 /root/Documents/Sleek Think2/src/sleek/driver/material.h
"../compile.h"
"../define.h"
"shader.h"
"rtype.h"
"context.h"
"material.h"
"../math/vector3d.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/rtype.h
"rtype.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/vertex.h
<vector>
"texture.h"
"../math/aabbox.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/index.h
"../define.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/texture_array.h
"texture.h"
<vector>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/texture3d.h
<iosfwd>
<fstream>
<string>
<memory>
"texture.h"
"../math/vector2d.h"
"../math/vector3d.h"
"../math/pixel.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/driver.h
"fbo.h"
"texture.h"
"../device/device.h"
"../compile.h"
"material.h"
"geometry.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/fbo.h
<iosfwd>
<fstream>
<string>
"../math/vector2d.h"
"../math/vector3d.h"
"../math/pixel.h"
"material.h"
"context.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/geometry.h
"../math/aabbox.h"
<vector>
"mesh.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/node/engine.h
"../device/device.h"
"../driver/fbo.h"
"billboard/billboard.h"
"billboard/sprite.h"
"camera/camera.h"
"real/natif.h"
"real/octree.h"
"real/grid.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/node/billboard/billboard.h
"../node.h"
"../math/timer.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/node/node.h
"../reference.h"
"../driver/mesh.h"
"../driver/driver.h"
"../driver/geometry.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/reference.h
"math/aabbox.h"
"define.h"
<vector>
<string>
<memory>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/node/billboard/sprite.h
"billboard.h"
"../math/timer.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/node/camera/camera.h
"frustum.h"
"../device/event.h"
"../math/aabbox.h"
"../../library/glm/mat4x4.hpp"
"../../reference.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/node/camera/frustum.h
"../../math/vector3d.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/mat4x4.hpp
"detail/type_mat4x4.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat4x4.hpp
"../fwd.hpp"
"type_vec4.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat4x4.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/fwd.hpp
"detail/type_int.hpp"
"detail/type_float.hpp"
"detail/type_vec.hpp"
"detail/type_mat.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_float.hpp
"setup.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat.hpp
"precision.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_vec4.hpp
"setup.hpp"
"type_vec.hpp"
"_swizzle.hpp"
"_swizzle_func.hpp"
<cstddef>
"type_vec4.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_vec4.inl
"type_vec4_sse2.inl"
"type_vec4_avx.inl"
"type_vec4_avx2.inl"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_vec4_sse2.inl
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_vec4_avx.inl
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_vec4_avx2.inl
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat4x4.inl
 
1486419324 /root/Documents/Sleek Think2/src/sleek/node/real/natif.h
"../node.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/node/real/octree.h
"natif.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/node/real/grid.h
"../node.h"
"../math/timer.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/loader/loader.h
<vector>
"mesh_loader.h"
"texture_loader.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/loader/mesh_loader.h
<string>
<memory>
"../io/filesystem.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/io/filesystem.h
"directory.h"
"filereader.h"
"filewriter.h"
<vector>
"archive.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/io/directory.h
<string>
<memory>
"../define.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/io/filereader.h
<string>
<memory>
"../define.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/io/filewriter.h
<string>
<memory>
"../define.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/io/archive.h
<memory>
<string>
"filesystem.h"
"filereader.h"
"filewriter.h"
"directory.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/loader/texture_loader.h
<string>
<memory>
"../io/filesystem.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/gui/interface.h
"font.h"
"frame.h"
"theme.h"
"cursor.h"
"../driver/fbo.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/gui/font.h
"../driver/texture.h"
"../math/aabbox.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/gui/frame.h
"font.h"
"type.h"
"../compile.h"
"../driver/texture.h"
"../driver/material.h"
"../device/event.h"
"../reference.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/gui/theme.h
"../driver/driver.h"
"../driver/material.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/gui/cursor.h
"interface.h"
 
1486419323 /root/Documents/Sleek Think2/src/app/GuiEventMapper.h
"../gui/frame.h"
<map>
 
1486419323 /root/Documents/Sleek Think2/src/app/GameEngine.h
"../sleek/start.h"
"../sleek/driver/mesh.h"
 
1486419323 /root/Documents/Sleek Think2/src/app/GameIntro.h
"../sleek/video/video.h"
"../sleek/driver/driver.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/video/video.h
"../compile.h"
"../define.h"
"../math/vector2d.h"
"../math/timer.h"
"../driver/texture.h"
"../driver/context.h"
<theora/TheoraPlayer.h>
"audio.h"
<vector>
<string>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/theora/TheoraPlayer.h
"TheoraVideoManager.h"
"TheoraVideoClip.h"
"TheoraVideoFrame.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/theora/TheoraVideoManager.h
<vector>
<string>
"TheoraExport.h"
"TheoraVideoClip.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/theora/TheoraExport.h
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/theora/TheoraVideoClip.h
<string>
"TheoraExport.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/theora/TheoraVideoFrame.h
<theora/TheoraExport.h>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/video/audio.h
"../compile.h"
<AL/al.h>
<AL/alc.h>
<theora/TheoraAudioInterface.h>
<theora/TheoraTimer.h>
<theora/TheoraVideoClip.h>
<queue>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/theora/TheoraAudioInterface.h
"TheoraExport.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/theora/TheoraTimer.h
"TheoraExport.h"
 
1486954812 source:/root/Documents/Sleek Think2/src/app/GameEngine.cpp
"GameCore.h"
"GameEngine.h"
"../sleek/loader/texture_loader.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/app/GameIntro.cpp
"GameCore.h"
"GameIntro.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/app/GameMenu.cpp
"nuklear/nuklear.h"
"GameCore.h"
"GameMenu.h"
"../sleek/loader/texture_loader.h"
"../sleek/gui/frame.h"
"../sleek/gui/button.h"
"../sleek/gui/colorpicker.h"
"../sleek/gui/font.h"
"../sleek/gui/window.h"
"nuklear/overview.cpp"
"nuklear/node_editor.cpp"
"nuklear/calculator.cpp"
 
1487021688 /root/Documents/Sleek Think2/src/app/nuklear/nuklear.h
<stdio.h>
<stdlib.h>
<stdint.h>
<stdarg.h>
<string.h>
<math.h>
<assert.h>
<math.h>
<limits.h>
<time.h>
<nuklear.h>
"../../sleek/start.h"
"../../sleek/driver/ogl3/ogl3.h"
 
1486419319 /root/Documents/Sleek Think2/lib/include/nuklear.h
"nuklear.h"
<stdint.h>
<stdlib.h>
<stdio.h>
<stdarg.h>
<assert.h>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl.h
<opengl/GLee.h>
<opengl/GLTool.h>
<GL/glx.h>
<windows.h>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/opengl/GLee.h
<windows.h>
<GL/gl.h>
<OpenGL/gl.h>
<GL/gl.h>
<GL/glx.h>
<stddef.h>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/opengl/GLTool.h
 
1486419323 /root/Documents/Sleek Think2/src/sleek/gui/button.h
"frame.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/gui/colorpicker.h
"frame.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/gui/window.h
"button.h"
 
1486419323 /root/Documents/Sleek Think2/src/app/nuklear/overview.cpp
 
1486419323 /root/Documents/Sleek Think2/src/app/nuklear/node_editor.cpp
 
1486419323 /root/Documents/Sleek Think2/src/app/nuklear/calculator.cpp
 
1486419323 source:/root/Documents/Sleek Think2/src/app/main.cpp
"../sleek/device/splash.h"
"../sleek/loader/texture_loader.h"
"GameCore.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/device/common/sdl.cpp
"sdl.h"
<X11/Xlib.h>
<SDL2/SDL.h>
<SDL2/SDL_video.h>
<SDL2/SDL_syswm.h>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/common/sdl.h
"../../define.h"
"../../compile.h"
"../device.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/device/common/sdl2.cpp
"sdl2.h"
<X11/Xlib.h>
<SDL2/SDL.h>
<SDL2/SDL_video.h>
<SDL2/SDL_syswm.h>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/common/sdl2.h
"../../define.h"
"../../compile.h"
"../device.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/device/common/win.cpp
"win.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/common/win.h
"../device.h"
"../../define.h"
<windows.h>
 
1487024945 source:/root/Documents/Sleek Think2/src/sleek/device/common/x11.cpp
"x11.h"
<X11/Xlib.h>
<X11/extensions/xf86vmode.h>
 
1487022934 /root/Documents/Sleek Think2/src/sleek/device/common/x11.h
"../device.h"
"../../define.h"
<stdio.h>
<stdlib.h>
<X11/Xlib.h>
<X11/Xutil.h>
<X11/Xos.h>
<X11/Xatom.h>
<X11/keysym.h>
<GL/glx.h>
<fcntl.h>
<unistd.h>
<sys/utsname.h>
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/device/device.cpp
"device.h"
"common/sdl.h"
"common/sdl2.h"
"common/win.h"
"common/x11.h"
"common/xf86.h"
<iostream>
"console/spdlog.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/common/xf86.h
"../device.h"
"../../define.h"
<stdio.h>
<stdlib.h>
<GL/glx.h>
<X11/Xos.h>
<X11/Xlib.h>
<X11/Xutil.h>
<X11/Xatom.h>
<X11/keysym.h>
<sys/utsname.h>
<X11/extensions/xf86vmode.h>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/spdlog.h
"common.h"
"logger.h"
"details/spdlog_impl.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/common.h
<string>
<initializer_list>
<chrono>
<memory>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/logger.h
<vector>
<memory>
"sinks/base_sink.h"
"common.h"
"./details/logger_impl.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/sinks/base_sink.h
<string>
<mutex>
<atomic>
"./sink.h"
"../formatter.h"
"../common.h"
"../details/log_msg.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/sinks/sink.h
"../details/log_msg.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/details/log_msg.h
"../common.h"
"./format.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/details/format.h
<stdint.h>
<cassert>
<cmath>
<cstddef>
<cstdio>
<algorithm>
<limits>
<stdexcept>
<string>
<sstream>
<iterator>
<utility>
"format.cc"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/details/format.cc
<string.h>
<cctype>
<cerrno>
<climits>
<cmath>
<cstdarg>
<cstring>
<windows.h>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/formatter.h
"details/log_msg.h"
"details/pattern_formatter_impl.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/details/pattern_formatter_impl.h
<string>
<chrono>
<memory>
<vector>
<thread>
"../formatter.h"
"./log_msg.h"
"./os.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/details/os.h
<string>
<cstdio>
<ctime>
<Windows.h>
"../common.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/details/logger_impl.h
"./line_logger.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/details/line_logger.h
<type_traits>
"../common.h"
"../logger.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/details/spdlog_impl.h
"registry.h"
"../sinks/file_sinks.h"
"../sinks/stdout_sinks.h"
"../sinks/syslog_sink.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/details/registry.h
<string>
<mutex>
<unordered_map>
<functional>
"../logger.h"
"../async_logger.h"
"../common.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/async_logger.h
<chrono>
<functional>
"common.h"
"logger.h"
"spdlog.h"
"./details/async_logger_impl.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/details/async_logger_impl.h
"./async_log_helper.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/details/async_log_helper.h
<chrono>
<thread>
<atomic>
<functional>
"../common.h"
"../sinks/sink.h"
"./mpmc_bounded_q.h"
"./log_msg.h"
"./format.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/details/mpmc_bounded_q.h
<atomic>
"../common.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/sinks/file_sinks.h
<mutex>
"base_sink.h"
"../details/null_mutex.h"
"../details/file_helper.h"
"../details/format.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/details/null_mutex.h
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/details/file_helper.h
<string>
<thread>
<chrono>
"os.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/sinks/stdout_sinks.h
<iostream>
<mutex>
"./ostream_sink.h"
"../details/null_mutex.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/sinks/ostream_sink.h
<ostream>
<mutex>
<memory>
"../details/null_mutex.h"
"./base_sink.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/device/console/sinks/syslog_sink.h
<array>
<string>
<syslog.h>
"./sink.h"
"../common.h"
"../details/log_msg.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/device/event.cpp
"event.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/device/splash.cpp
"../driver/driver.h"
"../gui/interface.h"
"splash.h"
 
1486959275 source:/root/Documents/Sleek Think2/src/sleek/driver/context.cpp
"context.h"
"ogl3/ogl3_context.h"
"ogl4/ogl4_context.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_context.h
"ogl.h"
"../context.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/driver.cpp
"../device/device.h"
"driver.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/fbo.cpp
"fbo.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/geometry.cpp
"mesh.h"
"geometry.h"
<math.h>
"../library/glm/glm.hpp"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/identifier.cpp
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/index.cpp
"index.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/mesh.cpp
"mesh.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_context.cpp
"../../device/device.h"
"ogl_context.h"
"ogl_driver.h"
"ogl_texture.h"
"ogl_texture_array.h"
"ogl_texture_3d.h"
"ogl_vbo.h"
"ogl_shader.h"
<string.h>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_driver.h
"ogl.h"
"../driver.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_texture.h
"ogl.h"
"../context.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_texture_array.h
"../context.h"
"ogl_texture.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_texture_3d.h
"../context.h"
"ogl_texture.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_vbo.h
"ogl.h"
"../context.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_shader.h
"ogl.h"
"../shader.h"
 
1485378276 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_driver.cpp
"../../device/device.h"
"ogl_context.h"
"ogl_driver.h"
<cstddef>
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_fbo.cpp
"ogl_fbo.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_fbo.h
"ogl.h"
"../fbo.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_shader.cpp
"../material.h"
"ogl_shader.h"
<stdlib.h>
<string.h>
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_texture.cpp
"ogl_texture.h"
<memory.h>
<GL/gl.h>
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_texture_3d.cpp
"ogl_texture_3d.h"
"../texture3d.h"
<memory.h>
<GL/gl.h>
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_texture_array.cpp
"ogl_texture_array.h"
"../texture_array.h"
<memory.h>
<GL/gl.h>
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl_vbo.cpp
"ogl_vbo.h"
<memory.h>
<GL/gl.h>
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/shader.cpp
"../driver/context.h"
"material.h"
"shader.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/texture.cpp
"texture.h"
"context.h"
<memory.h>
<GL/gl.h>
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/texture3d.cpp
"texture3d.h"
"context.h"
<memory.h>
<GL/gl.h>
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/driver/texture_array.cpp
"texture_array.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/gui/button.cpp
"interface.h"
"button.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/gui/colorpicker.cpp
"colorpicker.h"
"interface.h"
"scrollbar.h"
"button.h"
"../driver/texture.h"
"../math/vector3d.h"
"../math/function.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/gui/scrollbar.h
"frame.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/gui/cursor.cpp
"interface.h"
"cursor.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/gui/font.cpp
"interface.h"
"font.h"
<ft2build.h>
 
1486419319 /root/Documents/Sleek Think2/lib/include/ft2build.h
<freetype/config/ftheader.h>
 
1486419319 /root/Documents/Sleek Think2/lib/include/freetype/config/ftheader.h
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/gui/frame.cpp
"interface.h"
"frame.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/gui/interface.cpp
"interface.h"
"button.h"
"statictext.h"
"progressbar.h"
"scrollbar.h"
"picture.h"
"window.h"
<algorithm>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/gui/statictext.h
"frame.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/gui/progressbar.h
"frame.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/gui/picture.h
"frame.h"
"../driver/texture.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/gui/picture.cpp
"interface.h"
"picture.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/gui/progressbar.cpp
"interface.h"
"progressbar.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/gui/scrollbar.cpp
"interface.h"
"scrollbar.h"
"../math/function.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/gui/statictext.cpp
"interface.h"
"statictext.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/gui/theme.cpp
"interface.h"
"../driver/driver.h"
"theme.h"
"button.h"
"font.h"
"picture.h"
"progressbar.h"
"statictext.h"
"window.h"
"scrollbar.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/gui/window.cpp
"interface.h"
"window.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/io/filesystem.cpp
"filesystem.h"
"std/filesystem.h"
"../compile.h"
<memory>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/io/std/filesystem.h
"../../compile.h"
"../filesystem.h"
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/io/std/filesystem.cpp
"filesystem.h"
"directory.h"
"filereader.h"
"filewriter.h"
<unistd.h>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/io/std/directory.h
<vector>
"../directory.h"
<experimental/filesystem>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/io/std/filereader.h
"../filereader.h"
<fstream>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/io/std/filewriter.h
"../filewriter.h"
<fstream>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/library/opengl/GLee.c
<stdio.h>
<stdlib.h>
<string.h>
"GLee.h"
<Carbon/Carbon.h>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/library/opengl/GLTool.cpp
"gl.h"
"GLTool.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/opengl/gl.h
"gl_mangle.h"
<stdlib.h>
<windows.h>
<GL/glext.h>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/library/theora/TheoraAsync.cpp
<stdio.h>
"TheoraAsync.h"
<windows.h>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/theora/TheoraAsync.h
<pthread.h>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/library/theora/TheoraAudioInterface.cpp
"TheoraAudioInterface.h"
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/library/theora/TheoraDataSource.cpp
<memory.h>
<iostream>
"TheoraDataSource.h"
"TheoraException.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/theora/TheoraDataSource.h
<fstream>
<string>
"TheoraExport.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/theora/TheoraException.h
<string>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/library/theora/TheoraException.cpp
"TheoraException.h"
"TheoraUtil.h"
"TheoraVideoManager.h"
<stdio.h>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/theora/TheoraUtil.h
<string>
<vector>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/library/theora/TheoraFrameQueue.cpp
"TheoraFrameQueue.h"
"TheoraVideoFrame.h"
"TheoraUtil.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/theora/TheoraFrameQueue.h
"TheoraAsync.h"
<list>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/library/theora/TheoraTimer.cpp
"TheoraTimer.h"
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/library/theora/TheoraUtil.cpp
<unistd.h>
<stdio.h>
<algorithm>
<math.h>
<map>
"TheoraUtil.h"
"TheoraException.h"
<windows.h>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/library/theora/TheoraVideoClip.cpp
<memory.h>
<ogg/ogg.h>
<vorbis/vorbisfile.h>
<theora/theoradec.h>
"TheoraVideoClip.h"
"TheoraVideoManager.h"
"TheoraVideoFrame.h"
"TheoraFrameQueue.h"
"TheoraAudioInterface.h"
"TheoraTimer.h"
"TheoraDataSource.h"
"TheoraUtil.h"
"TheoraException.h"
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/library/theora/TheoraVideoFrame.cpp
<memory.h>
<theora/theoradec.h>
"TheoraVideoFrame.h"
"TheoraVideoClip.h"
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/library/theora/TheoraVideoManager.cpp
"TheoraVideoManager.h"
"TheoraWorkerThread.h"
"TheoraVideoClip.h"
"TheoraAudioInterface.h"
"TheoraUtil.h"
"TheoraDataSource.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/theora/TheoraWorkerThread.h
"TheoraAsync.h"
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/library/theora/TheoraWorkerThread.cpp
"TheoraWorkerThread.h"
"TheoraVideoManager.h"
"TheoraVideoClip.h"
"TheoraUtil.h"
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/loader/loader.cpp
"loader.h"
"../compile.h"
"mesh_3ds.h"
"mesh_txt.h"
"texture_bmp.h"
"texture_png.h"
"texture_tiff.h"
<iostream>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/loader/mesh_3ds.h
"mesh_loader.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/loader/mesh_txt.h
"mesh_loader.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/loader/texture_bmp.h
"texture_loader.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/loader/texture_png.h
"texture_loader.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/loader/texture_tiff.h
"texture_loader.h"
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/loader/mesh_3ds.cpp
"mesh_3ds.h"
"../driver/mesh.h"
"../compile.h"
<sys/stat.h>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/loader/mesh_txt.cpp
"mesh_txt.h"
"../library/glm/detail/func_geometric.hpp"
"../driver/mesh.h"
"../compile.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_geometric.hpp
"type_vec3.hpp"
"func_geometric.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_geometric.inl
"func_exponential.hpp"
"func_common.hpp"
"type_vec2.hpp"
"type_vec4.hpp"
"type_float.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_exponential.hpp
"type_vec1.hpp"
"type_vec2.hpp"
"type_vec3.hpp"
"type_vec4.hpp"
<cmath>
"func_exponential.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_vec1.hpp
"../fwd.hpp"
"type_vec.hpp"
"_swizzle.hpp"
"_swizzle_func.hpp"
<cstddef>
"type_vec1.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_vec1.inl
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_exponential.inl
"func_vector_relational.hpp"
"_vectorize.hpp"
<limits>
<cmath>
<cassert>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_vector_relational.hpp
"precision.hpp"
"setup.hpp"
"func_vector_relational.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_vector_relational.inl
<limits>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/_vectorize.hpp
"type_vec1.hpp"
"type_vec2.hpp"
"type_vec3.hpp"
"type_vec4.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_common.hpp
"setup.hpp"
"precision.hpp"
"type_int.hpp"
"_fixes.hpp"
"func_common.inl"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/_fixes.hpp
<cmath>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_common.inl
"func_vector_relational.hpp"
"type_vec2.hpp"
"type_vec3.hpp"
"type_vec4.hpp"
"_vectorize.hpp"
<limits>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/loader/texture_bmp.cpp
"texture_bmp.h"
"../driver/texture.h"
"../compile.h"
<stdlib.h>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/loader/texture_png.cpp
"texture_png.h"
"../driver/texture.h"
"../compile.h"
<stdlib.h>
<png.h>
 
1450377136 /usr/include/libpng12/png.h
"zlib.h"
"pngconf.h"
<crtdbg.h>
 
1450377136 /usr/include/libpng12/pngconf.h
"pngusr.h"
"config.h"
<windows.h>
<stdio.h>
<stdio.h>
<sys/types.h>
<setjmp.h>
<strings.h>
<string.h>
<stdlib.h>
<fp.h>
<math.h>
<m68881.h>
<mem.h>
<alloc.h>
<malloc.h>
<time.h>
<dos.h>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/loader/texture_tiff.cpp
"texture_tiff.h"
"../driver/texture.h"
"../compile.h"
<tiffio.h>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/math/timer.cpp
"timer.h"
<sys/time.h>
<unistd.h>
<chrono>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/node/billboard/billboard.cpp
"../engine.h"
"billboard.h"
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/node/billboard/sprite.cpp
"../engine.h"
"sprite.h"
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/node/camera/camera.cpp
"../../device/device.h"
"../../library/glm/detail/func_geometric.hpp"
"../../library/glm/gtc/matrix_transform.hpp"
"../../library/glm/gtc/type_ptr.hpp"
"camera.h"
"GL/gl.h"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/gtc/matrix_transform.hpp
"../mat4x4.hpp"
"../vec2.hpp"
"../vec3.hpp"
"../vec4.hpp"
"../gtc/constants.hpp"
"matrix_transform.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/vec4.hpp
"detail/type_vec4.hpp"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/gtc/constants.hpp
"../detail/setup.hpp"
"constants.inl"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/gtc/constants.inl
<limits>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/gtc/matrix_transform.inl
"../geometric.hpp"
"../trigonometric.hpp"
"../matrix.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/geometric.hpp
"detail/func_geometric.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/trigonometric.hpp
"detail/func_trigonometric.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_trigonometric.hpp
"setup.hpp"
"precision.hpp"
"func_trigonometric.inl"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_trigonometric.inl
"_vectorize.hpp"
<cmath>
<limits>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/matrix.hpp
"detail/func_matrix.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_matrix.hpp
"../detail/precision.hpp"
"../detail/setup.hpp"
"../detail/type_mat.hpp"
"../vec2.hpp"
"../vec3.hpp"
"../vec4.hpp"
"../mat2x2.hpp"
"../mat2x3.hpp"
"../mat2x4.hpp"
"../mat3x2.hpp"
"../mat3x3.hpp"
"../mat3x4.hpp"
"../mat4x2.hpp"
"../mat4x3.hpp"
"../mat4x4.hpp"
"func_matrix.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/mat2x2.hpp
"detail/type_mat2x2.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat2x2.hpp
"../fwd.hpp"
"type_vec2.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat2x2.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat2x2.inl
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/mat2x3.hpp
"detail/type_mat2x3.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat2x3.hpp
"../fwd.hpp"
"type_vec2.hpp"
"type_vec3.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat2x3.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat2x3.inl
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/mat2x4.hpp
"detail/type_mat2x4.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat2x4.hpp
"../fwd.hpp"
"type_vec2.hpp"
"type_vec4.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat2x4.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat2x4.inl
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/mat3x2.hpp
"detail/type_mat3x2.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat3x2.hpp
"../fwd.hpp"
"type_vec2.hpp"
"type_vec3.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat3x2.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat3x2.inl
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/mat3x3.hpp
"detail/type_mat3x3.hpp"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat3x3.hpp
"../fwd.hpp"
"type_vec3.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat3x3.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat3x3.inl
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/mat3x4.hpp
"detail/type_mat3x4.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat3x4.hpp
"../fwd.hpp"
"type_vec3.hpp"
"type_vec4.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat3x4.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat3x4.inl
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/mat4x2.hpp
"detail/type_mat4x2.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat4x2.hpp
"../fwd.hpp"
"type_vec2.hpp"
"type_vec4.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat4x2.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat4x2.inl
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/mat4x3.hpp
"detail/type_mat4x3.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat4x3.hpp
"../fwd.hpp"
"type_vec3.hpp"
"type_vec4.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat4x3.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_mat4x3.inl
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_matrix.inl
"../geometric.hpp"
<limits>
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/gtc/type_ptr.hpp
"../gtc/quaternion.hpp"
"../vec2.hpp"
"../vec3.hpp"
"../vec4.hpp"
"../mat2x2.hpp"
"../mat2x3.hpp"
"../mat2x4.hpp"
"../mat3x2.hpp"
"../mat3x3.hpp"
"../mat3x4.hpp"
"../mat4x2.hpp"
"../mat4x3.hpp"
"../mat4x4.hpp"
<cstring>
"type_ptr.inl"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/gtc/quaternion.hpp
"../mat3x3.hpp"
"../mat4x4.hpp"
"../vec3.hpp"
"../vec4.hpp"
"../gtc/constants.hpp"
"quaternion.inl"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/gtc/quaternion.inl
"../trigonometric.hpp"
"../geometric.hpp"
"../exponential.hpp"
<limits>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/exponential.hpp
"detail/func_exponential.hpp"
 
1486419324 /root/Documents/Sleek Think2/src/sleek/library/glm/gtc/type_ptr.inl
<cstring>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/node/camera/frustum.cpp
"frustum.h"
<math.h>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/node/engine.cpp
"engine.h"
<algorithm>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/node/node.cpp
"engine.h"
"node.h"
"../library/glm/detail/func_geometric.hpp"
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/node/real/grid.cpp
"../engine.h"
"grid.h"
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/node/real/natif.cpp
"../engine.h"
"natif.h"
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/node/real/octree.cpp
"../engine.h"
"octree.h"
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/os/cpuid.cpp
"cpuid.h"
<string.h>
<sys/types.h>
<sys/stat.h>
<linux/major.h>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/os/os.cpp
"string.h"
"os.h"
<stdlib.h>
<unistd.h>
<windows.h>
<X11/Xlib.h>
<X11/Xutil.h>
<sys/types.h>
<sys/sysctl.h>
 
1486419323 source:/root/Documents/Sleek Think2/src/sleek/reference.cpp
"reference.h"
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/video/audio.cpp
"audio.h"
<climits>
<iostream>
 
1486419324 source:/root/Documents/Sleek Think2/src/sleek/video/video.cpp
"../driver/context.h"
"video.h"
<theora/TheoraDataSource.h>
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/glm.hpp
"detail/_fixes.hpp"
<cmath>
<climits>
<cfloat>
<limits>
<cassert>
"fwd.hpp"
"vec2.hpp"
"vec3.hpp"
"vec4.hpp"
"mat2x2.hpp"
"mat2x3.hpp"
"mat2x4.hpp"
"mat3x2.hpp"
"mat3x3.hpp"
"mat3x4.hpp"
"mat4x2.hpp"
"mat4x3.hpp"
"mat4x4.hpp"
"trigonometric.hpp"
"exponential.hpp"
"common.hpp"
"packing.hpp"
"geometric.hpp"
"matrix.hpp"
"vector_relational.hpp"
"integer.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/common.hpp
"detail/func_common.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/packing.hpp
"detail/func_packing.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_packing.hpp
"type_vec2.hpp"
"type_vec4.hpp"
"func_packing.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_packing.inl
"func_common.hpp"
"type_half.hpp"
"../fwd.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_half.hpp
"setup.hpp"
"type_half.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/type_half.inl
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/vector_relational.hpp
"detail/func_vector_relational.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/integer.hpp
"detail/func_integer.hpp"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_integer.hpp
"setup.hpp"
"precision.hpp"
"func_common.hpp"
"func_vector_relational.hpp"
"func_integer.inl"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/library/glm/detail/func_integer.inl
"type_vec2.hpp"
"type_vec3.hpp"
"type_vec4.hpp"
"type_int.hpp"
"_vectorize.hpp"
<intrin.h>
<limits>
 
1487026039 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_context.cpp
"../../device/device.h"
"ogl3_context.h"
"ogl3_driver.h"
"ogl3_texture.h"
"ogl3_texture_array.h"
"ogl3_texture_3d.h"
"ogl3_vbo.h"
"ogl3_shader.h"
<string.h>
 
1486959035 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_context.h
"ogl3.h"
"../context.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3.h
<opengl/GLee.h>
<opengl/GLTool.h>
<GL/glx.h>
<windows.h>
 
1486959024 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_driver.h
"ogl3.h"
"../driver.h"
 
1486958986 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_texture.h
"ogl3.h"
"../context.h"
 
1486958945 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_texture_array.h
"../context.h"
"ogl3_texture.h"
 
1486958980 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_texture_3d.h
"../context.h"
"ogl3_texture.h"
 
1486958966 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_vbo.h
"ogl3.h"
"../context.h"
 
1486958997 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_shader.h
"ogl3.h"
"../shader.h"
 
1486958945 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_driver.cpp
"../../device/device.h"
"ogl3_context.h"
"ogl3_driver.h"
<cstddef>
 
1486958945 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_fbo.cpp
"ogl3_fbo.h"
 
1486959013 /root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_fbo.h
"ogl3.h"
"../fbo.h"
 
1486958945 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_shader.cpp
"../material.h"
"ogl3_shader.h"
<stdlib.h>
<string.h>
 
1486958945 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_texture.cpp
"ogl3_texture.h"
<memory.h>
<GL/gl.h>
 
1486958945 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_texture_3d.cpp
"ogl3_texture_3d.h"
"../texture3d.h"
<memory.h>
<GL/gl.h>
 
1486958945 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_texture_array.cpp
"ogl3_texture_array.h"
"../texture_array.h"
<memory.h>
<GL/gl.h>
 
1486958945 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl3/ogl3_vbo.cpp
"ogl3_vbo.h"
<memory.h>
<GL/gl.h>
 
1487021741 /root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_context.h
"ogl4.h"
"../context.h"
 
1486419323 /root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4.h
<opengl/GLee.h>
<opengl/GLTool.h>
<GL/glx.h>
<windows.h>
 
1487027041 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_driver.cpp
"../../device/device.h"
"ogl4_context.h"
"ogl4_driver.h"
<cstddef>
 
1487021565 /root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_driver.h
"ogl4.h"
"../driver.h"
 
1487021533 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_fbo.cpp
"ogl4_fbo.h"
 
1487021574 /root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_fbo.h
"ogl4.h"
"../fbo.h"
 
1487021533 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_shader.cpp
"../material.h"
"ogl4_shader.h"
<stdlib.h>
<string.h>
 
1487021580 /root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_shader.h
"ogl4.h"
"../shader.h"
 
1487021533 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_texture.cpp
"ogl4_texture.h"
<memory.h>
<GL/gl.h>
 
1487021587 /root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_texture.h
"ogl4.h"
"../context.h"
 
1487021533 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_texture_3d.cpp
"ogl4_texture_3d.h"
"../texture3d.h"
<memory.h>
<GL/gl.h>
 
1487021594 /root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_texture_3d.h
"../context.h"
"ogl4_texture.h"
 
1487021533 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_texture_array.cpp
"ogl4_texture_array.h"
"../texture_array.h"
<memory.h>
<GL/gl.h>
 
1487021608 /root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_texture_array.h
"../context.h"
"ogl4_texture.h"
 
1487021533 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_vbo.cpp
"ogl4_vbo.h"
<memory.h>
<GL/gl.h>
 
1487021616 /root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_vbo.h
"ogl4.h"
"../context.h"
 
1487028693 source:/root/Documents/Sleek Think2/src/sleek/driver/ogl4/ogl4_context.cpp
"../../device/device.h"
"ogl4_context.h"
"ogl4_driver.h"
"ogl4_texture.h"
"ogl4_texture_array.h"
"ogl4_texture_3d.h"
"ogl4_vbo.h"
"ogl4_shader.h"
<string.h>
 
1490556523 source:/root/Documents/svn/Sleek Think2/src/app/GameCore.cpp
"GameCore.h"
"../sleek/loader/texture_loader.h"
<string>
<sstream>
 
1486419323 /root/Documents/svn/Sleek Think2/src/app/GameCore.h
"GameMenu.h"
"GameEngine.h"
"GameIntro.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/app/GameMenu.h
"../sleek/start.h"
"../sleek/gui/interface.h"
"GuiEventMapper.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/start.h
"device/device.h"
"device/splash.h"
"driver/context.h"
"driver/driver.h"
"node/engine.h"
"loader/loader.h"
 
1486954740 /root/Documents/svn/Sleek Think2/src/sleek/device/device.h
"icone.h"
"device_stub.h"
"../define.h"
"../driver/texture.h"
"../os/cpuid.h"
"../math/fps_counter.h"
"event.h"
<memory>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/icone.h
 
1487022844 /root/Documents/svn/Sleek Think2/src/sleek/device/device_stub.h
"../math/timer.h"
"../math/vector2d.h"
<string>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/math/timer.h
"../os/os.h"
"../define.h"
<chrono>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/os/os.h
<time.h>
<fstream>
<iostream>
<string>
"../define.h"
<math.h>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/define.h
"compile.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/compile.h
<windows.h>
<stdio.h>
<time.h>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/math/vector2d.h
"../library/glm/vec2.hpp"
"../define.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/vec2.hpp
"detail/type_vec2.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_vec2.hpp
"type_vec.hpp"
"_swizzle.hpp"
"_swizzle_func.hpp"
<cstddef>
"type_vec2.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_vec.hpp
"precision.hpp"
"type_int.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/precision.hpp
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_int.hpp
"setup.hpp"
<type_traits>
<cstdint>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/setup.hpp
<cassert>
<cstddef>
<cuda.h>
<x86intrin.h>
<immintrin.h>
<immintrin.h>
<smmintrin.h>
<pmmintrin.h>
<emmintrin.h>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/_swizzle.hpp
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/_swizzle_func.hpp
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_vec2.inl
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/driver/texture.h
<iosfwd>
<fstream>
<string>
<memory>
"../math/vector2d.h"
"../math/vector3d.h"
"../math/pixel.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/math/vector3d.h
"../library/glm/vec3.hpp"
"../define.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/vec3.hpp
"detail/type_vec3.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_vec3.hpp
"type_vec.hpp"
"_swizzle.hpp"
"_swizzle_func.hpp"
<cstddef>
"type_vec3.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_vec3.inl
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/math/pixel.h
"../define.h"
"../math/function.h"
"vector3d.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/math/function.h
<memory>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/os/cpuid.h
"os.h"
<string>
<vector>
<memory>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/math/fps_counter.h
"timer.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/event.h
"../os/os.h"
"../gui/type.h"
"keycode.h"
"../math/vector2d.h"
<vector>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/gui/type.h
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/keycode.h
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/splash.h
"device.h"
<functional>
 
1486960453 /root/Documents/svn/Sleek Think2/src/sleek/driver/context.h
"../compile.h"
"../device/device_stub.h"
"../math/aabbox.h"
"identifier.h"
"shader.h"
"mesh.h"
"texture.h"
"texture_array.h"
"texture3d.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/math/aabbox.h
"vector2d.h"
"vector3d.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/driver/identifier.h
<memory>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/driver/shader.h
"texture.h"
"identifier.h"
"../math/vector3d.h"
<vector>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/driver/mesh.h
"context.h"
"material.h"
"vertex.h"
"index.h"
 
1486957803 /root/Documents/svn/Sleek Think2/src/sleek/driver/material.h
"../compile.h"
"../define.h"
"shader.h"
"rtype.h"
"context.h"
"material.h"
"../math/vector3d.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/driver/rtype.h
"rtype.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/driver/vertex.h
<vector>
"texture.h"
"../math/aabbox.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/driver/index.h
"../define.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/driver/texture_array.h
"texture.h"
<vector>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/driver/texture3d.h
<iosfwd>
<fstream>
<string>
<memory>
"texture.h"
"../math/vector2d.h"
"../math/vector3d.h"
"../math/pixel.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/driver/driver.h
"fbo.h"
"texture.h"
"../device/device.h"
"../compile.h"
"material.h"
"geometry.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/driver/fbo.h
<iosfwd>
<fstream>
<string>
"../math/vector2d.h"
"../math/vector3d.h"
"../math/pixel.h"
"material.h"
"context.h"
 
1490568487 /root/Documents/svn/Sleek Think2/src/sleek/driver/geometry.h
"../math/aabbox.h"
<vector>
"mesh.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/node/engine.h
"../device/device.h"
"../driver/fbo.h"
"billboard/billboard.h"
"billboard/sprite.h"
"camera/camera.h"
"real/natif.h"
"real/octree.h"
"real/grid.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/node/billboard/billboard.h
"../node.h"
"../math/timer.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/node/node.h
"../reference.h"
"../driver/mesh.h"
"../driver/driver.h"
"../driver/geometry.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/reference.h
"math/aabbox.h"
"define.h"
<vector>
<string>
<memory>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/node/billboard/sprite.h
"billboard.h"
"../math/timer.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/node/camera/camera.h
"frustum.h"
"../device/event.h"
"../math/aabbox.h"
"../../library/glm/mat4x4.hpp"
"../../reference.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/node/camera/frustum.h
"../../math/vector3d.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/mat4x4.hpp
"detail/type_mat4x4.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat4x4.hpp
"../fwd.hpp"
"type_vec4.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat4x4.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/fwd.hpp
"detail/type_int.hpp"
"detail/type_float.hpp"
"detail/type_vec.hpp"
"detail/type_mat.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_float.hpp
"setup.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat.hpp
"precision.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_vec4.hpp
"setup.hpp"
"type_vec.hpp"
"_swizzle.hpp"
"_swizzle_func.hpp"
<cstddef>
"type_vec4.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_vec4.inl
"type_vec4_sse2.inl"
"type_vec4_avx.inl"
"type_vec4_avx2.inl"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_vec4_sse2.inl
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_vec4_avx.inl
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_vec4_avx2.inl
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat4x4.inl
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/node/real/natif.h
"../node.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/node/real/octree.h
"natif.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/node/real/grid.h
"../node.h"
"../math/timer.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/loader/loader.h
<vector>
"mesh_loader.h"
"texture_loader.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/loader/mesh_loader.h
<string>
<memory>
"../io/filesystem.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/io/filesystem.h
"directory.h"
"filereader.h"
"filewriter.h"
<vector>
"archive.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/io/directory.h
<string>
<memory>
"../define.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/io/filereader.h
<string>
<memory>
"../define.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/io/filewriter.h
<string>
<memory>
"../define.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/io/archive.h
<memory>
<string>
"filesystem.h"
"filereader.h"
"filewriter.h"
"directory.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/loader/texture_loader.h
<string>
<memory>
"../io/filesystem.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/gui/interface.h
"font.h"
"frame.h"
"theme.h"
"cursor.h"
"../driver/fbo.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/gui/font.h
"../driver/texture.h"
"../math/aabbox.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/gui/frame.h
"font.h"
"type.h"
"../compile.h"
"../driver/texture.h"
"../driver/material.h"
"../device/event.h"
"../reference.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/gui/theme.h
"../driver/driver.h"
"../driver/material.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/gui/cursor.h
"interface.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/app/GuiEventMapper.h
"../gui/frame.h"
<map>
 
1486419323 /root/Documents/svn/Sleek Think2/src/app/GameEngine.h
"../sleek/start.h"
"../sleek/driver/mesh.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/app/GameIntro.h
"../sleek/video/video.h"
"../sleek/driver/driver.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/video/video.h
"../compile.h"
"../define.h"
"../math/vector2d.h"
"../math/timer.h"
"../driver/texture.h"
"../driver/context.h"
<theora/TheoraPlayer.h>
"audio.h"
<vector>
<string>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraPlayer.h
"TheoraVideoManager.h"
"TheoraVideoClip.h"
"TheoraVideoFrame.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraVideoManager.h
<vector>
<string>
"TheoraExport.h"
"TheoraVideoClip.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraExport.h
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraVideoClip.h
<string>
"TheoraExport.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraVideoFrame.h
<theora/TheoraExport.h>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/video/audio.h
"../compile.h"
<AL/al.h>
<AL/alc.h>
<theora/TheoraAudioInterface.h>
<theora/TheoraTimer.h>
<theora/TheoraVideoClip.h>
<queue>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraAudioInterface.h
"TheoraExport.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraTimer.h
"TheoraExport.h"
 
1490600493 source:/root/Documents/svn/Sleek Think2/src/app/GameEngine.cpp
"GameCore.h"
"GameEngine.h"
"../sleek/loader/texture_loader.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/app/GameIntro.cpp
"GameCore.h"
"GameIntro.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/app/GameMenu.cpp
"nuklear/nuklear.h"
"GameCore.h"
"GameMenu.h"
"../sleek/loader/texture_loader.h"
"../sleek/gui/frame.h"
"../sleek/gui/button.h"
"../sleek/gui/colorpicker.h"
"../sleek/gui/font.h"
"../sleek/gui/window.h"
"nuklear/overview.cpp"
"nuklear/node_editor.cpp"
"nuklear/calculator.cpp"
 
1487021688 /root/Documents/svn/Sleek Think2/src/app/nuklear/nuklear.h
<stdio.h>
<stdlib.h>
<stdint.h>
<stdarg.h>
<string.h>
<math.h>
<assert.h>
<math.h>
<limits.h>
<time.h>
<nuklear.h>
"../../sleek/start.h"
"../../sleek/driver/ogl3/ogl3.h"
 
1486419319 /root/Documents/svn/Sleek Think2/lib/include/nuklear.h
"nuklear.h"
<stdint.h>
<stdlib.h>
<stdio.h>
<stdarg.h>
<assert.h>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3.h
<opengl/GLee.h>
<opengl/GLTool.h>
<GL/glx.h>
<windows.h>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/opengl/GLee.h
<windows.h>
<GL/gl.h>
<OpenGL/gl.h>
<GL/gl.h>
<GL/glx.h>
<stddef.h>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/opengl/GLTool.h
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/gui/button.h
"frame.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/gui/colorpicker.h
"frame.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/gui/window.h
"button.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/app/nuklear/overview.cpp
 
1486419323 /root/Documents/svn/Sleek Think2/src/app/nuklear/node_editor.cpp
 
1486419323 /root/Documents/svn/Sleek Think2/src/app/nuklear/calculator.cpp
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/app/main.cpp
"../sleek/device/splash.h"
"../sleek/loader/texture_loader.h"
"GameCore.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/device/common/sdl.cpp
"sdl.h"
<X11/Xlib.h>
<SDL2/SDL.h>
<SDL2/SDL_video.h>
<SDL2/SDL_syswm.h>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/common/sdl.h
"../../define.h"
"../../compile.h"
"../device.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/device/common/sdl2.cpp
"sdl2.h"
<X11/Xlib.h>
<SDL2/SDL.h>
<SDL2/SDL_video.h>
<SDL2/SDL_syswm.h>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/common/sdl2.h
"../../define.h"
"../../compile.h"
"../device.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/device/common/win.cpp
"win.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/common/win.h
"../device.h"
"../../define.h"
<windows.h>
 
1487024945 source:/root/Documents/svn/Sleek Think2/src/sleek/device/common/x11.cpp
"x11.h"
<X11/Xlib.h>
<X11/extensions/xf86vmode.h>
 
1487022934 /root/Documents/svn/Sleek Think2/src/sleek/device/common/x11.h
"../device.h"
"../../define.h"
<stdio.h>
<stdlib.h>
<X11/Xlib.h>
<X11/Xutil.h>
<X11/Xos.h>
<X11/Xatom.h>
<X11/keysym.h>
<GL/glx.h>
<fcntl.h>
<unistd.h>
<sys/utsname.h>
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/device/device.cpp
"device.h"
"common/sdl.h"
"common/sdl2.h"
"common/win.h"
"common/x11.h"
"common/xf86.h"
<iostream>
"console/spdlog.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/common/xf86.h
"../device.h"
"../../define.h"
<stdio.h>
<stdlib.h>
<GL/glx.h>
<X11/Xos.h>
<X11/Xlib.h>
<X11/Xutil.h>
<X11/Xatom.h>
<X11/keysym.h>
<sys/utsname.h>
<X11/extensions/xf86vmode.h>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/spdlog.h
"common.h"
"logger.h"
"details/spdlog_impl.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/common.h
<string>
<initializer_list>
<chrono>
<memory>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/logger.h
<vector>
<memory>
"sinks/base_sink.h"
"common.h"
"./details/logger_impl.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/sinks/base_sink.h
<string>
<mutex>
<atomic>
"./sink.h"
"../formatter.h"
"../common.h"
"../details/log_msg.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/sinks/sink.h
"../details/log_msg.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/details/log_msg.h
"../common.h"
"./format.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/details/format.h
<stdint.h>
<cassert>
<cmath>
<cstddef>
<cstdio>
<algorithm>
<limits>
<stdexcept>
<string>
<sstream>
<iterator>
<utility>
"format.cc"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/details/format.cc
<string.h>
<cctype>
<cerrno>
<climits>
<cmath>
<cstdarg>
<cstring>
<windows.h>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/formatter.h
"details/log_msg.h"
"details/pattern_formatter_impl.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/details/pattern_formatter_impl.h
<string>
<chrono>
<memory>
<vector>
<thread>
"../formatter.h"
"./log_msg.h"
"./os.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/details/os.h
<string>
<cstdio>
<ctime>
<Windows.h>
"../common.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/details/logger_impl.h
"./line_logger.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/details/line_logger.h
<type_traits>
"../common.h"
"../logger.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/details/spdlog_impl.h
"registry.h"
"../sinks/file_sinks.h"
"../sinks/stdout_sinks.h"
"../sinks/syslog_sink.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/details/registry.h
<string>
<mutex>
<unordered_map>
<functional>
"../logger.h"
"../async_logger.h"
"../common.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/async_logger.h
<chrono>
<functional>
"common.h"
"logger.h"
"spdlog.h"
"./details/async_logger_impl.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/details/async_logger_impl.h
"./async_log_helper.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/details/async_log_helper.h
<chrono>
<thread>
<atomic>
<functional>
"../common.h"
"../sinks/sink.h"
"./mpmc_bounded_q.h"
"./log_msg.h"
"./format.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/details/mpmc_bounded_q.h
<atomic>
"../common.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/sinks/file_sinks.h
<mutex>
"base_sink.h"
"../details/null_mutex.h"
"../details/file_helper.h"
"../details/format.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/details/null_mutex.h
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/details/file_helper.h
<string>
<thread>
<chrono>
"os.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/sinks/stdout_sinks.h
<iostream>
<mutex>
"./ostream_sink.h"
"../details/null_mutex.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/sinks/ostream_sink.h
<ostream>
<mutex>
<memory>
"../details/null_mutex.h"
"./base_sink.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/device/console/sinks/syslog_sink.h
<array>
<string>
<syslog.h>
"./sink.h"
"../common.h"
"../details/log_msg.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/device/event.cpp
"event.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/device/splash.cpp
"../driver/driver.h"
"../gui/interface.h"
"splash.h"
 
1486959275 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/context.cpp
"context.h"
"ogl3/ogl3_context.h"
"ogl4/ogl4_context.h"
 
1486959035 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_context.h
"ogl3.h"
"../context.h"
 
1487021741 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_context.h
"ogl4.h"
"../context.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4.h
<opengl/GLee.h>
<opengl/GLTool.h>
<GL/glx.h>
<windows.h>
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/driver.cpp
"../device/device.h"
"driver.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/fbo.cpp
"fbo.h"
 
1490600400 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/geometry.cpp
"mesh.h"
"geometry.h"
"vertex.h"
"index.h"
<math.h>
"../library/glm/glm.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/glm.hpp
"detail/_fixes.hpp"
<cmath>
<climits>
<cfloat>
<limits>
<cassert>
"fwd.hpp"
"vec2.hpp"
"vec3.hpp"
"vec4.hpp"
"mat2x2.hpp"
"mat2x3.hpp"
"mat2x4.hpp"
"mat3x2.hpp"
"mat3x3.hpp"
"mat3x4.hpp"
"mat4x2.hpp"
"mat4x3.hpp"
"mat4x4.hpp"
"trigonometric.hpp"
"exponential.hpp"
"common.hpp"
"packing.hpp"
"geometric.hpp"
"matrix.hpp"
"vector_relational.hpp"
"integer.hpp"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/_fixes.hpp
<cmath>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/vec4.hpp
"detail/type_vec4.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/mat2x2.hpp
"detail/type_mat2x2.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat2x2.hpp
"../fwd.hpp"
"type_vec2.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat2x2.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat2x2.inl
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/mat2x3.hpp
"detail/type_mat2x3.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat2x3.hpp
"../fwd.hpp"
"type_vec2.hpp"
"type_vec3.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat2x3.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat2x3.inl
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/mat2x4.hpp
"detail/type_mat2x4.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat2x4.hpp
"../fwd.hpp"
"type_vec2.hpp"
"type_vec4.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat2x4.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat2x4.inl
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/mat3x2.hpp
"detail/type_mat3x2.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat3x2.hpp
"../fwd.hpp"
"type_vec2.hpp"
"type_vec3.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat3x2.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat3x2.inl
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/mat3x3.hpp
"detail/type_mat3x3.hpp"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat3x3.hpp
"../fwd.hpp"
"type_vec3.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat3x3.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat3x3.inl
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/mat3x4.hpp
"detail/type_mat3x4.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat3x4.hpp
"../fwd.hpp"
"type_vec3.hpp"
"type_vec4.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat3x4.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat3x4.inl
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/mat4x2.hpp
"detail/type_mat4x2.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat4x2.hpp
"../fwd.hpp"
"type_vec2.hpp"
"type_vec4.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat4x2.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat4x2.inl
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/mat4x3.hpp
"detail/type_mat4x3.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat4x3.hpp
"../fwd.hpp"
"type_vec3.hpp"
"type_vec4.hpp"
"type_mat.hpp"
<limits>
<cstddef>
"type_mat4x3.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_mat4x3.inl
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/trigonometric.hpp
"detail/func_trigonometric.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_trigonometric.hpp
"setup.hpp"
"precision.hpp"
"func_trigonometric.inl"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_trigonometric.inl
"_vectorize.hpp"
<cmath>
<limits>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/_vectorize.hpp
"type_vec1.hpp"
"type_vec2.hpp"
"type_vec3.hpp"
"type_vec4.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_vec1.hpp
"../fwd.hpp"
"type_vec.hpp"
"_swizzle.hpp"
"_swizzle_func.hpp"
<cstddef>
"type_vec1.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_vec1.inl
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/exponential.hpp
"detail/func_exponential.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_exponential.hpp
"type_vec1.hpp"
"type_vec2.hpp"
"type_vec3.hpp"
"type_vec4.hpp"
<cmath>
"func_exponential.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_exponential.inl
"func_vector_relational.hpp"
"_vectorize.hpp"
<limits>
<cmath>
<cassert>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_vector_relational.hpp
"precision.hpp"
"setup.hpp"
"func_vector_relational.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_vector_relational.inl
<limits>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/common.hpp
"detail/func_common.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_common.hpp
"setup.hpp"
"precision.hpp"
"type_int.hpp"
"_fixes.hpp"
"func_common.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_common.inl
"func_vector_relational.hpp"
"type_vec2.hpp"
"type_vec3.hpp"
"type_vec4.hpp"
"_vectorize.hpp"
<limits>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/packing.hpp
"detail/func_packing.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_packing.hpp
"type_vec2.hpp"
"type_vec4.hpp"
"func_packing.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_packing.inl
"func_common.hpp"
"type_half.hpp"
"../fwd.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_half.hpp
"setup.hpp"
"type_half.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/type_half.inl
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/geometric.hpp
"detail/func_geometric.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_geometric.hpp
"type_vec3.hpp"
"func_geometric.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_geometric.inl
"func_exponential.hpp"
"func_common.hpp"
"type_vec2.hpp"
"type_vec4.hpp"
"type_float.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/matrix.hpp
"detail/func_matrix.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_matrix.hpp
"../detail/precision.hpp"
"../detail/setup.hpp"
"../detail/type_mat.hpp"
"../vec2.hpp"
"../vec3.hpp"
"../vec4.hpp"
"../mat2x2.hpp"
"../mat2x3.hpp"
"../mat2x4.hpp"
"../mat3x2.hpp"
"../mat3x3.hpp"
"../mat3x4.hpp"
"../mat4x2.hpp"
"../mat4x3.hpp"
"../mat4x4.hpp"
"func_matrix.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_matrix.inl
"../geometric.hpp"
<limits>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/vector_relational.hpp
"detail/func_vector_relational.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/integer.hpp
"detail/func_integer.hpp"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_integer.hpp
"setup.hpp"
"precision.hpp"
"func_common.hpp"
"func_vector_relational.hpp"
"func_integer.inl"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/detail/func_integer.inl
"type_vec2.hpp"
"type_vec3.hpp"
"type_vec4.hpp"
"type_int.hpp"
"_vectorize.hpp"
<intrin.h>
<limits>
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/identifier.cpp
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/index.cpp
"index.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/mesh.cpp
"mesh.h"
 
1487026039 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_context.cpp
"../../device/device.h"
"ogl3_context.h"
"ogl3_driver.h"
"ogl3_texture.h"
"ogl3_texture_array.h"
"ogl3_texture_3d.h"
"ogl3_vbo.h"
"ogl3_shader.h"
<string.h>
 
1486959024 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_driver.h
"ogl3.h"
"../driver.h"
 
1486958986 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_texture.h
"ogl3.h"
"../context.h"
 
1486958945 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_texture_array.h
"../context.h"
"ogl3_texture.h"
 
1486958980 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_texture_3d.h
"../context.h"
"ogl3_texture.h"
 
1486958966 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_vbo.h
"ogl3.h"
"../context.h"
 
1486958997 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_shader.h
"ogl3.h"
"../shader.h"
 
1490576246 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_driver.cpp
"../../device/device.h"
"ogl3_context.h"
"ogl3_driver.h"
<cstddef>
 
1486958945 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_fbo.cpp
"ogl3_fbo.h"
 
1486959013 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_fbo.h
"ogl3.h"
"../fbo.h"
 
1486958945 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_shader.cpp
"../material.h"
"ogl3_shader.h"
<stdlib.h>
<string.h>
 
1486958945 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_texture.cpp
"ogl3_texture.h"
<memory.h>
<GL/gl.h>
 
1486958945 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_texture_3d.cpp
"ogl3_texture_3d.h"
"../texture3d.h"
<memory.h>
<GL/gl.h>
 
1486958945 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_texture_array.cpp
"ogl3_texture_array.h"
"../texture_array.h"
<memory.h>
<GL/gl.h>
 
1486958945 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl3/ogl3_vbo.cpp
"ogl3_vbo.h"
<memory.h>
<GL/gl.h>
 
1487028693 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_context.cpp
"../../device/device.h"
"ogl4_context.h"
"ogl4_driver.h"
"ogl4_texture.h"
"ogl4_texture_array.h"
"ogl4_texture_3d.h"
"ogl4_vbo.h"
"ogl4_shader.h"
<string.h>
 
1487021565 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_driver.h
"ogl4.h"
"../driver.h"
 
1487021587 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_texture.h
"ogl4.h"
"../context.h"
 
1487021608 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_texture_array.h
"../context.h"
"ogl4_texture.h"
 
1487021594 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_texture_3d.h
"../context.h"
"ogl4_texture.h"
 
1487021616 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_vbo.h
"ogl4.h"
"../context.h"
 
1487021580 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_shader.h
"ogl4.h"
"../shader.h"
 
1487029438 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_driver.cpp
"../../device/device.h"
"ogl4_context.h"
"ogl4_driver.h"
<cstddef>
 
1487021533 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_fbo.cpp
"ogl4_fbo.h"
 
1487021574 /root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_fbo.h
"ogl4.h"
"../fbo.h"
 
1487021533 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_shader.cpp
"../material.h"
"ogl4_shader.h"
<stdlib.h>
<string.h>
 
1487021533 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_texture.cpp
"ogl4_texture.h"
<memory.h>
<GL/gl.h>
 
1487021533 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_texture_3d.cpp
"ogl4_texture_3d.h"
"../texture3d.h"
<memory.h>
<GL/gl.h>
 
1487021533 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_texture_array.cpp
"ogl4_texture_array.h"
"../texture_array.h"
<memory.h>
<GL/gl.h>
 
1487021533 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/ogl4/ogl4_vbo.cpp
"ogl4_vbo.h"
<memory.h>
<GL/gl.h>
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/shader.cpp
"../driver/context.h"
"material.h"
"shader.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/texture.cpp
"texture.h"
"context.h"
<memory.h>
<GL/gl.h>
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/texture3d.cpp
"texture3d.h"
"context.h"
<memory.h>
<GL/gl.h>
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/driver/texture_array.cpp
"texture_array.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/gui/button.cpp
"interface.h"
"button.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/gui/colorpicker.cpp
"colorpicker.h"
"interface.h"
"scrollbar.h"
"button.h"
"../driver/texture.h"
"../math/vector3d.h"
"../math/function.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/gui/scrollbar.h
"frame.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/gui/cursor.cpp
"interface.h"
"cursor.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/gui/font.cpp
"interface.h"
"font.h"
<ft2build.h>
 
1486419319 /root/Documents/svn/Sleek Think2/lib/include/ft2build.h
<freetype/config/ftheader.h>
 
1486419319 /root/Documents/svn/Sleek Think2/lib/include/freetype/config/ftheader.h
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/gui/frame.cpp
"interface.h"
"frame.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/gui/interface.cpp
"interface.h"
"button.h"
"statictext.h"
"progressbar.h"
"scrollbar.h"
"picture.h"
"window.h"
<algorithm>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/gui/statictext.h
"frame.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/gui/progressbar.h
"frame.h"
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/gui/picture.h
"frame.h"
"../driver/texture.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/gui/picture.cpp
"interface.h"
"picture.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/gui/progressbar.cpp
"interface.h"
"progressbar.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/gui/scrollbar.cpp
"interface.h"
"scrollbar.h"
"../math/function.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/gui/statictext.cpp
"interface.h"
"statictext.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/gui/theme.cpp
"interface.h"
"../driver/driver.h"
"theme.h"
"button.h"
"font.h"
"picture.h"
"progressbar.h"
"statictext.h"
"window.h"
"scrollbar.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/gui/window.cpp
"interface.h"
"window.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/io/filesystem.cpp
"filesystem.h"
"std/filesystem.h"
"../compile.h"
<memory>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/io/std/filesystem.h
"../../compile.h"
"../filesystem.h"
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/io/std/filesystem.cpp
"filesystem.h"
"directory.h"
"filereader.h"
"filewriter.h"
<unistd.h>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/io/std/directory.h
<vector>
"../directory.h"
<experimental/filesystem>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/io/std/filereader.h
"../filereader.h"
<fstream>
 
1486419323 /root/Documents/svn/Sleek Think2/src/sleek/io/std/filewriter.h
"../filewriter.h"
<fstream>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/library/opengl/GLee.c
<stdio.h>
<stdlib.h>
<string.h>
"GLee.h"
<Carbon/Carbon.h>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/library/opengl/GLTool.cpp
"gl.h"
"GLTool.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/opengl/gl.h
"gl_mangle.h"
<stdlib.h>
<windows.h>
<GL/glext.h>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraAsync.cpp
<stdio.h>
"TheoraAsync.h"
<windows.h>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraAsync.h
<pthread.h>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraAudioInterface.cpp
"TheoraAudioInterface.h"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraDataSource.cpp
<memory.h>
<iostream>
"TheoraDataSource.h"
"TheoraException.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraDataSource.h
<fstream>
<string>
"TheoraExport.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraException.h
<string>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraException.cpp
"TheoraException.h"
"TheoraUtil.h"
"TheoraVideoManager.h"
<stdio.h>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraUtil.h
<string>
<vector>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraFrameQueue.cpp
"TheoraFrameQueue.h"
"TheoraVideoFrame.h"
"TheoraUtil.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraFrameQueue.h
"TheoraAsync.h"
<list>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraTimer.cpp
"TheoraTimer.h"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraUtil.cpp
<unistd.h>
<stdio.h>
<algorithm>
<math.h>
<map>
"TheoraUtil.h"
"TheoraException.h"
<windows.h>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraVideoClip.cpp
<memory.h>
<ogg/ogg.h>
<vorbis/vorbisfile.h>
<theora/theoradec.h>
"TheoraVideoClip.h"
"TheoraVideoManager.h"
"TheoraVideoFrame.h"
"TheoraFrameQueue.h"
"TheoraAudioInterface.h"
"TheoraTimer.h"
"TheoraDataSource.h"
"TheoraUtil.h"
"TheoraException.h"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraVideoFrame.cpp
<memory.h>
<theora/theoradec.h>
"TheoraVideoFrame.h"
"TheoraVideoClip.h"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraVideoManager.cpp
"TheoraVideoManager.h"
"TheoraWorkerThread.h"
"TheoraVideoClip.h"
"TheoraAudioInterface.h"
"TheoraUtil.h"
"TheoraDataSource.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraWorkerThread.h
"TheoraAsync.h"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/library/theora/TheoraWorkerThread.cpp
"TheoraWorkerThread.h"
"TheoraVideoManager.h"
"TheoraVideoClip.h"
"TheoraUtil.h"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/loader/loader.cpp
"loader.h"
"../compile.h"
"mesh_3ds.h"
"mesh_txt.h"
"texture_bmp.h"
"texture_png.h"
"texture_tiff.h"
<iostream>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/loader/mesh_3ds.h
"mesh_loader.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/loader/mesh_txt.h
"mesh_loader.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/loader/texture_bmp.h
"texture_loader.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/loader/texture_png.h
"texture_loader.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/loader/texture_tiff.h
"texture_loader.h"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/loader/mesh_3ds.cpp
"mesh_3ds.h"
"../driver/mesh.h"
"../compile.h"
<sys/stat.h>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/loader/mesh_txt.cpp
"mesh_txt.h"
"../library/glm/detail/func_geometric.hpp"
"../driver/mesh.h"
"../compile.h"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/loader/texture_bmp.cpp
"texture_bmp.h"
"../driver/texture.h"
"../compile.h"
<stdlib.h>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/loader/texture_png.cpp
"texture_png.h"
"../driver/texture.h"
"../compile.h"
<stdlib.h>
<png.h>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/loader/texture_tiff.cpp
"texture_tiff.h"
"../driver/texture.h"
"../compile.h"
<tiffio.h>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/math/timer.cpp
"timer.h"
<sys/time.h>
<unistd.h>
<chrono>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/node/billboard/billboard.cpp
"../engine.h"
"billboard.h"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/node/billboard/sprite.cpp
"../engine.h"
"sprite.h"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/node/camera/camera.cpp
"../../device/device.h"
"../../library/glm/detail/func_geometric.hpp"
"../../library/glm/gtc/matrix_transform.hpp"
"../../library/glm/gtc/type_ptr.hpp"
"camera.h"
"GL/gl.h"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/gtc/matrix_transform.hpp
"../mat4x4.hpp"
"../vec2.hpp"
"../vec3.hpp"
"../vec4.hpp"
"../gtc/constants.hpp"
"matrix_transform.inl"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/gtc/constants.hpp
"../detail/setup.hpp"
"constants.inl"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/gtc/constants.inl
<limits>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/gtc/matrix_transform.inl
"../geometric.hpp"
"../trigonometric.hpp"
"../matrix.hpp"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/gtc/type_ptr.hpp
"../gtc/quaternion.hpp"
"../vec2.hpp"
"../vec3.hpp"
"../vec4.hpp"
"../mat2x2.hpp"
"../mat2x3.hpp"
"../mat2x4.hpp"
"../mat3x2.hpp"
"../mat3x3.hpp"
"../mat3x4.hpp"
"../mat4x2.hpp"
"../mat4x3.hpp"
"../mat4x4.hpp"
<cstring>
"type_ptr.inl"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/gtc/quaternion.hpp
"../mat3x3.hpp"
"../mat4x4.hpp"
"../vec3.hpp"
"../vec4.hpp"
"../gtc/constants.hpp"
"quaternion.inl"
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/gtc/quaternion.inl
"../trigonometric.hpp"
"../geometric.hpp"
"../exponential.hpp"
<limits>
 
1486419324 /root/Documents/svn/Sleek Think2/src/sleek/library/glm/gtc/type_ptr.inl
<cstring>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/node/camera/frustum.cpp
"frustum.h"
<math.h>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/node/engine.cpp
"engine.h"
<algorithm>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/node/node.cpp
"engine.h"
"node.h"
"../library/glm/detail/func_geometric.hpp"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/node/real/grid.cpp
"../engine.h"
"grid.h"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/node/real/natif.cpp
"../engine.h"
"natif.h"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/node/real/octree.cpp
"../engine.h"
"octree.h"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/os/cpuid.cpp
"cpuid.h"
<string.h>
<sys/types.h>
<sys/stat.h>
<linux/major.h>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/os/os.cpp
"string.h"
"os.h"
<stdlib.h>
<unistd.h>
<windows.h>
<X11/Xlib.h>
<X11/Xutil.h>
<sys/types.h>
<sys/sysctl.h>
 
1486419323 source:/root/Documents/svn/Sleek Think2/src/sleek/reference.cpp
"reference.h"
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/video/audio.cpp
"audio.h"
<climits>
<iostream>
 
1486419324 source:/root/Documents/svn/Sleek Think2/src/sleek/video/video.cpp
"../driver/context.h"
"video.h"
<theora/TheoraDataSource.h>
 
/SleekThink.layout
Cannot display: file marked as a binary type.
svn:mime-type = application/xml
/bin/gmon.out
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/gmon.out
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/lib/include/ecs.h
0,0 → 1,186
#pragma once
#include <vector>
#include <map>
 
namespace ecs
{
struct world;
typedef unsigned int entity;
 
struct component
{
virtual ~component() {}
};
 
struct system
{
system(world& world) : world_(world) {}
virtual void operator()() const {} // render
virtual void operator()(double delta) const {} // update
 
world& world_;
};
 
struct world
{
std::map<entity, std::vector<component*>> entities_;
std::vector<system*> systems_;
 
entity createEntity()
{
unsigned int id = static_cast<unsigned int>(entities_.size()) + 1;
entities_[id].reserve(0);
return id;
}
 
void removeEntity(const entity& id)
{
auto found = entities_.find(id);
if (found != entities_.end())
{
for (auto& c : entities_[id])
{
delete c;
}
 
entities_[id].clear();
entities_.erase(id);
}
}
 
void operator()()
{
for (auto& s : systems_)
{
s;
}
}
 
void operator()(double deltaTime)
{
for (auto& s : systems_)
{
(*s)(deltaTime);
}
}
 
template<typename c = component>
c* add(const entity& id)
{
if (!has<c>(id))
{
auto comp = new c;
entities_[id].push_back(comp);
return comp;
}
return nullptr;
}
 
template<typename c = component>
bool has(const entity& id)
{
for (const auto& comp : entities_[id])
{
if (dynamic_cast<c*>(comp)) { return true; }
}
return false;
}
 
template<typename c = component>
c* get(const entity& id)
{
for (auto& comp : entities_[id])
{
auto co = dynamic_cast<c*>(comp);
if (co) { return co; }
}
return nullptr;
}
 
template<typename c = component>
bool remove(const entity& id)
{
for (auto& comp : entities_[id])
{
auto cc = dynamic_cast<c*>(comp);
if (cc)
{
entities_[id].erase();
delete cc;
return true;
}
}
return false;
}
 
template<typename s = system>
s* add()
{
auto sys = new s(*this);
systems_.push_back(sys);
return sys;
}
 
template<typename s = system>
bool has() const
{
for (const auto& sys : systems_)
{
if (dynamic_cast<s*>(sys)) { return true; }
}
return false;
}
 
template<typename s = system>
s* get()
{
system* sys = nullptr;
for (const auto& sys : systems_)
{
sys = dynamic_cast<s*>(sys);
if (sys) { break; }
}
return sys;
}
 
template<typename s = system>
bool remove()
{
for (auto& system : systems_)
{
auto sys = dynamic_cast<s*>(system);
if (sys) { systems_.erase(sys); return true; }
}
return false;
}
 
template<typename c = component>
bool search(std::vector<entity>& vec, entity en)
{
for (auto& co : entities_[en])
{
auto c0 = dynamic_cast<c*>(co);
if (c0)
{
vec.push_back(en);
return true;
}
}
return false;
}
 
template<typename c = component, typename...Args>
std::vector<entity> search()
{
std::vector<entity> vec;
for (auto& e : entities_)
{
if (get<c>(e.first) && search<Args...>(vec, e.first))
{
continue;
}
}
return vec;
}
};
}
/lib/lib/win/libSDL.dll.a
Cannot display: file marked as a binary type.
svn:mime-type = application/x-archive
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/x-archive
\ No newline at end of property
Index: lib/lib/win/libSDL.la
===================================================================
--- lib/lib/win/libSDL.la (nonexistent)
+++ lib/lib/win/libSDL.la (revision 22)
@@ -0,0 +1,41 @@
+# libSDL.la - a libtool library file
+# Generated by ltmain.sh (GNU libtool) 2.2.6
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='../bin/SDL.dll'
+
+# Names of this library.
+library_names='libSDL.dll.a'
+
+# The name of the static archive.
+old_library='libSDL.a'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags=''
+
+# Libraries that this one depends upon.
+dependency_libs=' -luser32 -lgdi32 -lwinmm -ldxguid'
+
+# Names of additional weak libraries provided by this library
+weak_library_names=''
+
+# Version information for libSDL.
+current=11
+age=11
+revision=3
+
+# Is this an already installed library?
+installed=yes
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=no
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir='/usr/local/lib'
/lib/lib/win/libSDL.la
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: lib/lib/win/libSDLmain.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-archive
/lib/lib/win/libSDLmain.a
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/x-archive
\ No newline at end of property
Index: lib/lib/win/libavcodec.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-archive
/lib/lib/win/libavcodec.a
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/x-archive
\ No newline at end of property
Index: lib/lib/win/libavformat.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-archive
/lib/lib/win/libavformat.a
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/x-archive
\ No newline at end of property
Index: lib/lib/win/libavutil.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-archive
/lib/lib/win/libavutil.a
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/x-archive
\ No newline at end of property
Index: lib/lib/win/libfreetype.dll.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-archive
/lib/lib/win/libfreetype.dll.a
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/x-archive
\ No newline at end of property
Index: lib/lib/win/libmingw32.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-archive
/lib/lib/win/libmingw32.a
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/x-archive
\ No newline at end of property
Index: lib/lib/win/libmsvcrt.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-archive
/lib/lib/win/libmsvcrt.a
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/x-archive
\ No newline at end of property
Index: lib/lib/win/libmsvcrtd.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-archive
/lib/lib/win/libmsvcrtd.a
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/x-archive
\ No newline at end of property
Index: lib/lib/win/libpthreadGCE2.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-archive
/lib/lib/win/libpthreadGCE2.a
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/x-archive
\ No newline at end of property
Index: lib/lib/win/libwsock32.a
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-archive
/lib/lib/win/libwsock32.a
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/x-archive
\ No newline at end of property
Index: src/app/Core.cpp
===================================================================
--- src/app/Core.cpp (nonexistent)
+++ src/app/Core.cpp (revision 22)
@@ -0,0 +1,127 @@
+#include "Core.h"
+
+#include <string>
+#include <sstream>
+
+#ifdef __WIN32
+namespace std
+{
+ template <typename T>
+ string to_string(T const & t) {
+ ostringstream s;
+ s << t;
+ return s.str();
+ }
+}
+#endif // WIN32
+
+using namespace sleek;
+
+namespace sample
+{
+ Core::Core() noexcept
+ {
+ device::Device_stub info = device::Device_stub(800,600,32,false);
+ screen = CreateDeviceWindowManager(device::DWM_X11, info);
+ screen->setWindowPos((screen->getDesktopVideoSize()-screen->getInfo().size)/2);
+ screen->setCaption("SleekThink !");
+
+ renderer = createContextRenderer(driver::RCTX_OGL3, screen);
+ renderer->setAntialiasing(driver::DAM_FAST);
+ renderer->setViewport(screen->getInfo().size);
+ driver = renderer->createDriver();
+
+ fs = io::createFilesystem(io::FILE_SYSTEM_TYPE::FST_STD);
+ loader = std::make_shared<sleek::loader::loader>(fs);
+
+ guienv = sleek::gui::createGUIEnvironment(screen, driver);
+ guienv->getCursor()->showCursor(false);
+ guienv->getCursor()->showTexture(true);
+
+ pointor = loader->loadTexture("texture/pointor.bmp");
+ if(pointor)
+ {
+ pointor->createIdentifier(renderer.get());
+ pointor->getIdentifier()->update();
+ guienv->getCursor()->setTexture(pointor);
+ }
+
+ scene = new Engine(this);
+ screen->setEventReceiver(this);
+ }
+
+ Core::~Core() noexcept
+ {
+ screen->setEventReceiver(0);
+ }
+
+ sleek::gui::interface* Core::getGui() const noexcept
+ {
+ return guienv.get();
+ }
+
+ sleek::device::Device* Core::getDevice() const noexcept
+ {
+ return screen.get();
+ }
+
+ sleek::driver::driver* Core::getDriver() const noexcept
+ {
+ return driver.get();
+ }
+
+ sleek::driver::context* Core::getContext() const noexcept
+ {
+ return renderer.get();
+ }
+
+ sleek::loader::loader* Core::getLoader() const noexcept
+ {
+ return loader.get();
+ }
+
+ bool Core::manage(sleek::device::input *a) noexcept
+ {
+ guienv->manage(a);
+
+ if(a->type == sleek::device::EVENT_WINDOW_RESIZE)
+ renderer->setViewport(screen->getInfo().size);
+
+ event::manage(a);
+ return false;
+ }
+
+ void Core::run() noexcept
+ {
+ srand(clock());
+
+ math::timer tmp;
+ tmp.update();
+ tmp.reset();
+
+ while(screen->run())
+ {
+ tmp.update();
+
+ if(tmp.getTimeMsec() >= 1000)
+ {
+ std::string title = "Sleek-Think -- Fps(";
+ title += std::to_string(screen->getFpsCounter().getFps());
+ title += ") -- Time(~";
+ title += std::to_string(screen->getFpsCounter().getAvarageTime());
+ title += ")ms";
+ screen->setCaption(title);
+ tmp.reset();
+ }
+
+ screen->manage();
+ screen->begin();
+ renderer->bind();
+ renderer->begin(0xFF101010);
+ scene->render();
+ guienv->render();
+ renderer->end();
+ screen->end();
+ }
+ }
+}
Index: src/app/Core.h
===================================================================
--- src/app/Core.h (nonexistent)
+++ src/app/Core.h (revision 22)
@@ -0,0 +1,35 @@
+#ifndef SAMPLE_CORE
+#define SAMPLE_CORE
+
+#include "Engine.h"
+
+namespace sample
+{
+ class Core : public sleek::device::event
+ {
+ public:
+ Core() noexcept;
+ virtual ~Core() noexcept;
+
+ sleek::gui::interface* getGui() const noexcept;
+ sleek::device::Device* getDevice() const noexcept;
+ sleek::driver::driver* getDriver() const noexcept;
+ sleek::driver::context* getContext() const noexcept;
+ sleek::loader::loader* getLoader() const noexcept;
+
+ bool manage(sleek::device::input *a) noexcept override;
+
+ void run() noexcept;
+ private:
+ std::shared_ptr<sleek::device::Device> screen;
+ std::shared_ptr<sleek::gui::interface> guienv;
+ std::shared_ptr<sleek::driver::driver> driver;
+ std::shared_ptr<sleek::driver::context>renderer;
+ std::shared_ptr<sleek::loader::loader> loader;
+ std::shared_ptr<sleek::io::filesystem> fs;
+ std::shared_ptr<sleek::driver::texture>pointor;
+ private:
+ Engine *scene;
+ };
+}
+#endif
/src/app/Core.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/app/Engine.cpp
===================================================================
--- src/app/Engine.cpp (nonexistent)
+++ src/app/Engine.cpp (revision 22)
@@ -0,0 +1,188 @@
+#include "Core.h"
+#include "Engine.h"
+
+#include <iostream>
+#include <GL/gl.h>
+
+using namespace sleek;
+using namespace device;
+#define number 100
+
+namespace sample
+{
+ void associate(gui::frame *i) noexcept;
+
+ Engine::Engine(Core *mom) noexcept
+ : screen(mom->getDevice()), core(mom)
+ {
+ smgr = new sleek::scene3d::engine(screen, mom->getDriver());
+ rot = -10000;
+
+ texture = mom->getLoader()->loadTexture("texture/earth.bmp");
+ texture->createIdentifier(mom->getContext());
+ texture->getIdentifier()->update();
+
+ mat = std::make_shared<driver::material>();
+ mat->setMode(driver::rmd_polygon);
+// mat->setWireframe(driver::rwf_wireframe);
+ mat->setShadeModel(driver::rsd_flat);
+ mat->setFaceCulling(driver::rfc_off);
+ mat->setMaterialRender(driver::rmt_solid | driver::rmt_lighting);
+ mat->Texture.push_back(texture->getIdentifier().get());
+// mat->setShader(createShader());
+
+ driver::Geometry geom;
+
+// tmp.reset(geom.createCube(math::vec3f(15)));
+// tmp.reset(geom.createSphere(150, 15, 15));
+ tmp.reset(geom.createIcoSphere(150, 3));
+// tmp = mom->getLoader()->loadMesh("element/cube.3ds");
+
+ core->getContext()->createVAO(tmp.get());
+ tmp->getIdentifier()->update();
+
+ scene3d::Node *grid = new scene3d::real::Grid(smgr);
+ smgr->addSceneNode(grid);
+
+ node = new scene3d::real::Natif(smgr);
+ node->setPosition({0,20,0});
+ node->setMaterial(mat);
+ node->setMesh(tmp);
+ smgr->addSceneNode(node);
+
+
+ smgr->getCamera()->setRotation({0, 1, 0});
+ smgr->getCamera()->setTarget({0, 0, 0});
+ }
+
+ Engine::~Engine() noexcept
+ {
+ smgr->clear();
+ }
+
+ std::shared_ptr<sleek::driver::shader> Engine::createShader()
+ {
+ auto shade = core->getContext()->createShader();
+
+ // only need fragment shader and a vertex shader
+ shade->attacheShader(driver::shd_frag | driver::shd_vert);
+ // used to get information from material (like texture binding) by callback
+ shade->setLinkToMaterial(mat.get());
+
+ shade->setVertexShader(
+ "#version 330 core\n\
+ layout (location = 0) in vec3 iposition;\n\
+ layout (location = 1) in vec3 inormal;\n\
+ layout (location = 2) in vec4 icolor;\n\
+ layout (location = 3) in vec2 icoord;\n\
+ \n\
+ uniform mat4 model;\n\
+ uniform mat4 view;\n\
+ uniform mat4 projection;\n\
+ \n\
+ out vec3 Normal;\n\
+ out vec2 uv;\n\
+ \n\
+ void main()\n\
+ {\n\
+ mat4 model_view = view * model;\n\
+ Normal = mat3(transpose(inverse(model))) * inormal;\n\
+ uv = icoord;\n\
+ gl_Position = projection * view * model * vec4(iposition, 1.0f);\n\
+ }\n",
+ "main"
+ );
+
+ shade->setFragmentShader(
+ "#version 330 core\n\
+ in vec2 uv;\n\
+ in vec3 Normal;\n\
+ \n\
+ uniform sampler2D base;\n\
+ \n\
+ out vec4 color; \n\
+ \n\
+ float atan2(in float y, in float x)\n\
+ {\n\
+ bool s = (abs(x) > abs(y));\n\
+ return mix(3.14159265359/2.0 - atan(x,y), atan(y,x), s);\n\
+ }\n\
+ \n\
+ void main()\n\
+ {\n\
+ float uvx = 0.5f - atan2(Normal.z, Normal.x) / 3.14159265359 / 2;\n\
+ float uvy = 0.5f - Normal.y * 0.5;\n\
+ color = texture2D(base, vec2(uvx, uvy));\n\
+ }\n",
+ "main"
+ );
+
+ shade->setUserData(this);
+
+ shade->setCallback([](driver::shader *i) noexcept
+ {
+ Engine *engine = (Engine*)i->getUserData();
+
+ auto *camera = engine->getSceneManager()->getCamera();
+
+ glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat*)&engine->_model);
+
+
+ i->setVariable("model", engine->_model);
+ i->setVariable("view", camera->getPerspectivMatrix());
+ i->setVariable("projection", camera->getProjectionMatrix());
+//
+ i->setTexture("base", i->getLinkFromMaterial()->Texture[0], 0);
+ });
+
+ shade->compileShader();
+
+ return shade;
+ }
+
+ bool Engine::manage(sleek::device::input *a) noexcept
+ {
+ if(a->type == EVENT_KEY_UP)
+ {
+ //! engine test
+ if(a->key[KEY_F11])
+ screen->setFullScreen(!screen->getInfo().fullscreen);
+
+ //! vertex buffer object, disable and enable
+ if(a->key[KEY_KEY_Q])
+ {
+ core->getContext()->createVAO(tmp.get());
+ tmp->getIdentifier()->update();
+ }
+
+ if(a->key[KEY_KEY_W])
+ {
+ mat->setWireframe(
+ (mat->getWireframe()+1)%2
+ );
+ }
+
+ if(a->key[KEY_KEY_S])
+ {
+ tmp->setIdentifier(nullptr);
+ }
+
+ return true;
+ }
+ }
+
+ void Engine::render() noexcept
+ {
+ tm.update();
+ rot = tm.getTimeMsec()/50.0f;
+
+ smgr->getCamera()->setPosition(
+ math::vec3f(
+ sin(rot/100)*200, 250,
+ cos(rot/100)*200
+ )
+ );
+ smgr->getCamera()->updateProjection();
+ smgr->render();
+ }
+}
Index: src/app/Engine.h
===================================================================
--- src/app/Engine.h (nonexistent)
+++ src/app/Engine.h (revision 22)
@@ -0,0 +1,45 @@
+#ifndef SAMPLE_ENGINE
+#define SAMPLE_ENGINE
+
+#include "../sleek/start.h"
+#include "../sleek/driver/mesh.h"
+#include "../sleek/loader/texture_loader.h"
+#include "../sleek/gui/interface.h"
+#include "../sleek/math/math.h"
+
+#include <map>
+
+namespace sample
+{
+ class Core;
+ class Engine : public sleek::device::event
+ {
+ public:
+ Engine(Core*) noexcept;
+ virtual ~Engine() noexcept;
+
+ std::shared_ptr<sleek::driver::shader> createShader();
+
+ sleek::scene3d::engine* getSceneManager() { return smgr; }
+ sleek::device::Device* getDevice() { return screen; }
+ sleek::math::timer* getTimer() { return &tm; }
+
+ virtual bool manage(sleek::device::input*) noexcept;
+
+ sleek::math::mat4f _model;
+
+ virtual void render() noexcept;
+ private:
+ sleek::f32 rot;
+ std::shared_ptr<sleek::driver::texture> texture;
+ std::shared_ptr<sleek::driver::MeshBuffer> tmp;
+ std::shared_ptr<sleek::driver::material> mat;
+ private:
+ sleek::math::timer tm;
+ sleek::device::Device *screen;
+ sleek::scene3d::engine *smgr;
+ sleek::scene3d::real::Natif *node;
+ Core *core;
+ };
+}
+#endif // GAME_MENU
/src/app/Engine.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/app/main.cpp
===================================================================
--- src/app/main.cpp (revision 21)
+++ src/app/main.cpp (revision 22)
@@ -1,9 +1,8 @@
#include "../sleek/device/splash.h"
-#include "../sleek/loader/texture_loader.h"
-#include "GameCore.h"
+#include "../sleek/loader/texture_loader.h"
/**
- * Copyright 2010-2012 SleekThink and RedGhostBaggage Project. All rights reserved.
+ * Copyright 2010-2012 SleekThink All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
@@ -20,6 +19,8 @@
**/
/** Compilation need gcc 4.4.0 or highter **/
+#include "Core.h"
+
using namespace sleek;
using namespace sleek::device;
@@ -51,11 +52,8 @@
{
// do_splash();
- interne::GameCore *core = new interne::GameCore();
- core->launch();
- core->run();
- delete core;
-
+ sample::Core core;
+ core.run();
return 0;
}
/src/sleek/compile.h
20,8 → 20,8
#define texture_loader_png_support
#define texture_loader_tiff_support
 
#define video_reader_support
#define video_reader_audio_support
//#define video_reader_support
//#define video_reader_audio_support
 
#define reserved_texture 4
#define gui_frame_userdata 2
/src/sleek/define.h
23,7 → 23,8
{
static constexpr float PI = 3.14159265f;
static constexpr float DegToRad = PI/180.f;
static constexpr float RadToDeg = PI*180.f;
static constexpr float RadToDeg = PI*180.f;
static constexpr float RECIPROCAL_PI = 1.0/PI;
 
static constexpr const char *version = "0.4";
static constexpr const char *engine_name = "SleekThink";
/src/sleek/device/common/sdl.cpp
1,5 → 1,5
#include "sdl.h"
#if defined sdl2_device_support
#if defined sdl_device_support
 
#if defined __linux
#include <X11/Xlib.h>
9,43 → 9,12
#define SDL_VIDEO_DRIVER_X11
#endif
 
#include <SDL2/SDL.h>
#include <SDL2/SDL_video.h>
#include <SDL2/SDL_syswm.h>
extern "C" {
#include <SDL2/SDL.h>
#include <SDL2/SDL_video.h>
#include <SDL2/SDL_syswm.h>
}
 
typedef enum
{
SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */
SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */
SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */
SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */
SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */
SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */
SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */
SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */
SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */
SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */
SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */
SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000 /**< window should be created in high-DPI mode if supported */
} SDL_WindowFlags;
 
#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000
#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
#define SDL_WINDOWPOS_ISUNDEFINED(X) (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
 
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags);
extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window, const char *title);
extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window, int x, int y);
extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, int h);
extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window, SDL_bool bordered);
extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags);
extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window, const Uint16 * red, const Uint16 * green, const Uint16 * blue);
extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window);
extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, int w, int h);
 
namespace sleek
{
namespace device
56,17 → 25,26
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK);
atexit(SDL_Quit);
 
display = SDL_CreateWindow(
a.name.c_str(),
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
a.size.x, a.size.y,
0
);
const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo();
 
videoFlags = SDL_OPENGL;
videoFlags |= SDL_GL_DOUBLEBUFFER;
videoFlags |= SDL_HWPALETTE;
videoFlags |= SDL_RESIZABLE;
 
if(videoInfo->hw_available) videoFlags |= SDL_HWSURFACE;
else videoFlags |= SDL_SWSURFACE;
 
if(videoInfo->blit_hw)
videoFlags |= SDL_HWACCEL;
 
/* Sets up OpenGL double buffering */
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
 
display = SDL_SetVideoMode(a.size.x, a.size.y, a.bits, videoFlags);
 
SDL_SysWMinfo wminfo;
SDL_GetWindowWMInfo(display, &wminfo);
SDL_GetWMInfo(&wminfo);
 
running = display != 0;
 
77,13 → 55,13
}
 
#ifdef __linux
info.display = wminfo.info.x11.display;
info.window = &wminfo.info.x11.window;
info.visual = nullptr;
info.display = wminfo.info.x11.display;
info.window = &wminfo.info.x11.window;
info.visual = nullptr;
#else
info.display = nullptr;
info.window = &wminfo.window;
info.visual = nullptr;
info.display = nullptr;
info.window = &wminfo.window;
info.visual = nullptr;
#endif
 
welcomeMessage();
92,48 → 70,49
Device_sdl::~Device_sdl() noexcept
{
if(display != 0)
SDL_DestroyWindow(display);
SDL_FreeSurface(display);
SDL_Quit();
}
 
void Device_sdl::setCaption(const std::string &name) noexcept
{
Device::setCaption(name);
SDL_SetWindowTitle(display, name.c_str());
Device::setCaption(name);
SDL_WM_SetCaption(name.c_str(), "sleek-think");
}
 
void Device_sdl::setVideoSize(const math::vector2di &i) noexcept
void Device_sdl::setVideoSize(const math::vec2i &i) noexcept
{
Device::setVideoSize(i);
SDL_SetWindowSize(display, info.size.x, info.size.y);
//SDL_WM_SetIcon(IMG_ReadXPMFromArray((char**)Device_icone),0);
display = SDL_SetVideoMode(info.size.x, info.size.y, info.bits, videoFlags);
}
 
void Device_sdl::setWindowPos(const math::vector2di &i) noexcept
void Device_sdl::setWindowPos(const math::vec2i &i) noexcept
{
SDL_SetWindowPosition(display, i.x, i.y);
//SDL_SetWindowPosition(display, i.x, i.y);
}
 
void Device_sdl::enableWindowDecorator(bool z) noexcept
{
Device::enableWindowDecorator(z);
SDL_SetWindowFullscreen(display, z ? SDL_WINDOW_FULLSCREEN : 0);
videoFlags ^= z*SDL_NOFRAME;
display = SDL_SetVideoMode(info.size.x, info.size.y, info.bits, videoFlags);
}
 
void Device_sdl::setGamma(const math::pixel &c) noexcept
{
SDL_SetWindowGammaRamp(display, (Uint16*)&c.red, (Uint16*)&c.green, (Uint16*)&c.blue);
SDL_SetGammaRamp((Uint16*)&c.red, (Uint16*)&c.green, (Uint16*)&c.blue);
}
 
void Device_sdl::setFullScreen(bool f) noexcept
{
info.fullscreen = f;
SDL_SetWindowBordered(display, SDL_bool(f));
videoFlags ^= SDL_FULLSCREEN;
display = SDL_SetVideoMode(info.size.x, info.size.y, info.bits, videoFlags);
}
 
math::vector2di Device_sdl::getDesktopVideoSize() const noexcept
math::vec2i Device_sdl::getDesktopVideoSize() const noexcept
{
math::vector2di size;
math::vec2i size;
#ifndef __linux
const SDL_VideoInfo *hw = SDL_GetVideoInfo();
size.x = hw->current_w;
152,7 → 131,7
reading = true;
SDL_Event sdl_event;
 
SDL_PeepEvents(&sdl_event, 1, SDL_GETEVENT, SDL_ALLEVENTS);
SDL_PollEvent(&sdl_event);
SDL_GetMouseState(&current->mouse_pos.x,&current->mouse_pos.y);
 
if(sdl_event.type == SDL_QUIT)
167,7 → 146,6
{
if(!reading) return;
Device::begin();
SDL_PumpEvents();
}
 
bool Device_sdl::manage() noexcept
180,6 → 158,7
 
void Device_sdl::end() noexcept
{
SDL_GL_SwapBuffers();
if(!reading) return;
Device::end();
os::Sleeping(1);
186,12 → 165,12
reading = false;
}
 
void Device_sdl::WarpMouse(const math::vector2di &i) noexcept
void Device_sdl::WarpMouse(const math::vec2i &i) noexcept
{
SDL_WarpMouseInWindow(display, i.x, i.y);
SDL_WarpMouse(i.x, i.y);
}
 
void Device_sdl::ShowMouse(bool i)
void Device_sdl::ShowMouse(bool i) noexcept
{
SDL_ShowCursor(i);
}
203,6 → 182,11
else if(a.type == SDL_KEYUP) i->type = EVENT_KEY_UP;
else if(a.type == SDL_MOUSEBUTTONDOWN) i->type = EVENT_MOUSSE_DOWN;
else if(a.type == SDL_MOUSEBUTTONUP) i->type = EVENT_MOUSSE_UP;
else if(a.type == SDL_VIDEORESIZE)
{
setVideoSize({a.resize.w, a.resize.h});
i->type = EVENT_WINDOW_RESIZE;
}
else if(a.type == SDL_MOUSEMOTION) i->type = EVENT_MOUSSE_MOVED;
else i->type = EVENT_NOTHINK;
/** mouse event **/
/src/sleek/device/common/sdl.h
4,11 → 4,11
#include "../../define.h"
#include "../../compile.h"
 
#if defined sdl2_device_support
#if defined sdl_device_support
 
#include "../device.h"
 
typedef struct SDL_Window SDL_Window;
typedef struct SDL_Surface SDL_Surface;
typedef union SDL_Event SDL_Event;
 
namespace sleek
21,6 → 21,8
Device_sdl(const Device_stub&) noexcept;
virtual ~Device_sdl() noexcept;
 
virtual const DeviceWindowManager getType() const { return DWM_SDL; }
 
virtual bool run() noexcept;
virtual void begin(const math::pixel&) noexcept;
virtual bool manage() noexcept;
28,19 → 30,19
 
virtual void setGamma(const math::pixel&) noexcept;
virtual void setCaption(const std::string&) noexcept;
virtual void setVideoSize(const math::vector2di&) noexcept;
virtual void setWindowPos(const math::vector2di&) noexcept;
virtual void setVideoSize(const math::vec2i&) noexcept;
virtual void setWindowPos(const math::vec2i&) noexcept;
virtual void setFullScreen(bool) noexcept;
 
virtual void enableWindowDecorator(bool) noexcept;
virtual math::vector2di getDesktopVideoSize() const noexcept;
virtual math::vec2i getDesktopVideoSize() const noexcept;
 
virtual void WarpMouse(const math::vector2di&) noexcept;
virtual void WarpMouse(const math::vec2i&) noexcept;
virtual void ShowMouse(bool) noexcept;
protected:
Device_sdl(){}
int videoFlags;
void keymap(const SDL_Event&, input*) noexcept;
SDL_Window *display;
SDL_Surface *display;
};
}
}
/src/sleek/device/common/sdl2.cpp
0,0 → 1,331
#include "sdl2.h"
#if defined sdl2_device_support
 
#if defined __linux
#include <X11/Xlib.h>
#endif
 
#ifdef __linux
#define SDL_VIDEO_DRIVER_X11
#endif
 
extern "C" {
#include <SDL2/SDL.h>
#include <SDL2/SDL_video.h>
#include <SDL2/SDL_syswm.h>
}
 
namespace sleek
{
namespace device
{
Device_sdl2::Device_sdl2(const Device_stub &a) noexcept : Device(a)
{
display = 0;
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK);
atexit(SDL_Quit);
 
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
 
display = SDL_CreateWindow(
a.name.c_str(),
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
a.size.x, a.size.y,
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE |
a.fullscreen*SDL_WINDOW_FULLSCREEN
);
 
 
SDL_SysWMinfo wminfo;
SDL_GetWindowWMInfo(display, &wminfo);
 
running = display != 0;
 
if(!running)
{
std::cout << "Could not take device_sdl !!\n" << std::endl;
return;
}
 
#ifdef __linux
info.display = wminfo.info.x11.display;
info.window = &wminfo.info.x11.window;
info.visual = nullptr;
#else
info.display = nullptr;
info.window = &wminfo.window;
info.visual = nullptr;
#endif
 
SDL_GLContext glcontext = SDL_GL_CreateContext(display);
welcomeMessage();
}
 
Device_sdl2::~Device_sdl2() noexcept
{
if(display != 0)
SDL_DestroyWindow(display);
SDL_Quit();
}
 
void Device_sdl2::setCaption(const std::string &name) noexcept
{
Device::setCaption(name);
SDL_SetWindowTitle(display, name.c_str());
}
 
void Device_sdl2::setVideoSize(const math::vec2i &i) noexcept
{
Device::setVideoSize(i);
SDL_SetWindowSize(display, info.size.x, info.size.y);
//SDL_WM_SetIcon(IMG_ReadXPMFromArray((char**)Device_icone),0);
}
 
void Device_sdl2::setWindowPos(const math::vec2i &i) noexcept
{
SDL_SetWindowPosition(display, i.x, i.y);
}
 
void Device_sdl2::enableWindowDecorator(bool z) noexcept
{
Device::enableWindowDecorator(z);
SDL_SetWindowFullscreen(display, z ? SDL_WINDOW_FULLSCREEN : 0);
}
 
void Device_sdl2::setGamma(const math::pixel &c) noexcept
{
SDL_SetWindowGammaRamp(display, (Uint16*)&c.red, (Uint16*)&c.green, (Uint16*)&c.blue);
}
 
void Device_sdl2::setFullScreen(bool f) noexcept
{
info.fullscreen = f;
SDL_SetWindowBordered(display, SDL_bool(f));
}
 
math::vec2i Device_sdl2::getDesktopVideoSize() const noexcept
{
math::vec2i size;
#ifndef __linux
const SDL_VideoInfo *hw = SDL_GetVideoInfo();
size.x = hw->current_w;
size.y = hw->current_h;
#else
Display *display = XOpenDisplay(0);
size.x = DefaultScreenOfDisplay(display)->width;
size.y = DefaultScreenOfDisplay(display)->height;
XCloseDisplay(display);
#endif
return size;
}
 
bool Device_sdl2::run() noexcept
{
reading = true;
SDL_Event sdl_event;
 
SDL_PollEvent(&sdl_event);
SDL_GetMouseState(&current->mouse_pos.x,&current->mouse_pos.y);
 
if(sdl_event.type == SDL_QUIT)
current->exit_msg = true;
 
keymap(sdl_event, current);
 
return Device::run();
}
 
void Device_sdl2::begin(const math::pixel &color) noexcept
{
if(!reading) return;
Device::begin();
}
 
bool Device_sdl2::manage() noexcept
{
evt->manage(current);
current->clear();
running = evt->asRunning;
return true;
}
 
void Device_sdl2::end() noexcept
{
SDL_GL_SwapWindow(display);
if(!reading) return;
Device::end();
os::Sleeping(1);
reading = false;
}
 
void Device_sdl2::WarpMouse(const math::vec2i &i) noexcept
{
SDL_WarpMouseInWindow(display, i.x, i.y);
}
 
void Device_sdl2::ShowMouse(bool i) noexcept
{
SDL_ShowCursor(i);
}
 
void Device_sdl2::keymap(const SDL_Event &a, input *i) noexcept
{
/** event type **/
if(a.type == SDL_KEYDOWN) i->type = EVENT_KEY_DOWN;
else if(a.type == SDL_KEYUP) i->type = EVENT_KEY_UP;
else if(a.type == SDL_MOUSEBUTTONDOWN) i->type = EVENT_MOUSSE_DOWN;
else if(a.type == SDL_MOUSEBUTTONUP) i->type = EVENT_MOUSSE_UP;
else if(a.type == SDL_MOUSEMOTION) i->type = EVENT_MOUSSE_MOVED;
else if(a.type == SDL_WINDOWEVENT && a.window.event == SDL_WINDOWEVENT_RESIZED)
{
setVideoSize(math::vec2i{a.window.data1, a.window.data2});
i->type = EVENT_WINDOW_RESIZE;
}
else i->type = EVENT_NOTHINK;
/** mouse event **/
if(a.button.button == SDL_BUTTON_LEFT) { i->mouse[MOUSE_LEFT] = true; i->key[KEY_LBUTTON] = true; }
if(a.button.button == SDL_BUTTON_MIDDLE) { i->mouse[MOUSE_MIDDLE] = true; i->key[KEY_MBUTTON] = true; }
if(a.button.button == SDL_BUTTON_RIGHT) { i->mouse[MOUSE_RIGHT] = true; i->key[KEY_RBUTTON] = true; }
/** key event **/
// if(a.key.keysym.sym == SDLK_C) i->key[KEY_CANCEL] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_XBUTTON1] = true;
// if(a.key.keysym.sym == SDLK_X) i->key[KEY_XBUTTON2] = true;
// if(a.key.keysym.sym == SDLK_B) i->key[KEY_BACK] = true;
if(a.key.keysym.sym == SDLK_TAB) i->key[KEY_TAB] = true;
if(a.key.keysym.sym == SDLK_CLEAR) i->key[KEY_CLEAR] = true;
if(a.key.keysym.sym == SDLK_RETURN) i->key[KEY_RETURN] = true;
if(a.key.keysym.sym == SDLK_RSHIFT || a.key.keysym.sym == SDLK_LSHIFT) i->key[KEY_SHIFT] = true;
if(a.key.keysym.sym == SDLK_RCTRL || a.key.keysym.sym == SDLK_LCTRL) i->key[KEY_CONTROL] = true;
if(a.key.keysym.sym == SDLK_MENU) i->key[KEY_MENU] = true;
if(a.key.keysym.sym == SDLK_PAUSE) i->key[KEY_PAUSE] = true;
// if(a.key.keysym.sym == SDLK_C) i->key[KEY_CAPITAL] = true;
// if(a.key.keysym.sym == SDLK_K) i->key[KEY_KANA] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_HANGUEL] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_HANGUL] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_JUNJA] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_FINAL] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_HANJA] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_KANJI] = true;
if(a.key.keysym.sym == SDLK_ESCAPE) i->key[KEY_ESCAPE] = true;
// if(a.key.keysym.sym == SDLK_C) i->key[KEY_CONVERT] = true;
// if(a.key.keysym.sym == SDLK_N) i->key[KEY_NONCONVERT] = true;
// if(a.key.keysym.sym == SDLK_A) i->key[KEY_ACCEPT] = true;
if(a.key.keysym.sym == SDLK_MODE) i->key[KEY_MODECHANGE] = true;
if(a.key.keysym.sym == SDLK_SPACE) i->key[KEY_SPACE] = true;
// if(a.key.keysym.sym == SDLK_P) i->key[KEY_PRIOR] = true;
// if(a.key.keysym.sym == SDLK_N) i->key[KEY_NEXT] = true;
if(a.key.keysym.sym == SDLK_END) i->key[KEY_END] = true;
if(a.key.keysym.sym == SDLK_HOME) i->key[KEY_HOME] = true;
if(a.key.keysym.sym == SDLK_LEFT) i->key[KEY_LEFT] = true;
if(a.key.keysym.sym == SDLK_UP) i->key[KEY_UP] = true;
if(a.key.keysym.sym == SDLK_RIGHT) i->key[KEY_RIGHT] = true;
if(a.key.keysym.sym == SDLK_DOWN) i->key[KEY_DOWN] = true;
// if(a.key.keysym.sym == SDLK_S) i->key[KEY_SELECT] = true;
// if(a.key.keysym.sym == SDLK_PRINT) i->key[KEY_PRINT] = true;
// if(a.key.keysym.sym == SDLK_E) i->key[KEY_EXECUT] = true;
// if(a.key.keysym.sym == SDLK_S) i->key[KEY_SNAPSHOT] = true;
if(a.key.keysym.sym == SDLK_INSERT) i->key[KEY_INSERT] = true;
if(a.key.keysym.sym == SDLK_DELETE) i->key[KEY_DELETE] = true;
if(a.key.keysym.sym == SDLK_HELP) i->key[KEY_HELP] = true;
if(a.key.keysym.sym == SDLK_0) i->key[KEY_KEY_0] = true;
if(a.key.keysym.sym == SDLK_1) i->key[KEY_KEY_1] = true;
if(a.key.keysym.sym == SDLK_2) i->key[KEY_KEY_2] = true;
if(a.key.keysym.sym == SDLK_3) i->key[KEY_KEY_3] = true;
if(a.key.keysym.sym == SDLK_4) i->key[KEY_KEY_4] = true;
if(a.key.keysym.sym == SDLK_5) i->key[KEY_KEY_5] = true;
if(a.key.keysym.sym == SDLK_6) i->key[KEY_KEY_6] = true;
if(a.key.keysym.sym == SDLK_7) i->key[KEY_KEY_7] = true;
if(a.key.keysym.sym == SDLK_8) i->key[KEY_KEY_8] = true;
if(a.key.keysym.sym == SDLK_9) i->key[KEY_KEY_9] = true;
if(a.key.keysym.sym == SDLK_a) i->key[KEY_KEY_A] = true;
if(a.key.keysym.sym == SDLK_b) i->key[KEY_KEY_B] = true;
if(a.key.keysym.sym == SDLK_c) i->key[KEY_KEY_C] = true;
if(a.key.keysym.sym == SDLK_d) i->key[KEY_KEY_D] = true;
if(a.key.keysym.sym == SDLK_e) i->key[KEY_KEY_E] = true;
if(a.key.keysym.sym == SDLK_f) i->key[KEY_KEY_F] = true;
if(a.key.keysym.sym == SDLK_g) i->key[KEY_KEY_G] = true;
if(a.key.keysym.sym == SDLK_h) i->key[KEY_KEY_H] = true;
if(a.key.keysym.sym == SDLK_i) i->key[KEY_KEY_I] = true;
if(a.key.keysym.sym == SDLK_j) i->key[KEY_KEY_J] = true;
if(a.key.keysym.sym == SDLK_k) i->key[KEY_KEY_K] = true;
if(a.key.keysym.sym == SDLK_l) i->key[KEY_KEY_L] = true;
if(a.key.keysym.sym == SDLK_m) i->key[KEY_KEY_M] = true;
if(a.key.keysym.sym == SDLK_n) i->key[KEY_KEY_N] = true;
if(a.key.keysym.sym == SDLK_o) i->key[KEY_KEY_O] = true;
if(a.key.keysym.sym == SDLK_p) i->key[KEY_KEY_P] = true;
if(a.key.keysym.sym == SDLK_q) i->key[KEY_KEY_Q] = true;
if(a.key.keysym.sym == SDLK_r) i->key[KEY_KEY_R] = true;
if(a.key.keysym.sym == SDLK_s) i->key[KEY_KEY_S] = true;
if(a.key.keysym.sym == SDLK_t) i->key[KEY_KEY_T] = true;
if(a.key.keysym.sym == SDLK_u) i->key[KEY_KEY_U] = true;
if(a.key.keysym.sym == SDLK_v) i->key[KEY_KEY_V] = true;
if(a.key.keysym.sym == SDLK_w) i->key[KEY_KEY_W] = true;
if(a.key.keysym.sym == SDLK_x) i->key[KEY_KEY_X] = true;
if(a.key.keysym.sym == SDLK_y) i->key[KEY_KEY_Y] = true;
if(a.key.keysym.sym == SDLK_z) i->key[KEY_KEY_Z] = true;
// if(a.key.keysym.sym == SDLK_LMETA) i->key[KEY_LWIN] = true;
// if(a.key.keysym.sym == SDLK_RMETA) i->key[KEY_RWIN] = true;
// if(a.key.keysym.sym == SDLK_A) i->key[KEY_APPS] = true;
// if(a.key.keysym.sym == SDLK_S) i->key[KEY_SLEEP] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_NUMPAD0] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_NUMPAD1] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_NUMPAD2] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_NUMPAD3] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_NUMPAD4] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_NUMPAD5] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_NUMPAD6] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_NUMPAD7] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_NUMPAD8] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_NUMPAD9] = true;
if(a.key.keysym.sym == SDLK_ASTERISK) i->key[KEY_MULTIPLY] = true;
// if(a.key.keysym.sym == SDLK_) i->key[KEY_ADD] = true;
// if(a.key.keysym.sym == SDLK_s) i->key[KEY_SEPARATOR] = true;
if(a.key.keysym.sym == SDLK_MINUS) i->key[KEY_SUBTRACT] = true;
// if(a.key.keysym.sym == SDLK_D) i->key[KEY_DECIMAL] = true;
if(a.key.keysym.sym == SDLK_SLASH) i->key[KEY_DIVIDE] = true;
if(a.key.keysym.sym == SDLK_F1) i->key[KEY_F1] = true;
if(a.key.keysym.sym == SDLK_F2) i->key[KEY_F2] = true;
if(a.key.keysym.sym == SDLK_F3) i->key[KEY_F3] = true;
if(a.key.keysym.sym == SDLK_F4) i->key[KEY_F4] = true;
if(a.key.keysym.sym == SDLK_F5) i->key[KEY_F5] = true;
if(a.key.keysym.sym == SDLK_F6) i->key[KEY_F6] = true;
if(a.key.keysym.sym == SDLK_F7) i->key[KEY_F7] = true;
if(a.key.keysym.sym == SDLK_F8) i->key[KEY_F8] = true;
if(a.key.keysym.sym == SDLK_F9) i->key[KEY_F9] = true;
if(a.key.keysym.sym == SDLK_F10) i->key[KEY_F10] = true;
if(a.key.keysym.sym == SDLK_F11) i->key[KEY_F11] = true;
if(a.key.keysym.sym == SDLK_F12) i->key[KEY_F12] = true;
if(a.key.keysym.sym == SDLK_F13) i->key[KEY_F13] = true;
if(a.key.keysym.sym == SDLK_F14) i->key[KEY_F14] = true;
if(a.key.keysym.sym == SDLK_F15) i->key[KEY_F15] = true;
// if(a.key.keysym.sym == SDLK_NUMLOCK) i->key[KEY_NUMLOCK] = true;
// if(a.key.keysym.sym == SDLK_SCROLLOCK) i->key[KEY_SCROLL] = true;
if(a.key.keysym.sym == SDLK_LSHIFT) i->key[KEY_LSHIFT] = true;
if(a.key.keysym.sym == SDLK_RSHIFT) i->key[KEY_RSHIFT] = true;
if(a.key.keysym.sym == SDLK_LCTRL) i->key[KEY_LCONTROL] = true;
if(a.key.keysym.sym == SDLK_RCTRL) i->key[KEY_RCONTROL] = true;
// if(a.key.keysym.sym == SDLK_LMETA) i->key[KEY_LMENU] = true;
// if(a.key.keysym.sym == SDLK_RMETA) i->key[KEY_RMENU] = true;
if(a.key.keysym.sym == SDLK_PLUS) i->key[KEY_PLUS] = true;
if(a.key.keysym.sym == SDLK_COMMA) i->key[KEY_COMMA] = true;
if(a.key.keysym.sym == SDLK_MINUS) i->key[KEY_MINUS] = true;
if(a.key.keysym.sym == SDLK_PERIOD) i->key[KEY_PERIOD] = true;
if(a.key.keysym.sym == SDLK_AT) i->key[KEY_ATTN] = true;
// if(a.key.keysym.sym == SDLK_c) i->key[KEY_CRSEL] = true;
// if(a.key.keysym.sym == SDLK_E) i->key[KEY_EXSEL] = true;
// if(a.key.keysym.sym == SDLK_E) i->key[KEY_EREOF] = true;
// if(a.key.keysym.sym == SDLK_P) i->key[KEY_PLAY] = true;
// if(a.key.keysym.sym == SDLK_Z) i->key[KEY_ZOOM] = true;
if(a.key.keysym.sym == SDLK_PAGEUP) i->key[KEY_PA1] = true;
if(a.key.keysym.sym == SDLK_CLEAR) i->key[KEY_OEM_CLEAR] = true;
}
}
}
#endif
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/sleek/device/common/sdl2.h
===================================================================
--- src/sleek/device/common/sdl2.h (nonexistent)
+++ src/sleek/device/common/sdl2.h (revision 22)
@@ -0,0 +1,50 @@
+#ifndef DEVICE_WINDOW_MANAGER_SDL2
+#define DEVICE_WINDOW_MANAGER_SDL2
+
+ #include "../../define.h"
+ #include "../../compile.h"
+
+ #if defined sdl2_device_support
+
+ #include "../device.h"
+
+ typedef struct SDL_Window SDL_Window;
+ typedef union SDL_Event SDL_Event;
+
+ namespace sleek
+ {
+ namespace device
+ {
+ class Device_sdl2 : public Device
+ {
+ public:
+ Device_sdl2(const Device_stub&) noexcept;
+ virtual ~Device_sdl2() noexcept;
+
+ virtual const DeviceWindowManager getType() const { return DWM_SDL; }
+
+ virtual bool run() noexcept;
+ virtual void begin(const math::pixel&) noexcept;
+ virtual bool manage() noexcept;
+ virtual void end() noexcept;
+
+ virtual void setGamma(const math::pixel&) noexcept;
+ virtual void setCaption(const std::string&) noexcept;
+ virtual void setVideoSize(const math::vec2i&) noexcept;
+ virtual void setWindowPos(const math::vec2i&) noexcept;
+ virtual void setFullScreen(bool) noexcept;
+
+ virtual void enableWindowDecorator(bool) noexcept;
+ virtual math::vec2i getDesktopVideoSize() const noexcept;
+
+ virtual void WarpMouse(const math::vec2i&) noexcept;
+ virtual void ShowMouse(bool) noexcept;
+ protected:
+ void keymap(const SDL_Event&, input*) noexcept;
+ SDL_Window *display;
+ };
+ }
+ }
+
+ #endif
+#endif
/src/sleek/device/common/sdl2.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/sleek/device/common/win.cpp
===================================================================
--- src/sleek/device/common/win.cpp (revision 21)
+++ src/sleek/device/common/win.cpp (revision 22)
@@ -59,7 +59,7 @@
Device::setCaption(name);
}
- void Device_win::setVideoSize(const math::vector2di &i)
+ void Device_win::setVideoSize(const math::vec2i &i)
{
Device::setVideoSize(i);
ShowWindow(screen, SW_SHOW);
@@ -67,7 +67,7 @@
MoveWindow(screen, (GetSystemMetrics(SM_CXSCREEN)-i.width)/2, (GetSystemMetrics(SM_CYSCREEN)-i.height)/2, i.width, i.height, FALSE);
}
- void Device_win::setWindowPos(const math::vector2di &i)
+ void Device_win::setWindowPos(const math::vec2i &i)
{
ShowWindow(screen, SW_SHOW);
UpdateWindow(screen);
@@ -75,9 +75,9 @@
Device::setVideoSize(i);
}
- math::vector2di Device_win::getDesktopVideoSize() const
+ math::vec2i Device_win::getDesktopVideoSize() const
{
- return math::vector2di(GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
+ return math::vec2i(GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
}
void Device_win::enableWindowDecorator(bool flag)
/src/sleek/device/common/win.h
16,6 → 16,8
Device_win(const Device_stub&);
virtual ~Device_win();
 
virtual const DeviceWindowManager getType() const { return DWM_WIN; }
 
virtual void begin();
virtual bool manage();
virtual bool run();
23,12 → 25,12
virtual void exit();
 
virtual void enableWindowDecorator(bool);
virtual math::vector2di getDesktopVideoSize() const;
virtual void setWindowPos(const math::vector2di&);
virtual math::vec2i getDesktopVideoSize() const;
virtual void setWindowPos(const math::vec2i&);
 
virtual void setGamma(const math::pixel&);
virtual void setCaption(const std::string&);
virtual void setVideoSize(const math::vector2di&);
virtual void setVideoSize(const math::vec2i&);
virtual void setFullScreen(bool);
protected:
Device_win(){}
/src/sleek/device/common/x11.cpp
32,8 → 32,17
running = true;
 
if((vi = glXChooseVisual(display, DefaultScreen(display), DOGL)));
else vi = glXChooseVisual(display, DefaultScreen(display), SOGL);
else vi = glXChooseVisual(display, DefaultScreen(display), SOGL);
 
 
int fbcount = 0;
 
if((fb = glXChooseFBConfig(display, DefaultScreen(display), DOGL+1, &fbcount)));
else fb = glXChooseFBConfig(display, DefaultScreen(display), SOGL+1, &fbcount);
 
if(!fb || fbcount == 0)
printf("no fbconfig to select\n");
 
swa.colormap = XCreateColormap(display, RootWindow(display, vi->screen), vi->visual, AllocNone);
swa.border_pixel = 0;
swa.event_mask = ExposureMask | ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask | StructureNotifyMask | FocusChangeMask | PointerMotionMask;
50,6 → 59,7
enableWindowDecorator(info.decorator);
 
info.visual = vi;
info.fbconfig = fb;
info.display = display;
info.window = &window;
}
73,7 → 83,7
Device::setCaption(name);
}
 
void Device_x11::setVideoSize(const math::vector2di &i) noexcept
void Device_x11::setVideoSize(const math::vec2i &i) noexcept
{
XFlush(display);
XResizeWindow(display, window, i.x, i.y);
81,7 → 91,7
XSync(display, true);
}
 
void Device_x11::setWindowPos(const math::vector2di &i) noexcept
void Device_x11::setWindowPos(const math::vec2i &i) noexcept
{
XFlush(display);
XMoveWindow(display, window, i.x, i.y);
88,9 → 98,9
XSync(display, true);
}
 
math::vector2di Device_x11::getDesktopVideoSize() const noexcept
math::vec2i Device_x11::getDesktopVideoSize() const noexcept
{
return math::vector2di(
return math::vec2i(
DefaultScreenOfDisplay(display)->width,
DefaultScreenOfDisplay(display)->height
);
171,7 → 181,7
modes[i]->vdisplay <= modes[bestMode]->vdisplay)
bestMode = i;
}
math::vector2du pos(WidthOfScreen(scr), HeightOfScreen(scr));
math::vec2u pos(WidthOfScreen(scr), HeightOfScreen(scr));
pos -= getDesktopVideoSize();
pos /= 2;
XMoveWindow(display, window, pos.x, pos.y);
187,7 → 197,7
XFree(modes);
}
 
void Device_x11::WarpMouse(const math::vector2di &i) noexcept
void Device_x11::WarpMouse(const math::vec2i &i) noexcept
{
XWarpPointer(display, None, window, 0, 0, 0, 0, i.x, i.y);
}
209,7 → 219,7
case Expose:
case ConfigureNotify:
//if(info.size.x != xev.xconfigurerequest.width || info.size.y != xev.xconfigurerequest.height)
Device::setVideoSize(math::vector2di(xev.xconfigurerequest.width, xev.xconfigurerequest.height));
Device::setVideoSize(math::vec2i(xev.xconfigurerequest.width, xev.xconfigurerequest.height));
break;
case MapNotify:
break;
/src/sleek/device/common/x11.h
27,6 → 27,8
Device_x11(const Device_stub&) noexcept;
virtual ~Device_x11() noexcept;
 
virtual const DeviceWindowManager getType() const { return DWM_X11; }
 
virtual bool run() noexcept;
virtual void begin() noexcept;
virtual bool manage() noexcept;
34,19 → 36,20
 
virtual void setGamma(const math::pixel&) noexcept;
virtual void setCaption(const std::string&) noexcept;
virtual void setVideoSize(const math::vector2di&) noexcept;
virtual void setWindowPos(const math::vector2di&) noexcept;
virtual void setVideoSize(const math::vec2i&) noexcept;
virtual void setWindowPos(const math::vec2i&) noexcept;
virtual void setFullScreen(bool) noexcept;
 
virtual void enableWindowDecorator(bool) noexcept;
virtual math::vector2di getDesktopVideoSize() const noexcept;
virtual math::vec2i getDesktopVideoSize() const noexcept;
 
virtual void WarpMouse(const math::vector2di&) noexcept;
virtual void WarpMouse(const math::vec2i&) noexcept;
virtual void ShowMouse(bool) noexcept;
protected:
Window window;
Display *display;
XVisualInfo *vi;
GLXFBConfig *fb;
XSetWindowAttributes swa;
private:
Cursor invisCursor;
/src/sleek/device/console/async_logger.h
0,0 → 1,87
/*************************************************************************/
/* spdlog - an extremely fast and easy to use c++11 logging library. */
/* Copyright (c) 2014 Gabi Melman. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
 
#pragma once
 
// Very fast asynchronous logger (millions of logs per second on an average desktop)
// Uses pre allocated lockfree queue for maximum throughput even under large number of threads.
// Creates a single back thread to pop messages from the queue and log them.
//
// Upon each log write the logger:
// 1. Checks if its log level is enough to log the message
// 2. Push a new copy of the message to a queue (or block the caller until space is available in the queue)
// 3. will throw spdlog_ex upon log exceptions
// Upong destruction, logs all remaining messages in the queue before destructing..
 
#include <chrono>
#include <functional>
#include "common.h"
#include "logger.h"
#include "spdlog.h"
 
 
namespace spdlog
{
 
namespace details
{
class async_log_helper;
}
 
class async_logger :public logger
{
public:
template<class It>
async_logger(const std::string& name,
const It& begin,
const It& end,
size_t queue_size,
const async_overflow_policy overflow_policy = async_overflow_policy::block_retry,
const std::function<void()>& worker_warmup_cb = nullptr);
 
async_logger(const std::string& logger_name,
sinks_init_list sinks,
size_t queue_size,
const async_overflow_policy overflow_policy = async_overflow_policy::block_retry,
const std::function<void()>& worker_warmup_cb = nullptr);
 
async_logger(const std::string& logger_name,
sink_ptr single_sink,
size_t queue_size,
const async_overflow_policy overflow_policy = async_overflow_policy::block_retry,
const std::function<void()>& worker_warmup_cb = nullptr);
 
 
protected:
void _log_msg(details::log_msg& msg) override;
void _set_formatter(spdlog::formatter_ptr msg_formatter) override;
void _set_pattern(const std::string& pattern) override;
 
private:
std::unique_ptr<details::async_log_helper> _async_log_helper;
};
}
 
 
#include "./details/async_logger_impl.h"
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/sleek/device/console/details/async_log_helper.h
===================================================================
--- src/sleek/device/console/details/async_log_helper.h (nonexistent)
+++ src/sleek/device/console/details/async_log_helper.h (revision 22)
@@ -0,0 +1,286 @@
+/*************************************************************************/
+/* spdlog - an extremely fast and easy to use c++11 logging library. */
+/* Copyright (c) 2014 Gabi Melman. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+// async log helper :
+// Process logs asynchronously using a back thread.
+//
+// If the internal queue of log messages reaches its max size,
+// then the client call will block until there is more room.
+//
+// If the back thread throws during logging, a spdlog::spdlog_ex exception
+// will be thrown in client's thread when tries to log the next message
+
+#pragma once
+
+#include <chrono>
+#include <thread>
+#include <atomic>
+#include <functional>
+
+#include "../common.h"
+#include "../sinks/sink.h"
+#include "./mpmc_bounded_q.h"
+#include "./log_msg.h"
+#include "./format.h"
+
+
+namespace spdlog
+{
+namespace details
+{
+
+class async_log_helper
+{
+ // Async msg to move to/from the queue
+ // Movable only. should never be copied
+ struct async_msg
+ {
+ std::string logger_name;
+ level::level_enum level;
+ log_clock::time_point time;
+ std::string txt;
+
+ async_msg() = default;
+ ~async_msg() = default;
+
+ async_msg(async_msg&& other) = default;
+ async_msg& operator=(async_msg&& other) = default;
+
+ // never copy or assign. should only be moved..
+ async_msg(const async_msg&) = delete;
+ async_msg& operator=(async_msg& other) = delete;
+
+ // construct from log_msg
+ async_msg(const details::log_msg& m) :
+ logger_name(m.logger_name),
+ level(m.level),
+ time(m.time),
+ txt(m.raw.data(), m.raw.size())
+ {}
+
+
+ // copy into log_msg
+ void fill_log_msg(log_msg &msg)
+ {
+ msg.clear();
+ msg.logger_name = logger_name;
+ msg.level = level;
+ msg.time = time;
+ msg.raw << txt;
+ }
+ };
+
+public:
+
+ using item_type = async_msg;
+ using q_type = details::mpmc_bounded_queue<item_type>;
+
+ using clock = std::chrono::steady_clock;
+
+
+ async_log_helper(formatter_ptr formatter,
+ const std::vector<sink_ptr>& sinks,
+ size_t queue_size,
+ const async_overflow_policy overflow_policy = async_overflow_policy::block_retry,
+ const std::function<void()>& worker_warmup_cb = nullptr);
+
+ void log(const details::log_msg& msg);
+
+ // stop logging and join the back thread
+ ~async_log_helper();
+
+ void set_formatter(formatter_ptr);
+
+
+private:
+ formatter_ptr _formatter;
+ std::vector<std::shared_ptr<sinks::sink>> _sinks;
+
+ // queue of messages to log
+ q_type _q;
+
+ // last exception thrown from the worker thread
+ std::shared_ptr<spdlog_ex> _last_workerthread_ex;
+
+ // overflow policy
+ const async_overflow_policy _overflow_policy;
+
+ // worker thread warmup callback - one can set thread priority, affinity, etc
+ const std::function<void()> _worker_warmup_cb;
+
+ // worker thread
+ std::thread _worker_thread;
+
+ // throw last worker thread exception or if worker thread is not active
+ void throw_if_bad_worker();
+
+ // worker thread main loop
+ void worker_loop();
+
+ // pop next message from the queue and process it
+ // return true if a message was available (queue was not empty), will set the last_pop to the pop time
+ bool process_next_msg(clock::time_point& last_pop);
+
+ // sleep,yield or return immediatly using the time passed since last message as a hint
+ static void sleep_or_yield(const clock::time_point& last_op_time);
+
+};
+}
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// async_sink class implementation
+///////////////////////////////////////////////////////////////////////////////
+inline spdlog::details::async_log_helper::async_log_helper(formatter_ptr formatter, const std::vector<sink_ptr>& sinks, size_t queue_size, const async_overflow_policy overflow_policy, const std::function<void()>& worker_warmup_cb):
+ _formatter(formatter),
+ _sinks(sinks),
+ _q(queue_size),
+ _overflow_policy(overflow_policy),
+ _worker_warmup_cb(worker_warmup_cb),
+ _worker_thread(&async_log_helper::worker_loop, this)
+{}
+
+// Send to the worker thread termination message(level=off)
+// and wait for it to finish gracefully
+inline spdlog::details::async_log_helper::~async_log_helper()
+{
+
+ try
+ {
+ log(log_msg(level::off));
+ _worker_thread.join();
+ }
+ catch (...) //Dont crash if thread not joinable
+ {}
+}
+
+
+//Try to push and block until succeeded
+inline void spdlog::details::async_log_helper::log(const details::log_msg& msg)
+{
+ throw_if_bad_worker();
+ async_msg new_msg(msg);
+ if (!_q.enqueue(std::move(new_msg)) && _overflow_policy != async_overflow_policy::discard_log_msg)
+ {
+ auto last_op_time = clock::now();
+ do
+ {
+ sleep_or_yield(last_op_time);
+ }
+ while (!_q.enqueue(std::move(new_msg)));
+ }
+
+}
+
+inline void spdlog::details::async_log_helper::worker_loop()
+{
+ try
+ {
+ if (_worker_warmup_cb) _worker_warmup_cb();
+ clock::time_point last_pop = clock::now();
+ while(process_next_msg(last_pop));
+ }
+ catch (const std::exception& ex)
+ {
+ _last_workerthread_ex = std::make_shared<spdlog_ex>(std::string("async_logger worker thread exception: ") + ex.what());
+ }
+ catch (...)
+ {
+ _last_workerthread_ex = std::make_shared<spdlog_ex>("async_logger worker thread exception");
+ }
+}
+
+// process next message in the queue
+// return true if this thread should still be active (no msg with level::off was received)
+inline bool spdlog::details::async_log_helper::process_next_msg(clock::time_point& last_pop)
+{
+
+ async_msg incoming_async_msg;
+ log_msg incoming_log_msg;
+
+ if (_q.dequeue(incoming_async_msg))
+ {
+ last_pop = clock::now();
+
+ if(incoming_async_msg.level == level::off)
+ return false;
+
+ incoming_async_msg.fill_log_msg(incoming_log_msg);
+ _formatter->format(incoming_log_msg);
+ for (auto &s : _sinks)
+ s->log(incoming_log_msg);
+ }
+ else //empty queue
+ {
+ sleep_or_yield(last_pop);
+ }
+ return true;
+}
+
+inline void spdlog::details::async_log_helper::set_formatter(formatter_ptr msg_formatter)
+{
+ _formatter = msg_formatter;
+}
+
+
+// sleep,yield or return immediatly using the time passed since last message as a hint
+inline void spdlog::details::async_log_helper::sleep_or_yield(const clock::time_point& last_op_time)
+{
+ using std::chrono::milliseconds;
+ using namespace std::this_thread;
+
+ auto time_since_op = clock::now() - last_op_time;
+
+ // spin upto 1 ms
+ if (time_since_op <= milliseconds(1))
+ return;
+
+ // yield upto 10ms
+ if (time_since_op <= milliseconds(10))
+ return yield();
+
+
+ // sleep for half of duration since last op
+ if (time_since_op <= milliseconds(100))
+ return sleep_for(time_since_op / 2);
+
+ return sleep_for(milliseconds(100));
+}
+
+// throw if the worker thread threw an exception or not active
+inline void spdlog::details::async_log_helper::throw_if_bad_worker()
+{
+ if (_last_workerthread_ex)
+ {
+ auto ex = std::move(_last_workerthread_ex);
+ throw *ex;
+ }
+}
+
+
+
+
+
+
+
/src/sleek/device/console/details/async_log_helper.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/sleek/device/console/details/async_logger_impl.h
===================================================================
--- src/sleek/device/console/details/async_logger_impl.h (nonexistent)
+++ src/sleek/device/console/details/async_logger_impl.h (revision 22)
@@ -0,0 +1,79 @@
+/*************************************************************************/
+/* spdlog - an extremely fast and easy to use c++11 logging library. */
+/* Copyright (c) 2014 Gabi Melman. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#pragma once
+
+
+#include "./async_log_helper.h"
+
+//
+// Async Logger implementation
+// Use single async_sink (queue) to perform the logging in a worker thread
+//
+
+
+template<class It>
+inline spdlog::async_logger::async_logger(const std::string& logger_name,
+ const It& begin,
+ const It& end,
+ size_t queue_size,
+ const async_overflow_policy overflow_policy,
+ const std::function<void()>& worker_warmup_cb) :
+ logger(logger_name, begin, end),
+ _async_log_helper(new details::async_log_helper(_formatter, _sinks, queue_size, overflow_policy, worker_warmup_cb))
+{
+}
+
+inline spdlog::async_logger::async_logger(const std::string& logger_name,
+ sinks_init_list sinks,
+ size_t queue_size,
+ const async_overflow_policy overflow_policy,
+ const std::function<void()>& worker_warmup_cb) :
+ async_logger(logger_name, sinks.begin(), sinks.end(), queue_size, overflow_policy, worker_warmup_cb) {}
+
+inline spdlog::async_logger::async_logger(const std::string& logger_name,
+ sink_ptr single_sink,
+ size_t queue_size,
+ const async_overflow_policy overflow_policy,
+ const std::function<void()>& worker_warmup_cb) :
+ async_logger(logger_name, { single_sink }, queue_size, overflow_policy, worker_warmup_cb) {}
+
+
+inline void spdlog::async_logger::_set_formatter(spdlog::formatter_ptr msg_formatter)
+{
+ _formatter = msg_formatter;
+ _async_log_helper->set_formatter(_formatter);
+}
+
+inline void spdlog::async_logger::_set_pattern(const std::string& pattern)
+{
+ _formatter = std::make_shared<pattern_formatter>(pattern);
+ _async_log_helper->set_formatter(_formatter);
+}
+
+
+inline void spdlog::async_logger::_log_msg(details::log_msg& msg)
+{
+ _async_log_helper->log(msg);
+}
/src/sleek/device/console/details/async_logger_impl.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/sleek/device/console/details/format.cc
===================================================================
--- src/sleek/device/console/details/format.cc (nonexistent)
+++ src/sleek/device/console/details/format.cc (revision 22)
@@ -0,0 +1,1170 @@
+/*
+
+Modified version of cppformat formatting library
+
+Orginal license:
+
+Copyright (c) 2012 - 2014, Victor Zverovich
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+
+#include <string.h>
+
+#include <cctype>
+#include <cerrno>
+#include <climits>
+#include <cmath>
+#include <cstdarg>
+
+#ifdef _WIN32
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+# ifdef __MINGW32__
+# include <cstring>
+# endif
+# include <windows.h>
+#endif
+
+using spdlog::details::fmt::LongLong;
+using spdlog::details::fmt::ULongLong;
+using spdlog::details::fmt::internal::Arg;
+
+// Check if exceptions are disabled.
+#if __GNUC__ && !__EXCEPTIONS
+# define FMT_EXCEPTIONS 0
+#endif
+#if _MSC_VER && !_HAS_EXCEPTIONS
+# define FMT_EXCEPTIONS 0
+#endif
+#ifndef FMT_EXCEPTIONS
+# define FMT_EXCEPTIONS 1
+#endif
+
+#if FMT_EXCEPTIONS
+# define FMT_TRY try
+# define FMT_CATCH(x) catch (x)
+#else
+# define FMT_TRY if (true)
+# define FMT_CATCH(x) if (false)
+#endif
+
+#ifndef FMT_THROW
+# if FMT_EXCEPTIONS
+# define FMT_THROW(x) throw x
+# else
+# define FMT_THROW(x) assert(false)
+# endif
+#endif
+
+#ifdef FMT_HEADER_ONLY
+# define FMT_FUNC inline
+#else
+# define FMT_FUNC
+#endif
+
+#if _MSC_VER
+# pragma warning(push)
+# pragma warning(disable: 4127) // conditional expression is constant
+#endif
+
+namespace {
+
+#ifndef _MSC_VER
+# define FMT_SNPRINTF snprintf
+#else // _MSC_VER
+inline int fmt_snprintf(char *buffer, size_t size, const char *format, ...) {
+ va_list args;
+ va_start(args, format);
+ int result = vsnprintf_s(buffer, size, _TRUNCATE, format, args);
+ va_end(args);
+ return result;
+}
+# define FMT_SNPRINTF fmt_snprintf
+#endif // _MSC_VER
+
+// Checks if a value fits in int - used to avoid warnings about comparing
+// signed and unsigned integers.
+template <bool IsSigned>
+struct IntChecker {
+ template <typename T>
+ static bool fits_in_int(T value) {
+ unsigned max = INT_MAX;
+ return value <= max;
+ }
+};
+
+template <>
+struct IntChecker<true> {
+ template <typename T>
+ static bool fits_in_int(T value) {
+ return value >= INT_MIN && value <= INT_MAX;
+ }
+};
+
+const char RESET_COLOR[] = "\x1b[0m";
+
+typedef void(*FormatFunc)(spdlog::details::fmt::Writer &, int, spdlog::details::fmt::StringRef);
+
+// Portable thread-safe version of strerror.
+// Sets buffer to point to a string describing the error code.
+// This can be either a pointer to a string stored in buffer,
+// or a pointer to some static immutable string.
+// Returns one of the following values:
+// 0 - success
+// ERANGE - buffer is not large enough to store the error message
+// other - failure
+// Buffer should be at least of size 1.
+FMT_FUNC int safe_strerror(
+ int error_code, char *&buffer, std::size_t buffer_size) FMT_NOEXCEPT(true) {
+ assert(buffer != 0 && buffer_size != 0);
+ int result = 0;
+#ifdef _GNU_SOURCE
+ char *message = strerror_r(error_code, buffer, buffer_size);
+ // If the buffer is full then the message is probably truncated.
+ if (message == buffer && strlen(buffer) == buffer_size - 1)
+ result = ERANGE;
+ buffer = message;
+#elif __MINGW32__
+ errno = 0;
+ (void)buffer_size;
+ buffer = strerror(error_code);
+ result = errno;
+#elif _WIN32
+ result = strerror_s(buffer, buffer_size, error_code);
+ // If the buffer is full then the message is probably truncated.
+ if (result == 0 && std::strlen(buffer) == buffer_size - 1)
+ result = ERANGE;
+#else
+ result = strerror_r(error_code, buffer, buffer_size);
+ if (result == -1)
+ result = errno; // glibc versions before 2.13 return result in errno.
+#endif
+ return result;
+}
+
+FMT_FUNC void format_error_code(spdlog::details::fmt::Writer &out, int error_code,
+ spdlog::details::fmt::StringRef message) FMT_NOEXCEPT(true) {
+ // Report error code making sure that the output fits into
+ // INLINE_BUFFER_SIZE to avoid dynamic memory allocation and potential
+ // bad_alloc.
+ out.clear();
+ static const char SEP[] = ": ";
+ static const char FMT_ERROR[] = "error ";
+ spdlog::details::fmt::internal::IntTraits<int>::MainType ec_value = error_code;
+ // Subtract 2 to account for terminating null characters in SEP and FMT_ERROR.
+ std::size_t error_code_size =
+ sizeof(SEP) + sizeof(FMT_ERROR) + spdlog::details::fmt::internal::count_digits(ec_value) - 2;
+ if (message.size() <= spdlog::details::fmt::internal::INLINE_BUFFER_SIZE - error_code_size)
+ out << message << SEP;
+ out << FMT_ERROR << error_code;
+ assert(out.size() <= spdlog::details::fmt::internal::INLINE_BUFFER_SIZE);
+}
+
+FMT_FUNC void report_error(FormatFunc func,
+ int error_code, spdlog::details::fmt::StringRef message) FMT_NOEXCEPT(true) {
+ spdlog::details::fmt::MemoryWriter full_message;
+ func(full_message, error_code, message);
+ // Use Writer::data instead of Writer::c_str to avoid potential memory
+ // allocation.
+ std::fwrite(full_message.data(), full_message.size(), 1, stderr);
+ std::fputc('\n', stderr);
+}
+
+// IsZeroInt::visit(arg) returns true iff arg is a zero integer.
+class IsZeroInt : public spdlog::details::fmt::internal::ArgVisitor<IsZeroInt, bool> {
+public:
+ template <typename T>
+ bool visit_any_int(T value) {
+ return value == 0;
+ }
+};
+
+// Parses an unsigned integer advancing s to the end of the parsed input.
+// This function assumes that the first character of s is a digit.
+template <typename Char>
+FMT_FUNC int parse_nonnegative_int(const Char *&s) {
+ assert('0' <= *s && *s <= '9');
+ unsigned value = 0;
+ do {
+ unsigned new_value = value * 10 + (*s++ - '0');
+ // Check if value wrapped around.
+ if (new_value < value) {
+ value = UINT_MAX;
+ break;
+ }
+ value = new_value;
+ } while ('0' <= *s && *s <= '9');
+ if (value > INT_MAX)
+ FMT_THROW(spdlog::details::fmt::FormatError("number is too big"));
+ return value;
+}
+
+inline void require_numeric_argument(const Arg &arg, char spec) {
+ if (arg.type > Arg::LAST_NUMERIC_TYPE) {
+ std::string message =
+ spdlog::details::fmt::format("format specifier '{}' requires numeric argument", spec);
+ FMT_THROW(spdlog::details::fmt::FormatError(message));
+ }
+}
+
+template <typename Char>
+FMT_FUNC void check_sign(const Char *&s, const Arg &arg) {
+ char sign = static_cast<char>(*s);
+ require_numeric_argument(arg, sign);
+ if (arg.type == Arg::UINT || arg.type == Arg::ULONG_LONG) {
+ FMT_THROW(spdlog::details::fmt::FormatError(spdlog::details::fmt::format(
+ "format specifier '{}' requires signed argument", sign)));
+ }
+ ++s;
+}
+
+// Checks if an argument is a valid printf width specifier and sets
+// left alignment if it is negative.
+class WidthHandler : public spdlog::details::fmt::internal::ArgVisitor<WidthHandler, unsigned> {
+private:
+ spdlog::details::fmt::FormatSpec &spec_;
+
+public:
+ explicit WidthHandler(spdlog::details::fmt::FormatSpec &spec) : spec_(spec) {}
+
+ unsigned visit_unhandled_arg() {
+ FMT_THROW(spdlog::details::fmt::FormatError("width is not integer"));
+ return 0;
+ }
+
+ template <typename T>
+ unsigned visit_any_int(T value) {
+ typedef typename spdlog::details::fmt::internal::IntTraits<T>::MainType UnsignedType;
+ UnsignedType width = value;
+ if (spdlog::details::fmt::internal::is_negative(value)) {
+ spec_.align_ = spdlog::details::fmt::ALIGN_LEFT;
+ width = 0 - width;
+ }
+ if (width > INT_MAX)
+ FMT_THROW(spdlog::details::fmt::FormatError("number is too big"));
+ return static_cast<unsigned>(width);
+ }
+};
+
+class PrecisionHandler :
+ public spdlog::details::fmt::internal::ArgVisitor<PrecisionHandler, int> {
+public:
+ unsigned visit_unhandled_arg() {
+ FMT_THROW(spdlog::details::fmt::FormatError("precision is not integer"));
+ return 0;
+ }
+
+ template <typename T>
+ int visit_any_int(T value) {
+ if (!IntChecker<std::numeric_limits<T>::is_signed>::fits_in_int(value))
+ FMT_THROW(spdlog::details::fmt::FormatError("number is too big"));
+ return static_cast<int>(value);
+ }
+};
+
+// Converts an integer argument to an integral type T for printf.
+template <typename T>
+class ArgConverter : public spdlog::details::fmt::internal::ArgVisitor<ArgConverter<T>, void> {
+private:
+ spdlog::details::fmt::internal::Arg &arg_;
+ wchar_t type_;
+
+public:
+ ArgConverter(spdlog::details::fmt::internal::Arg &arg, wchar_t type)
+ : arg_(arg), type_(type) {}
+
+ template <typename U>
+ void visit_any_int(U value) {
+ bool is_signed = type_ == 'd' || type_ == 'i';
+ using spdlog::details::fmt::internal::Arg;
+ if (sizeof(T) <= sizeof(int)) {
+ // Extra casts are used to silence warnings.
+ if (is_signed) {
+ arg_.type = Arg::INT;
+ arg_.int_value = static_cast<int>(static_cast<T>(value));
+ }
+ else {
+ arg_.type = Arg::UINT;
+ arg_.uint_value = static_cast<unsigned>(
+ static_cast<typename spdlog::details::fmt::internal::MakeUnsigned<T>::Type>(value));
+ }
+ }
+ else {
+ if (is_signed) {
+ arg_.type = Arg::LONG_LONG;
+ arg_.long_long_value =
+ static_cast<typename spdlog::details::fmt::internal::MakeUnsigned<U>::Type>(value);
+ }
+ else {
+ arg_.type = Arg::ULONG_LONG;
+ arg_.ulong_long_value =
+ static_cast<typename spdlog::details::fmt::internal::MakeUnsigned<U>::Type>(value);
+ }
+ }
+ }
+};
+
+// Converts an integer argument to char for printf.
+class CharConverter : public spdlog::details::fmt::internal::ArgVisitor<CharConverter, void> {
+private:
+ spdlog::details::fmt::internal::Arg &arg_;
+
+public:
+ explicit CharConverter(spdlog::details::fmt::internal::Arg &arg) : arg_(arg) {}
+
+ template <typename T>
+ void visit_any_int(T value) {
+ arg_.type = Arg::CHAR;
+ arg_.int_value = static_cast<char>(value);
+ }
+};
+
+// This function template is used to prevent compile errors when handling
+// incompatible string arguments, e.g. handling a wide string in a narrow
+// string formatter.
+template <typename Char>
+Arg::StringValue<Char> ignore_incompatible_str(Arg::StringValue<wchar_t>);
+
+template <>
+inline Arg::StringValue<char> ignore_incompatible_str(
+ Arg::StringValue<wchar_t>) {
+ return Arg::StringValue<char>();
+}
+
+template <>
+inline Arg::StringValue<wchar_t> ignore_incompatible_str(
+ Arg::StringValue<wchar_t> s) {
+ return s;
+}
+} // namespace
+
+FMT_FUNC void spdlog::details::fmt::SystemError::init(
+ int error_code, StringRef format_str, ArgList args) {
+ error_code_ = error_code;
+ MemoryWriter w;
+ internal::format_system_error(w, error_code, format(format_str, args));
+ std::runtime_error &base = *this;
+ base = std::runtime_error(w.str());
+}
+
+template <typename T>
+FMT_FUNC int spdlog::details::fmt::internal::CharTraits<char>::format_float(
+ char *buffer, std::size_t size, const char *format,
+ unsigned width, int precision, T value) {
+ if (width == 0) {
+ return precision < 0 ?
+ FMT_SNPRINTF(buffer, size, format, value) :
+ FMT_SNPRINTF(buffer, size, format, precision, value);
+ }
+ return precision < 0 ?
+ FMT_SNPRINTF(buffer, size, format, width, value) :
+ FMT_SNPRINTF(buffer, size, format, width, precision, value);
+}
+
+template <typename T>
+FMT_FUNC int spdlog::details::fmt::internal::CharTraits<wchar_t>::format_float(
+ wchar_t *buffer, std::size_t size, const wchar_t *format,
+ unsigned width, int precision, T value) {
+ if (width == 0) {
+ return precision < 0 ?
+ swprintf(buffer, size, format, value) :
+ swprintf(buffer, size, format, precision, value);
+ }
+ return precision < 0 ?
+ swprintf(buffer, size, format, width, value) :
+ swprintf(buffer, size, format, width, precision, value);
+}
+
+template <typename T>
+const char spdlog::details::fmt::internal::BasicData<T>::DIGITS[] =
+ "0001020304050607080910111213141516171819"
+ "2021222324252627282930313233343536373839"
+ "4041424344454647484950515253545556575859"
+ "6061626364656667686970717273747576777879"
+ "8081828384858687888990919293949596979899";
+
+#define FMT_POWERS_OF_10(factor) \
+ factor * 10, \
+ factor * 100, \
+ factor * 1000, \
+ factor * 10000, \
+ factor * 100000, \
+ factor * 1000000, \
+ factor * 10000000, \
+ factor * 100000000, \
+ factor * 1000000000
+
+template <typename T>
+const uint32_t spdlog::details::fmt::internal::BasicData<T>::POWERS_OF_10_32[] = {
+ 0, FMT_POWERS_OF_10(1)
+};
+
+template <typename T>
+const uint64_t spdlog::details::fmt::internal::BasicData<T>::POWERS_OF_10_64[] = {
+ 0,
+ FMT_POWERS_OF_10(1),
+ FMT_POWERS_OF_10(ULongLong(1000000000)),
+ // Multiply several constants instead of using a single long long constant
+ // to avoid warnings about C++98 not supporting long long.
+ ULongLong(1000000000) * ULongLong(1000000000) * 10
+};
+
+FMT_FUNC void spdlog::details::fmt::internal::report_unknown_type(char code, const char *type) {
+ if (std::isprint(static_cast<unsigned char>(code))) {
+ FMT_THROW(spdlog::details::fmt::FormatError(
+ spdlog::details::fmt::format("unknown format code '{}' for {}", code, type)));
+ }
+ FMT_THROW(spdlog::details::fmt::FormatError(
+ spdlog::details::fmt::format("unknown format code '\\x{:02x}' for {}",
+ static_cast<unsigned>(code), type)));
+}
+
+#ifdef _WIN32
+
+FMT_FUNC spdlog::details::fmt::internal::UTF8ToUTF16::UTF8ToUTF16(spdlog::details::fmt::StringRef s) {
+ int length = MultiByteToWideChar(
+ CP_UTF8, MB_ERR_INVALID_CHARS, s.c_str(), -1, 0, 0);
+ static const char FMT_ERROR[] = "cannot convert string from UTF-8 to UTF-16";
+ if (length == 0)
+ FMT_THROW(WindowsError(GetLastError(), FMT_ERROR));
+ buffer_.resize(length);
+ length = MultiByteToWideChar(
+ CP_UTF8, MB_ERR_INVALID_CHARS, s.c_str(), -1, &buffer_[0], length);
+ if (length == 0)
+ FMT_THROW(WindowsError(GetLastError(), FMT_ERROR));
+}
+
+FMT_FUNC spdlog::details::fmt::internal::UTF16ToUTF8::UTF16ToUTF8(spdlog::details::fmt::WStringRef s) {
+ if (int error_code = convert(s)) {
+ FMT_THROW(WindowsError(error_code,
+ "cannot convert string from UTF-16 to UTF-8"));
+ }
+}
+
+FMT_FUNC int spdlog::details::fmt::internal::UTF16ToUTF8::convert(spdlog::details::fmt::WStringRef s) {
+ int length = WideCharToMultiByte(CP_UTF8, 0, s.c_str(), -1, 0, 0, 0, 0);
+ if (length == 0)
+ return GetLastError();
+ buffer_.resize(length);
+ length = WideCharToMultiByte(
+ CP_UTF8, 0, s.c_str(), -1, &buffer_[0], length, 0, 0);
+ if (length == 0)
+ return GetLastError();
+ return 0;
+}
+
+FMT_FUNC void spdlog::details::fmt::WindowsError::init(
+ int error_code, StringRef format_str, ArgList args) {
+ error_code_ = error_code;
+ MemoryWriter w;
+ internal::format_windows_error(w, error_code, format(format_str, args));
+ std::runtime_error &base = *this;
+ base = std::runtime_error(w.str());
+}
+
+#endif
+
+FMT_FUNC void spdlog::details::fmt::internal::format_system_error(
+ spdlog::details::fmt::Writer &out, int error_code,
+ spdlog::details::fmt::StringRef message) FMT_NOEXCEPT(true) {
+ FMT_TRY {
+ MemoryBuffer<char, INLINE_BUFFER_SIZE> buffer;
+ buffer.resize(INLINE_BUFFER_SIZE);
+ for (;;) {
+ char *system_message = &buffer[0];
+ int result = safe_strerror(error_code, system_message, buffer.size());
+ if (result == 0) {
+ out << message << ": " << system_message;
+ return;
+ }
+ if (result != ERANGE)
+ break; // Can't get error message, report error code instead.
+ buffer.resize(buffer.size() * 2);
+ }
+ } FMT_CATCH(...) {}
+ format_error_code(out, error_code, message);
+}
+
+#ifdef _WIN32
+FMT_FUNC void spdlog::details::fmt::internal::format_windows_error(
+ spdlog::details::fmt::Writer &out, int error_code,
+ spdlog::details::fmt::StringRef message) FMT_NOEXCEPT(true) {
+ class String {
+ private:
+ LPWSTR str_;
+
+ public:
+ String() : str_() {}
+ ~String() {
+ LocalFree(str_);
+ }
+ LPWSTR *ptr() {
+ return &str_;
+ }
+ LPCWSTR c_str() const {
+ return str_;
+ }
+ };
+ FMT_TRY {
+ String system_message;
+ if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0,
+ error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ reinterpret_cast<LPWSTR>(system_message.ptr()), 0, 0)) {
+ UTF16ToUTF8 utf8_message;
+ if (utf8_message.convert(system_message.c_str()) == ERROR_SUCCESS) {
+ out << message << ": " << utf8_message;
+ return;
+ }
+ }
+ } FMT_CATCH(...) {}
+ format_error_code(out, error_code, message);
+}
+#endif
+
+// An argument formatter.
+template <typename Char>
+class spdlog::details::fmt::internal::ArgFormatter :
+ public spdlog::details::fmt::internal::ArgVisitor<spdlog::details::fmt::internal::ArgFormatter<Char>, void> {
+private:
+ spdlog::details::fmt::BasicFormatter<Char> &formatter_;
+ spdlog::details::fmt::BasicWriter<Char> &writer_;
+ spdlog::details::fmt::FormatSpec &spec_;
+ const Char *format_;
+
+public:
+ ArgFormatter(
+ spdlog::details::fmt::BasicFormatter<Char> &f, spdlog::details::fmt::FormatSpec &s, const Char *fmt)
+ : formatter_(f), writer_(f.writer()), spec_(s), format_(fmt) {}
+
+ template <typename T>
+ void visit_any_int(T value) {
+ writer_.write_int(value, spec_);
+ }
+
+ template <typename T>
+ void visit_any_double(T value) {
+ writer_.write_double(value, spec_);
+ }
+
+ void visit_char(int value) {
+ if (spec_.type_ && spec_.type_ != 'c') {
+ spec_.flags_ |= CHAR_FLAG;
+ writer_.write_int(value, spec_);
+ return;
+ }
+ if (spec_.align_ == ALIGN_NUMERIC || spec_.flags_ != 0)
+ FMT_THROW(FormatError("invalid format specifier for char"));
+ typedef typename spdlog::details::fmt::BasicWriter<Char>::CharPtr CharPtr;
+ CharPtr out = CharPtr();
+ if (spec_.width_ > 1) {
+ Char fill = static_cast<Char>(spec_.fill());
+ out = writer_.grow_buffer(spec_.width_);
+ if (spec_.align_ == spdlog::details::fmt::ALIGN_RIGHT) {
+ std::fill_n(out, spec_.width_ - 1, fill);
+ out += spec_.width_ - 1;
+ }
+ else if (spec_.align_ == spdlog::details::fmt::ALIGN_CENTER) {
+ out = writer_.fill_padding(out, spec_.width_, 1, fill);
+ }
+ else {
+ std::fill_n(out + 1, spec_.width_ - 1, fill);
+ }
+ }
+ else {
+ out = writer_.grow_buffer(1);
+ }
+ *out = static_cast<Char>(value);
+ }
+
+ void visit_string(Arg::StringValue<char> value) {
+ writer_.write_str(value, spec_);
+ }
+ void visit_wstring(Arg::StringValue<wchar_t> value) {
+ writer_.write_str(ignore_incompatible_str<Char>(value), spec_);
+ }
+
+ void visit_pointer(const void *value) {
+ if (spec_.type_ && spec_.type_ != 'p')
+ spdlog::details::fmt::internal::report_unknown_type(spec_.type_, "pointer");
+ spec_.flags_ = spdlog::details::fmt::HASH_FLAG;
+ spec_.type_ = 'x';
+ writer_.write_int(reinterpret_cast<uintptr_t>(value), spec_);
+ }
+
+ void visit_custom(Arg::CustomValue c) {
+ c.format(&formatter_, c.value, &format_);
+ }
+};
+
+template <typename Char>
+template <typename StrChar>
+FMT_FUNC void spdlog::details::fmt::BasicWriter<Char>::write_str(
+ const Arg::StringValue<StrChar> &str, const FormatSpec &spec) {
+ // Check if StrChar is convertible to Char.
+ internal::CharTraits<Char>::convert(StrChar());
+ if (spec.type_ && spec.type_ != 's')
+ internal::report_unknown_type(spec.type_, "string");
+ const StrChar *s = str.value;
+ std::size_t size = str.size;
+ if (size == 0) {
+ if (!s)
+ FMT_THROW(FormatError("string pointer is null"));
+ if (*s)
+ size = std::char_traits<StrChar>::length(s);
+ }
+ write_str(s, size, spec);
+}
+
+template <typename Char>
+inline Arg spdlog::details::fmt::BasicFormatter<Char>::parse_arg_index(const Char *&s) {
+ const char *error = 0;
+ Arg arg = *s < '0' || *s > '9' ?
+ next_arg(error) : get_arg(parse_nonnegative_int(s), error);
+ if (error) {
+ FMT_THROW(FormatError(
+ *s != '}' && *s != ':' ? "invalid format string" : error));
+ }
+ return arg;
+}
+
+FMT_FUNC Arg spdlog::details::fmt::internal::FormatterBase::do_get_arg(
+ unsigned arg_index, const char *&error) {
+ Arg arg = args_[arg_index];
+ if (arg.type == Arg::NONE)
+ error = "argument index out of range";
+ return arg;
+}
+
+inline Arg spdlog::details::fmt::internal::FormatterBase::next_arg(const char *&error) {
+ if (next_arg_index_ >= 0)
+ return do_get_arg(next_arg_index_++, error);
+ error = "cannot switch from manual to automatic argument indexing";
+ return Arg();
+}
+
+inline Arg spdlog::details::fmt::internal::FormatterBase::get_arg(
+ unsigned arg_index, const char *&error) {
+ if (next_arg_index_ <= 0) {
+ next_arg_index_ = -1;
+ return do_get_arg(arg_index, error);
+ }
+ error = "cannot switch from automatic to manual argument indexing";
+ return Arg();
+}
+
+template <typename Char>
+FMT_FUNC void spdlog::details::fmt::internal::PrintfFormatter<Char>::parse_flags(
+ FormatSpec &spec, const Char *&s) {
+ for (;;) {
+ switch (*s++) {
+ case '-':
+ spec.align_ = ALIGN_LEFT;
+ break;
+ case '+':
+ spec.flags_ |= SIGN_FLAG | PLUS_FLAG;
+ break;
+ case '0':
+ spec.fill_ = '0';
+ break;
+ case ' ':
+ spec.flags_ |= SIGN_FLAG;
+ break;
+ case '#':
+ spec.flags_ |= HASH_FLAG;
+ break;
+ default:
+ --s;
+ return;
+ }
+ }
+}
+
+template <typename Char>
+FMT_FUNC Arg spdlog::details::fmt::internal::PrintfFormatter<Char>::get_arg(
+ const Char *s, unsigned arg_index) {
+ const char *error = 0;
+ Arg arg = arg_index == UINT_MAX ?
+ next_arg(error) : FormatterBase::get_arg(arg_index - 1, error);
+ if (error)
+ FMT_THROW(FormatError(!*s ? "invalid format string" : error));
+ return arg;
+}
+
+template <typename Char>
+FMT_FUNC unsigned spdlog::details::fmt::internal::PrintfFormatter<Char>::parse_header(
+ const Char *&s, FormatSpec &spec) {
+ unsigned arg_index = UINT_MAX;
+ Char c = *s;
+ if (c >= '0' && c <= '9') {
+ // Parse an argument index (if followed by '$') or a width possibly
+ // preceded with '0' flag(s).
+ unsigned value = parse_nonnegative_int(s);
+ if (*s == '$') { // value is an argument index
+ ++s;
+ arg_index = value;
+ }
+ else {
+ if (c == '0')
+ spec.fill_ = '0';
+ if (value != 0) {
+ // Nonzero value means that we parsed width and don't need to
+ // parse it or flags again, so return now.
+ spec.width_ = value;
+ return arg_index;
+ }
+ }
+ }
+ parse_flags(spec, s);
+ // Parse width.
+ if (*s >= '0' && *s <= '9') {
+ spec.width_ = parse_nonnegative_int(s);
+ }
+ else if (*s == '*') {
+ ++s;
+ spec.width_ = WidthHandler(spec).visit(get_arg(s));
+ }
+ return arg_index;
+}
+
+template <typename Char>
+FMT_FUNC void spdlog::details::fmt::internal::PrintfFormatter<Char>::format(
+ BasicWriter<Char> &writer, BasicStringRef<Char> format,
+ const ArgList &args) {
+ const Char *start = format.c_str();
+ set_args(args);
+ const Char *s = start;
+ while (*s) {
+ Char c = *s++;
+ if (c != '%') continue;
+ if (*s == c) {
+ write(writer, start, s);
+ start = ++s;
+ continue;
+ }
+ write(writer, start, s - 1);
+
+ FormatSpec spec;
+ spec.align_ = ALIGN_RIGHT;
+
+ // Parse argument index, flags and width.
+ unsigned arg_index = parse_header(s, spec);
+
+ // Parse precision.
+ if (*s == '.') {
+ ++s;
+ if ('0' <= *s && *s <= '9') {
+ spec.precision_ = parse_nonnegative_int(s);
+ }
+ else if (*s == '*') {
+ ++s;
+ spec.precision_ = PrecisionHandler().visit(get_arg(s));
+ }
+ }
+
+ Arg arg = get_arg(s, arg_index);
+ if (spec.flag(HASH_FLAG) && IsZeroInt().visit(arg))
+ spec.flags_ &= ~HASH_FLAG;
+ if (spec.fill_ == '0') {
+ if (arg.type <= Arg::LAST_NUMERIC_TYPE)
+ spec.align_ = ALIGN_NUMERIC;
+ else
+ spec.fill_ = ' '; // Ignore '0' flag for non-numeric types.
+ }
+
+ // Parse length and convert the argument to the required type.
+ switch (*s++) {
+ case 'h':
+ if (*s == 'h')
+ ArgConverter<signed char>(arg, *++s).visit(arg);
+ else
+ ArgConverter<short>(arg, *s).visit(arg);
+ break;
+ case 'l':
+ if (*s == 'l')
+ ArgConverter<spdlog::details::fmt::LongLong>(arg, *++s).visit(arg);
+ else
+ ArgConverter<long>(arg, *s).visit(arg);
+ break;
+ case 'j':
+ ArgConverter<intmax_t>(arg, *s).visit(arg);
+ break;
+ case 'z':
+ ArgConverter<size_t>(arg, *s).visit(arg);
+ break;
+ case 't':
+ ArgConverter<ptrdiff_t>(arg, *s).visit(arg);
+ break;
+ case 'L':
+ // printf produces garbage when 'L' is omitted for long double, no
+ // need to do the same.
+ break;
+ default:
+ --s;
+ ArgConverter<int>(arg, *s).visit(arg);
+ }
+
+ // Parse type.
+ if (!*s)
+ FMT_THROW(FormatError("invalid format string"));
+ spec.type_ = static_cast<char>(*s++);
+ if (arg.type <= Arg::LAST_INTEGER_TYPE) {
+ // Normalize type.
+ switch (spec.type_) {
+ case 'i':
+ case 'u':
+ spec.type_ = 'd';
+ break;
+ case 'c':
+ // TODO: handle wchar_t
+ CharConverter(arg).visit(arg);
+ break;
+ }
+ }
+
+ start = s;
+
+ // Format argument.
+ switch (arg.type) {
+ case Arg::INT:
+ writer.write_int(arg.int_value, spec);
+ break;
+ case Arg::UINT:
+ writer.write_int(arg.uint_value, spec);
+ break;
+ case Arg::LONG_LONG:
+ writer.write_int(arg.long_long_value, spec);
+ break;
+ case Arg::ULONG_LONG:
+ writer.write_int(arg.ulong_long_value, spec);
+ break;
+ case Arg::CHAR: {
+ if (spec.type_ && spec.type_ != 'c')
+ writer.write_int(arg.int_value, spec);
+ typedef typename BasicWriter<Char>::CharPtr CharPtr;
+ CharPtr out = CharPtr();
+ if (spec.width_ > 1) {
+ Char fill = ' ';
+ out = writer.grow_buffer(spec.width_);
+ if (spec.align_ != ALIGN_LEFT) {
+ std::fill_n(out, spec.width_ - 1, fill);
+ out += spec.width_ - 1;
+ }
+ else {
+ std::fill_n(out + 1, spec.width_ - 1, fill);
+ }
+ }
+ else {
+ out = writer.grow_buffer(1);
+ }
+ *out = static_cast<Char>(arg.int_value);
+ break;
+ }
+ case Arg::DOUBLE:
+ writer.write_double(arg.double_value, spec);
+ break;
+ case Arg::LONG_DOUBLE:
+ writer.write_double(arg.long_double_value, spec);
+ break;
+ case Arg::CSTRING:
+ arg.string.size = 0;
+ writer.write_str(arg.string, spec);
+ break;
+ case Arg::STRING:
+ writer.write_str(arg.string, spec);
+ break;
+ case Arg::WSTRING:
+ writer.write_str(ignore_incompatible_str<Char>(arg.wstring), spec);
+ break;
+ case Arg::POINTER:
+ if (spec.type_ && spec.type_ != 'p')
+ internal::report_unknown_type(spec.type_, "pointer");
+ spec.flags_ = HASH_FLAG;
+ spec.type_ = 'x';
+ writer.write_int(reinterpret_cast<uintptr_t>(arg.pointer), spec);
+ break;
+ case Arg::CUSTOM: {
+ if (spec.type_)
+ internal::report_unknown_type(spec.type_, "object");
+ const void *s = "s";
+ arg.custom.format(&writer, arg.custom.value, &s);
+ break;
+ }
+ default:
+ assert(false);
+ break;
+ }
+ }
+ write(writer, start, s);
+}
+
+template <typename Char>
+FMT_FUNC const Char *spdlog::details::fmt::BasicFormatter<Char>::format(
+ const Char *&format_str, const Arg &arg) {
+ const Char *s = format_str;
+ FormatSpec spec;
+ if (*s == ':') {
+ if (arg.type == Arg::CUSTOM) {
+ arg.custom.format(this, arg.custom.value, &s);
+ return s;
+ }
+ ++s;
+ // Parse fill and alignment.
+ if (Char c = *s) {
+ const Char *p = s + 1;
+ spec.align_ = ALIGN_DEFAULT;
+ do {
+ switch (*p) {
+ case '<':
+ spec.align_ = ALIGN_LEFT;
+ break;
+ case '>':
+ spec.align_ = ALIGN_RIGHT;
+ break;
+ case '=':
+ spec.align_ = ALIGN_NUMERIC;
+ break;
+ case '^':
+ spec.align_ = ALIGN_CENTER;
+ break;
+ }
+ if (spec.align_ != ALIGN_DEFAULT) {
+ if (p != s) {
+ if (c == '}') break;
+ if (c == '{')
+ FMT_THROW(FormatError("invalid fill character '{'"));
+ s += 2;
+ spec.fill_ = c;
+ }
+ else ++s;
+ if (spec.align_ == ALIGN_NUMERIC)
+ require_numeric_argument(arg, '=');
+ break;
+ }
+ } while (--p >= s);
+ }
+
+ // Parse sign.
+ switch (*s) {
+ case '+':
+ check_sign(s, arg);
+ spec.flags_ |= SIGN_FLAG | PLUS_FLAG;
+ break;
+ case '-':
+ check_sign(s, arg);
+ spec.flags_ |= MINUS_FLAG;
+ break;
+ case ' ':
+ check_sign(s, arg);
+ spec.flags_ |= SIGN_FLAG;
+ break;
+ }
+
+ if (*s == '#') {
+ require_numeric_argument(arg, '#');
+ spec.flags_ |= HASH_FLAG;
+ ++s;
+ }
+
+ // Parse width and zero flag.
+ if ('0' <= *s && *s <= '9') {
+ if (*s == '0') {
+ require_numeric_argument(arg, '0');
+ spec.align_ = ALIGN_NUMERIC;
+ spec.fill_ = '0';
+ }
+ // Zero may be parsed again as a part of the width, but it is simpler
+ // and more efficient than checking if the next char is a digit.
+ spec.width_ = parse_nonnegative_int(s);
+ }
+
+ // Parse precision.
+ if (*s == '.') {
+ ++s;
+ spec.precision_ = 0;
+ if ('0' <= *s && *s <= '9') {
+ spec.precision_ = parse_nonnegative_int(s);
+ }
+ else if (*s == '{') {
+ ++s;
+ const Arg &precision_arg = parse_arg_index(s);
+ if (*s++ != '}')
+ FMT_THROW(FormatError("invalid format string"));
+ ULongLong value = 0;
+ switch (precision_arg.type) {
+ case Arg::INT:
+ if (precision_arg.int_value < 0)
+ FMT_THROW(FormatError("negative precision"));
+ value = precision_arg.int_value;
+ break;
+ case Arg::UINT:
+ value = precision_arg.uint_value;
+ break;
+ case Arg::LONG_LONG:
+ if (precision_arg.long_long_value < 0)
+ FMT_THROW(FormatError("negative precision"));
+ value = precision_arg.long_long_value;
+ break;
+ case Arg::ULONG_LONG:
+ value = precision_arg.ulong_long_value;
+ break;
+ default:
+ FMT_THROW(FormatError("precision is not integer"));
+ }
+ if (value > INT_MAX)
+ FMT_THROW(FormatError("number is too big"));
+ spec.precision_ = static_cast<int>(value);
+ }
+ else {
+ FMT_THROW(FormatError("missing precision specifier"));
+ }
+ if (arg.type != Arg::DOUBLE && arg.type != Arg::LONG_DOUBLE) {
+ FMT_THROW(FormatError(
+ "precision specifier requires floating-point argument"));
+ }
+ }
+
+ // Parse type.
+ if (*s != '}' && *s)
+ spec.type_ = static_cast<char>(*s++);
+ }
+
+ if (*s++ != '}')
+ FMT_THROW(FormatError("missing '}' in format string"));
+ start_ = s;
+
+ // Format argument.
+ internal::ArgFormatter<Char>(*this, spec, s - 1).visit(arg);
+ return s;
+}
+
+template <typename Char>
+FMT_FUNC void spdlog::details::fmt::BasicFormatter<Char>::format(
+ BasicStringRef<Char> format_str, const ArgList &args) {
+ const Char *s = start_ = format_str.c_str();
+ set_args(args);
+ while (*s) {
+ Char c = *s++;
+ if (c != '{' && c != '}') continue;
+ if (*s == c) {
+ write(writer_, start_, s);
+ start_ = ++s;
+ continue;
+ }
+ if (c == '}')
+ FMT_THROW(FormatError("unmatched '}' in format string"));
+ write(writer_, start_, s - 1);
+ Arg arg = parse_arg_index(s);
+ s = format(s, arg);
+ }
+ write(writer_, start_, s);
+}
+
+FMT_FUNC void spdlog::details::fmt::report_system_error(
+ int error_code, spdlog::details::fmt::StringRef message) FMT_NOEXCEPT(true) {
+ report_error(internal::format_system_error, error_code, message);
+}
+
+#ifdef _WIN32
+FMT_FUNC void spdlog::details::fmt::report_windows_error(
+ int error_code, spdlog::details::fmt::StringRef message) FMT_NOEXCEPT(true) {
+ report_error(internal::format_windows_error, error_code, message);
+}
+#endif
+
+FMT_FUNC void spdlog::details::fmt::print(std::FILE *f, StringRef format_str, ArgList args) {
+ MemoryWriter w;
+ w.write(format_str, args);
+ std::fwrite(w.data(), 1, w.size(), f);
+}
+
+FMT_FUNC void spdlog::details::fmt::print(StringRef format_str, ArgList args) {
+ print(stdout, format_str, args);
+}
+
+FMT_FUNC void spdlog::details::fmt::print(std::ostream &os, StringRef format_str, ArgList args) {
+ MemoryWriter w;
+ w.write(format_str, args);
+ os.write(w.data(), w.size());
+}
+
+FMT_FUNC void spdlog::details::fmt::print_colored(Color c, StringRef format, ArgList args) {
+ char escape[] = "\x1b[30m";
+ escape[3] = '0' + static_cast<char>(c);
+ std::fputs(escape, stdout);
+ print(format, args);
+ std::fputs(RESET_COLOR, stdout);
+}
+
+FMT_FUNC int spdlog::details::fmt::fprintf(std::FILE *f, StringRef format, ArgList args) {
+ MemoryWriter w;
+ printf(w, format, args);
+ std::size_t size = w.size();
+ return std::fwrite(w.data(), 1, size, f) < size ? -1 : static_cast<int>(size);
+}
+
+// Explicit instantiations for char.
+
+template const char *spdlog::details::fmt::BasicFormatter<char>::format(
+ const char *&format_str, const spdlog::details::fmt::internal::Arg &arg);
+
+template void spdlog::details::fmt::BasicFormatter<char>::format(
+ BasicStringRef<char> format, const ArgList &args);
+
+template void spdlog::details::fmt::internal::PrintfFormatter<char>::format(
+ BasicWriter<char> &writer, BasicStringRef<char> format, const ArgList &args);
+
+template int spdlog::details::fmt::internal::CharTraits<char>::format_float(
+ char *buffer, std::size_t size, const char *format,
+ unsigned width, int precision, double value);
+
+template int spdlog::details::fmt::internal::CharTraits<char>::format_float(
+ char *buffer, std::size_t size, const char *format,
+ unsigned width, int precision, long double value);
+
+// Explicit instantiations for wchar_t.
+
+template const wchar_t *spdlog::details::fmt::BasicFormatter<wchar_t>::format(
+ const wchar_t *&format_str, const spdlog::details::fmt::internal::Arg &arg);
+
+template void spdlog::details::fmt::BasicFormatter<wchar_t>::format(
+ BasicStringRef<wchar_t> format, const ArgList &args);
+
+template void spdlog::details::fmt::internal::PrintfFormatter<wchar_t>::format(
+ BasicWriter<wchar_t> &writer, BasicStringRef<wchar_t> format,
+ const ArgList &args);
+
+template int spdlog::details::fmt::internal::CharTraits<wchar_t>::format_float(
+ wchar_t *buffer, std::size_t size, const wchar_t *format,
+ unsigned width, int precision, double value);
+
+template int spdlog::details::fmt::internal::CharTraits<wchar_t>::format_float(
+ wchar_t *buffer, std::size_t size, const wchar_t *format,
+ unsigned width, int precision, long double value);
+
+#if _MSC_VER
+# pragma warning(pop)
+#endif
\ No newline at end of file
/src/sleek/device/console/details/format.cc
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/sleek/device/console/details/format.h
===================================================================
--- src/sleek/device/console/details/format.h (nonexistent)
+++ src/sleek/device/console/details/format.h (revision 22)
@@ -0,0 +1,2886 @@
+/*
+Formatting library for C++
+
+Copyright (c) 2012 - 2014, Victor Zverovich
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef SPDLOG_FMT_FORMAT_H_
+#define SPDLOG_FMT_FORMAT_H_
+
+#include <stdint.h>
+
+#include <cassert>
+#include <cmath>
+#include <cstddef> // for std::ptrdiff_t
+#include <cstdio>
+#include <algorithm>
+#include <limits>
+#include <stdexcept>
+#include <string>
+#include <sstream>
+
+#if _SECURE_SCL
+# include <iterator>
+#endif
+
+#ifdef __GNUC__
+// Ignore shadow warnings
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wshadow"
+
+# define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
+# define FMT_GCC_EXTENSION __extension__
+// Disable warning about "long long" which is sometimes reported even
+// when using __extension__.
+# if FMT_GCC_VERSION >= 406
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wlong-long"
+# endif
+#else
+# define FMT_GCC_EXTENSION
+#endif
+
+#ifdef __GNUC_LIBSTD__
+# define FMT_GNUC_LIBSTD_VERSION (__GNUC_LIBSTD__ * 100 + __GNUC_LIBSTD_MINOR__)
+#endif
+
+#ifdef __has_feature
+# define FMT_HAS_FEATURE(x) __has_feature(x)
+#else
+# define FMT_HAS_FEATURE(x) 0
+#endif
+
+#ifdef __has_builtin
+# define FMT_HAS_BUILTIN(x) __has_builtin(x)
+#else
+# define FMT_HAS_BUILTIN(x) 0
+#endif
+
+#ifndef FMT_USE_VARIADIC_TEMPLATES
+// Variadic templates are available in GCC since version 4.4
+// (http://gcc.gnu.org/projects/cxx0x.html) and in Visual C++
+// since version 2013.
+# define FMT_USE_VARIADIC_TEMPLATES \
+ (FMT_HAS_FEATURE(cxx_variadic_templates) || \
+ (FMT_GCC_VERSION >= 404 && __cplusplus >= 201103) || _MSC_VER >= 1800)
+#endif
+
+#ifndef FMT_USE_RVALUE_REFERENCES
+// Don't use rvalue references when compiling with clang and an old libstdc++
+// as the latter doesn't provide std::move.
+# if defined(FMT_GNUC_LIBSTD_VERSION) && FMT_GNUC_LIBSTD_VERSION <= 402
+# define FMT_USE_RVALUE_REFERENCES 0
+# else
+# define FMT_USE_RVALUE_REFERENCES \
+ (FMT_HAS_FEATURE(cxx_rvalue_references) || \
+ (FMT_GCC_VERSION >= 403 && __cplusplus >= 201103) || _MSC_VER >= 1600)
+# endif
+#endif
+
+#if FMT_USE_RVALUE_REFERENCES
+# include <utility> // for std::move
+#endif
+
+// Define FMT_USE_NOEXCEPT to make C++ Format use noexcept (C++11 feature).
+#if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \
+ (FMT_GCC_VERSION >= 408 && __cplusplus >= 201103)
+# define FMT_NOEXCEPT(expr) noexcept(expr)
+#else
+# define FMT_NOEXCEPT(expr)
+#endif
+
+// A macro to disallow the copy constructor and operator= functions
+// This should be used in the private: declarations for a class
+#define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName&); \
+ void operator=(const TypeName&)
+namespace spdlog
+{
+namespace details
+{
+namespace fmt
+{
+
+// Fix the warning about long long on older versions of GCC
+// that don't support the diagnostic pragma.
+FMT_GCC_EXTENSION typedef long long LongLong;
+FMT_GCC_EXTENSION typedef unsigned long long ULongLong;
+
+#if FMT_USE_RVALUE_REFERENCES
+using std::move;
+#endif
+
+template <typename Char>
+class BasicWriter;
+
+typedef BasicWriter<char> Writer;
+typedef BasicWriter<wchar_t> WWriter;
+
+template <typename Char>
+class BasicFormatter;
+
+template <typename Char, typename T>
+void format(BasicFormatter<Char> &f, const Char *&format_str, const T &value);
+
+/**
+\rst
+A string reference. It can be constructed from a C string or
+``std::string``.
+
+You can use one of the following typedefs for common character types:
+
++------------+-------------------------+
+| Type | Definition |
++============+=========================+
+| StringRef | BasicStringRef<char> |
++------------+-------------------------+
+| WStringRef | BasicStringRef<wchar_t> |
++------------+-------------------------+
+
+This class is most useful as a parameter type to allow passing
+different types of strings to a function, for example::
+
+template <typename... Args>
+std::string format(StringRef format, const Args & ... args);
+
+format("{}", 42);
+format(std::string("{}"), 42);
+\endrst
+*/
+template <typename Char>
+class BasicStringRef
+{
+private:
+ const Char *data_;
+ std::size_t size_;
+
+public:
+ /**
+ Constructs a string reference object from a C string and a size.
+ */
+ BasicStringRef(const Char *s, std::size_t size) : data_(s), size_(size) {}
+
+ /**
+ Constructs a string reference object from a C string computing
+ the size with ``std::char_traits<Char>::length``.
+ */
+ BasicStringRef(const Char *s)
+ : data_(s), size_(std::char_traits<Char>::length(s)) {}
+
+ /**
+ Constructs a string reference from an `std::string` object.
+ */
+ BasicStringRef(const std::basic_string<Char> &s)
+ : data_(s.c_str()), size_(s.size()) {}
+
+ /**
+ Converts a string reference to an `std::string` object.
+ */
+ operator std::basic_string<Char>() const
+ {
+ return std::basic_string<Char>(data_, size());
+ }
+
+ /**
+ Returns the pointer to a C string.
+ */
+ const Char *c_str() const
+ {
+ return data_;
+ }
+
+ /**
+ Returns the string size.
+ */
+ std::size_t size() const
+ {
+ return size_;
+ }
+
+ friend bool operator==(BasicStringRef lhs, BasicStringRef rhs)
+ {
+ return lhs.data_ == rhs.data_;
+ }
+ friend bool operator!=(BasicStringRef lhs, BasicStringRef rhs)
+ {
+ return lhs.data_ != rhs.data_;
+ }
+};
+
+typedef BasicStringRef<char> StringRef;
+typedef BasicStringRef<wchar_t> WStringRef;
+
+/**
+A formatting error such as invalid format string.
+*/
+class FormatError : public std::runtime_error
+{
+public:
+ explicit FormatError(StringRef message)
+ : std::runtime_error(message.c_str()) {}
+};
+
+namespace internal
+{
+
+// The number of characters to store in the MemoryBuffer object itself
+// to avoid dynamic memory allocation.
+enum { INLINE_BUFFER_SIZE = 500 };
+
+#if _SECURE_SCL
+// Use checked iterator to avoid warnings on MSVC.
+template <typename T>
+inline stdext::checked_array_iterator<T*> make_ptr(T *ptr, std::size_t size)
+{
+ return stdext::checked_array_iterator<T*>(ptr, size);
+}
+#else
+template <typename T>
+inline T *make_ptr(T *ptr, std::size_t)
+{
+ return ptr;
+}
+#endif
+
+// A buffer for POD types. It supports a subset of std::vector's operations.
+template <typename T>
+class Buffer
+{
+private:
+ FMT_DISALLOW_COPY_AND_ASSIGN(Buffer);
+
+protected:
+ T *ptr_;
+ std::size_t size_;
+ std::size_t capacity_;
+
+ Buffer(T *ptr = 0, std::size_t capacity = 0)
+ : ptr_(ptr), size_(0), capacity_(capacity) {}
+
+ virtual void grow(std::size_t size) = 0;
+
+public:
+ virtual ~Buffer() {}
+
+ // Returns the size of this buffer.
+ std::size_t size() const
+ {
+ return size_;
+ }
+
+ // Returns the capacity of this buffer.
+ std::size_t capacity() const
+ {
+ return capacity_;
+ }
+
+ // Resizes the buffer. If T is a POD type new elements are not initialized.
+ void resize(std::size_t new_size)
+ {
+ if (new_size > capacity_)
+ grow(new_size);
+ size_ = new_size;
+ }
+
+ // Reserves space to store at least capacity elements.
+ void reserve(std::size_t capacity)
+ {
+ if (capacity > capacity_)
+ grow(capacity);
+ }
+
+ void clear() FMT_NOEXCEPT(true)
+ {
+ size_ = 0;
+ }
+
+ void push_back(const T &value)
+ {
+ if (size_ == capacity_)
+ grow(size_ + 1);
+ ptr_[size_++] = value;
+ }
+
+ // Appends data to the end of the buffer.
+ void append(const T *begin, const T *end);
+
+ T &operator[](std::size_t index)
+ {
+ return ptr_[index];
+ }
+ const T &operator[](std::size_t index) const
+ {
+ return ptr_[index];
+ }
+};
+
+template <typename T>
+void Buffer<T>::append(const T *begin, const T *end)
+{
+ std::ptrdiff_t num_elements = end - begin;
+ if (size_ + num_elements > capacity_)
+ grow(size_ + num_elements);
+ std::copy(begin, end, make_ptr(ptr_, capacity_) + size_);
+ size_ += num_elements;
+}
+
+// A memory buffer for POD types with the first SIZE elements stored in
+// the object itself.
+template <typename T, std::size_t SIZE, typename Allocator = std::allocator<T> >
+class MemoryBuffer : private Allocator, public Buffer<T>
+{
+private:
+ T data_[SIZE];
+
+ // Free memory allocated by the buffer.
+ void free()
+ {
+ if (this->ptr_ != data_) this->deallocate(this->ptr_, this->capacity_);
+ }
+
+protected:
+ void grow(std::size_t size);
+
+public:
+ explicit MemoryBuffer(const Allocator &alloc = Allocator())
+ : Allocator(alloc), Buffer<T>(data_, SIZE) {}
+ ~MemoryBuffer()
+ {
+ free();
+ }
+
+#if FMT_USE_RVALUE_REFERENCES
+private:
+ // Move data from other to this buffer.
+ void move(MemoryBuffer &other)
+ {
+ Allocator &this_alloc = *this, &other_alloc = other;
+ this_alloc = std::move(other_alloc);
+ this->size_ = other.size_;
+ this->capacity_ = other.capacity_;
+ if (other.ptr_ == other.data_)
+ {
+ this->ptr_ = data_;
+ std::copy(other.data_,
+ other.data_ + this->size_, make_ptr(data_, this->capacity_));
+ }
+ else
+ {
+ this->ptr_ = other.ptr_;
+ // Set pointer to the inline array so that delete is not called
+ // when freeing.
+ other.ptr_ = other.data_;
+ }
+ }
+
+public:
+ MemoryBuffer(MemoryBuffer &&other)
+ {
+ move(other);
+ }
+
+ MemoryBuffer &operator=(MemoryBuffer &&other)
+ {
+ assert(this != &other);
+ free();
+ move(other);
+ return *this;
+ }
+#endif
+
+ // Returns a copy of the allocator associated with this buffer.
+ Allocator get_allocator() const
+ {
+ return *this;
+ }
+};
+
+template <typename T, std::size_t SIZE, typename Allocator>
+void MemoryBuffer<T, SIZE, Allocator>::grow(std::size_t size)
+{
+ std::size_t new_capacity =
+ (std::max)(size, this->capacity_ + this->capacity_ / 2);
+ T *new_ptr = this->allocate(new_capacity);
+ // The following code doesn't throw, so the raw pointer above doesn't leak.
+ std::copy(this->ptr_,
+ this->ptr_ + this->size_, make_ptr(new_ptr, new_capacity));
+ std::size_t old_capacity = this->capacity_;
+ T *old_ptr = this->ptr_;
+ this->capacity_ = new_capacity;
+ this->ptr_ = new_ptr;
+ // deallocate may throw (at least in principle), but it doesn't matter since
+ // the buffer already uses the new storage and will deallocate it in case
+ // of exception.
+ if (old_ptr != data_)
+ this->deallocate(old_ptr, old_capacity);
+}
+
+#ifndef _MSC_VER
+// Portable version of signbit.
+inline int getsign(double x)
+{
+ // When compiled in C++11 mode signbit is no longer a macro but a function
+ // defined in namespace std and the macro is undefined.
+# ifdef signbit
+ return signbit(x);
+# else
+ return std::signbit(x);
+# endif
+}
+
+// Portable version of isinf.
+# ifdef isinf
+inline int isinfinity(double x)
+{
+ return isinf(x);
+}
+inline int isinfinity(long double x)
+{
+ return isinf(x);
+}
+# else
+inline int isinfinity(double x)
+{
+ return std::isinf(x);
+}
+inline int isinfinity(long double x)
+{
+ return std::isinf(x);
+}
+# endif
+#else
+inline int getsign(double value)
+{
+ if (value < 0) return 1;
+ if (value == value) return 0;
+ int dec = 0, sign = 0;
+ char buffer[2]; // The buffer size must be >= 2 or _ecvt_s will fail.
+ _ecvt_s(buffer, sizeof(buffer), value, 0, &dec, &sign);
+ return sign;
+}
+inline int isinfinity(double x)
+{
+ return !_finite(x);
+}
+#endif
+
+template <typename T>
+struct IsLongDouble
+{
+ enum { VALUE = 0 };
+};
+
+template <>
+struct IsLongDouble<long double>
+{
+ enum { VALUE = 1 };
+};
+
+template <typename Char>
+class BasicCharTraits
+{
+public:
+#if _SECURE_SCL
+ typedef stdext::checked_array_iterator<Char*> CharPtr;
+#else
+ typedef Char *CharPtr;
+#endif
+};
+
+template <typename Char>
+class CharTraits;
+
+template <>
+class CharTraits<char> : public BasicCharTraits<char>
+{
+private:
+ // Conversion from wchar_t to char is not allowed.
+ static char convert(wchar_t);
+
+public:
+ typedef const wchar_t *UnsupportedStrType;
+
+ static char convert(char value)
+ {
+ return value;
+ }
+
+ // Formats a floating-point number.
+ template <typename T>
+ static int format_float(char *buffer, std::size_t size,
+ const char *format, unsigned width, int precision, T value);
+};
+
+template <>
+class CharTraits<wchar_t> : public BasicCharTraits<wchar_t>
+{
+public:
+ typedef const char *UnsupportedStrType;
+
+ static wchar_t convert(char value)
+ {
+ return value;
+ }
+ static wchar_t convert(wchar_t value)
+ {
+ return value;
+ }
+
+ template <typename T>
+ static int format_float(wchar_t *buffer, std::size_t size,
+ const wchar_t *format, unsigned width, int precision, T value);
+};
+
+// Checks if a number is negative - used to avoid warnings.
+template <bool IsSigned>
+struct SignChecker
+{
+ template <typename T>
+ static bool is_negative(T value)
+ {
+ return value < 0;
+ }
+};
+
+template <>
+struct SignChecker<false>
+{
+ template <typename T>
+ static bool is_negative(T)
+ {
+ return false;
+ }
+};
+
+// Returns true if value is negative, false otherwise.
+// Same as (value < 0) but doesn't produce warnings if T is an unsigned type.
+template <typename T>
+inline bool is_negative(T value)
+{
+ return SignChecker<std::numeric_limits<T>::is_signed>::is_negative(value);
+}
+
+// Selects uint32_t if FitsIn32Bits is true, uint64_t otherwise.
+template <bool FitsIn32Bits>
+struct TypeSelector
+{
+ typedef uint32_t Type;
+};
+
+template <>
+struct TypeSelector<false>
+{
+ typedef uint64_t Type;
+};
+
+template <typename T>
+struct IntTraits
+{
+ // Smallest of uint32_t and uint64_t that is large enough to represent
+ // all values of T.
+ typedef typename
+ TypeSelector<std::numeric_limits<T>::digits <= 32>::Type MainType;
+};
+
+// MakeUnsigned<T>::Type gives an unsigned type corresponding to integer type T.
+template <typename T>
+struct MakeUnsigned
+{
+ typedef T Type;
+};
+
+#define FMT_SPECIALIZE_MAKE_UNSIGNED(T, U) \
+ template <> \
+ struct MakeUnsigned<T> { typedef U Type; }
+
+FMT_SPECIALIZE_MAKE_UNSIGNED(char, unsigned char);
+FMT_SPECIALIZE_MAKE_UNSIGNED(signed char, unsigned char);
+FMT_SPECIALIZE_MAKE_UNSIGNED(short, unsigned short);
+FMT_SPECIALIZE_MAKE_UNSIGNED(int, unsigned);
+FMT_SPECIALIZE_MAKE_UNSIGNED(long, unsigned long);
+FMT_SPECIALIZE_MAKE_UNSIGNED(LongLong, ULongLong);
+
+void report_unknown_type(char code, const char *type);
+
+// Static data is placed in this class template to allow header-only
+// configuration.
+template <typename T = void>
+struct BasicData
+{
+ static const uint32_t POWERS_OF_10_32[];
+ static const uint64_t POWERS_OF_10_64[];
+ static const char DIGITS[];
+};
+
+typedef BasicData<> Data;
+
+#if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clzll)
+// Returns the number of decimal digits in n. Leading zeros are not counted
+// except for n == 0 in which case count_digits returns 1.
+inline unsigned count_digits(uint64_t n)
+{
+ // Based on http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
+ // and the benchmark https://github.com/localvoid/cxx-benchmark-count-digits.
+ unsigned t = (64 - __builtin_clzll(n | 1)) * 1233 >> 12;
+ return t - (n < Data::POWERS_OF_10_64[t]) + 1;
+}
+# if FMT_GCC_VERSION >= 400 || FMT_HAS_BUILTIN(__builtin_clz)
+// Optional version of count_digits for better performance on 32-bit platforms.
+inline unsigned count_digits(uint32_t n)
+{
+ uint32_t t = (32 - __builtin_clz(n | 1)) * 1233 >> 12;
+ return t - (n < Data::POWERS_OF_10_32[t]) + 1;
+}
+# endif
+#else
+// Fallback version of count_digits used when __builtin_clz is not available.
+inline unsigned count_digits(uint64_t n)
+{
+ unsigned count = 1;
+ for (;;)
+ {
+ // Integer division is slow so do it for a group of four digits instead
+ // of for every digit. The idea comes from the talk by Alexandrescu
+ // "Three Optimization Tips for C++". See speed-test for a comparison.
+ if (n < 10) return count;
+ if (n < 100) return count + 1;
+ if (n < 1000) return count + 2;
+ if (n < 10000) return count + 3;
+ n /= 10000u;
+ count += 4;
+ }
+}
+#endif
+
+// Formats a decimal unsigned integer value writing into buffer.
+template <typename UInt, typename Char>
+inline void format_decimal(Char *buffer, UInt value, unsigned num_digits)
+{
+ --num_digits;
+ while (value >= 100)
+ {
+ // Integer division is slow so do it for a group of two digits instead
+ // of for every digit. The idea comes from the talk by Alexandrescu
+ // "Three Optimization Tips for C++". See speed-test for a comparison.
+ unsigned index = (value % 100) * 2;
+ value /= 100;
+ buffer[num_digits] = Data::DIGITS[index + 1];
+ buffer[num_digits - 1] = Data::DIGITS[index];
+ num_digits -= 2;
+ }
+ if (value < 10)
+ {
+ *buffer = static_cast<char>('0' + value);
+ return;
+ }
+ unsigned index = static_cast<unsigned>(value * 2);
+ buffer[1] = Data::DIGITS[index + 1];
+ buffer[0] = Data::DIGITS[index];
+}
+
+#ifdef _WIN32
+// A converter from UTF-8 to UTF-16.
+// It is only provided for Windows since other systems support UTF-8 natively.
+class UTF8ToUTF16
+{
+private:
+ MemoryBuffer<wchar_t, INLINE_BUFFER_SIZE> buffer_;
+
+public:
+ explicit UTF8ToUTF16(StringRef s);
+ operator WStringRef() const
+ {
+ return WStringRef(&buffer_[0], size());
+ }
+ size_t size() const
+ {
+ return buffer_.size() - 1;
+ }
+ const wchar_t *c_str() const
+ {
+ return &buffer_[0];
+ }
+ std::wstring str() const
+ {
+ return std::wstring(&buffer_[0], size());
+ }
+};
+
+// A converter from UTF-16 to UTF-8.
+// It is only provided for Windows since other systems support UTF-8 natively.
+class UTF16ToUTF8
+{
+private:
+ MemoryBuffer<char, INLINE_BUFFER_SIZE> buffer_;
+
+public:
+ UTF16ToUTF8() {}
+ explicit UTF16ToUTF8(WStringRef s);
+ operator StringRef() const
+ {
+ return StringRef(&buffer_[0], size());
+ }
+ size_t size() const
+ {
+ return buffer_.size() - 1;
+ }
+ const char *c_str() const
+ {
+ return &buffer_[0];
+ }
+ std::string str() const
+ {
+ return std::string(&buffer_[0], size());
+ }
+
+ // Performs conversion returning a system error code instead of
+ // throwing exception on conversion error. This method may still throw
+ // in case of memory allocation error.
+ int convert(WStringRef s);
+};
+#endif
+
+void format_system_error(fmt::Writer &out, int error_code,
+ fmt::StringRef message) FMT_NOEXCEPT(true);
+
+#ifdef _WIN32
+void format_windows_error(fmt::Writer &out, int error_code,
+ fmt::StringRef message) FMT_NOEXCEPT(true);
+#endif
+
+// Computes max(Arg, 1) at compile time. It is used to avoid errors about
+// allocating an array of 0 size.
+template <unsigned Arg>
+struct NonZero
+{
+ enum { VALUE = Arg };
+};
+
+template <>
+struct NonZero<0>
+{
+ enum { VALUE = 1 };
+};
+
+// The value of a formatting argument. It is a POD type to allow storage in
+// internal::MemoryBuffer.
+struct Value
+{
+ template <typename Char>
+ struct StringValue
+ {
+ const Char *value;
+ std::size_t size;
+ };
+
+ typedef void(*FormatFunc)(
+ void *formatter, const void *arg, void *format_str_ptr);
+
+ struct CustomValue
+ {
+ const void *value;
+ FormatFunc format;
+ };
+
+ union
+ {
+ int int_value;
+ unsigned uint_value;
+ LongLong long_long_value;
+ ULongLong ulong_long_value;
+ double double_value;
+ long double long_double_value;
+ const void *pointer;
+ StringValue<char> string;
+ StringValue<signed char> sstring;
+ StringValue<unsigned char> ustring;
+ StringValue<wchar_t> wstring;
+ CustomValue custom;
+ };
+};
+
+struct Arg : Value
+{
+ enum Type
+ {
+ NONE,
+ // Integer types should go first,
+ INT, UINT, LONG_LONG, ULONG_LONG, CHAR, LAST_INTEGER_TYPE = CHAR,
+ // followed by floating-point types.
+ DOUBLE, LONG_DOUBLE, LAST_NUMERIC_TYPE = LONG_DOUBLE,
+ CSTRING, STRING, WSTRING, POINTER, CUSTOM
+ };
+ Type type;
+};
+
+// Makes a Value object from any type.
+template <typename Char>
+class MakeValue : public Value
+{
+private:
+ // The following two methods are private to disallow formatting of
+ // arbitrary pointers. If you want to output a pointer cast it to
+ // "void *" or "const void *". In particular, this forbids formatting
+ // of "[const] volatile char *" which is printed as bool by iostreams.
+ // Do not implement!
+ template <typename T>
+ MakeValue(const T *value);
+ template <typename T>
+ MakeValue(T *value);
+
+ void set_string(StringRef str)
+ {
+ string.value = str.c_str();
+ string.size = str.size();
+ }
+
+ void set_string(WStringRef str)
+ {
+ CharTraits<Char>::convert(wchar_t());
+ wstring.value = str.c_str();
+ wstring.size = str.size();
+ }
+
+ // Formats an argument of a custom type, such as a user-defined class.
+ template <typename T>
+ static void format_custom_arg(
+ void *formatter, const void *arg, void *format_str_ptr)
+ {
+ format(*static_cast<BasicFormatter<Char>*>(formatter),
+ *static_cast<const Char**>(format_str_ptr),
+ *static_cast<const T*>(arg));
+ }
+
+public:
+ MakeValue() {}
+
+#define FMT_MAKE_VALUE(Type, field, TYPE) \
+ MakeValue(Type value) { field = value; } \
+ static uint64_t type(Type) { return Arg::TYPE; }
+
+ FMT_MAKE_VALUE(bool, int_value, INT)
+ FMT_MAKE_VALUE(short, int_value, INT)
+ FMT_MAKE_VALUE(unsigned short, uint_value, UINT)
+ FMT_MAKE_VALUE(int, int_value, INT)
+ FMT_MAKE_VALUE(unsigned, uint_value, UINT)
+
+ MakeValue(long value)
+ {
+ // To minimize the number of types we need to deal with, long is
+ // translated either to int or to long long depending on its size.
+ if (sizeof(long) == sizeof(int))
+ int_value = static_cast<int>(value);
+ else
+ long_long_value = value;
+ }
+ static uint64_t type(long)
+ {
+ return sizeof(long) == sizeof(int) ? Arg::INT : Arg::LONG_LONG;
+ }
+
+ MakeValue(unsigned long value)
+ {
+ if (sizeof(unsigned long) == sizeof(unsigned))
+ uint_value = static_cast<unsigned>(value);
+ else
+ ulong_long_value = value;
+ }
+ static uint64_t type(unsigned long)
+ {
+ return sizeof(unsigned long) == sizeof(unsigned) ?
+ Arg::UINT : Arg::ULONG_LONG;
+ }
+
+ FMT_MAKE_VALUE(LongLong, long_long_value, LONG_LONG)
+ FMT_MAKE_VALUE(ULongLong, ulong_long_value, ULONG_LONG)
+ FMT_MAKE_VALUE(float, double_value, DOUBLE)
+ FMT_MAKE_VALUE(double, double_value, DOUBLE)
+ FMT_MAKE_VALUE(long double, long_double_value, LONG_DOUBLE)
+ FMT_MAKE_VALUE(signed char, int_value, CHAR)
+ FMT_MAKE_VALUE(unsigned char, int_value, CHAR)
+ FMT_MAKE_VALUE(char, int_value, CHAR)
+
+ MakeValue(wchar_t value)
+ {
+ int_value = internal::CharTraits<Char>::convert(value);
+ }
+ static uint64_t type(wchar_t)
+ {
+ return Arg::CHAR;
+ }
+
+#define FMT_MAKE_STR_VALUE(Type, TYPE) \
+ MakeValue(Type value) { set_string(value); } \
+ static uint64_t type(Type) { return Arg::TYPE; }
+
+ FMT_MAKE_VALUE(char *, string.value, CSTRING)
+ FMT_MAKE_VALUE(const char *, string.value, CSTRING)
+ FMT_MAKE_VALUE(const signed char *, sstring.value, CSTRING)
+ FMT_MAKE_VALUE(const unsigned char *, ustring.value, CSTRING)
+ FMT_MAKE_STR_VALUE(const std::string &, STRING)
+ FMT_MAKE_STR_VALUE(StringRef, STRING)
+
+ FMT_MAKE_STR_VALUE(wchar_t *, WSTRING)
+ FMT_MAKE_STR_VALUE(const wchar_t *, WSTRING)
+ FMT_MAKE_STR_VALUE(const std::wstring &, WSTRING)
+ FMT_MAKE_STR_VALUE(WStringRef, WSTRING)
+
+ FMT_MAKE_VALUE(void *, pointer, POINTER)
+ FMT_MAKE_VALUE(const void *, pointer, POINTER)
+
+ template <typename T>
+ MakeValue(const T &value)
+ {
+ custom.value = &value;
+ custom.format = &format_custom_arg<T>;
+ }
+ template <typename T>
+ static uint64_t type(const T &)
+ {
+ return Arg::CUSTOM;
+ }
+};
+
+#define FMT_DISPATCH(call) static_cast<Impl*>(this)->call
+
+// An argument visitor.
+// To use ArgVisitor define a subclass that implements some or all of the
+// visit methods with the same signatures as the methods in ArgVisitor,
+// for example, visit_int(int).
+// Specify the subclass name as the Impl template parameter. Then calling
+// ArgVisitor::visit for some argument will dispatch to a visit method
+// specific to the argument type. For example, if the argument type is
+// double then visit_double(double) method of a subclass will be called.
+// If the subclass doesn't contain a method with this signature, then
+// a corresponding method of ArgVisitor will be called.
+//
+// Example:
+// class MyArgVisitor : public ArgVisitor<MyArgVisitor, void> {
+// public:
+// void visit_int(int value) { print("{}", value); }
+// void visit_double(double value) { print("{}", value ); }
+// };
+//
+// ArgVisitor uses the curiously recurring template pattern:
+// http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern
+template <typename Impl, typename Result>
+class ArgVisitor
+{
+public:
+ Result visit_unhandled_arg()
+ {
+ return Result();
+ }
+
+ Result visit_int(int value)
+ {
+ return FMT_DISPATCH(visit_any_int(value));
+ }
+ Result visit_long_long(LongLong value)
+ {
+ return FMT_DISPATCH(visit_any_int(value));
+ }
+ Result visit_uint(unsigned value)
+ {
+ return FMT_DISPATCH(visit_any_int(value));
+ }
+ Result visit_ulong_long(ULongLong value)
+ {
+ return FMT_DISPATCH(visit_any_int(value));
+ }
+ Result visit_char(int value)
+ {
+ return FMT_DISPATCH(visit_any_int(value));
+ }
+ template <typename T>
+ Result visit_any_int(T)
+ {
+ return FMT_DISPATCH(visit_unhandled_arg());
+ }
+
+ Result visit_double(double value)
+ {
+ return FMT_DISPATCH(visit_any_double(value));
+ }
+ Result visit_long_double(long double value)
+ {
+ return FMT_DISPATCH(visit_any_double(value));
+ }
+ template <typename T>
+ Result visit_any_double(T)
+ {
+ return FMT_DISPATCH(visit_unhandled_arg());
+ }
+
+ Result visit_string(Arg::StringValue<char>)
+ {
+ return FMT_DISPATCH(visit_unhandled_arg());
+ }
+ Result visit_wstring(Arg::StringValue<wchar_t>)
+ {
+ return FMT_DISPATCH(visit_unhandled_arg());
+ }
+ Result visit_pointer(const void *)
+ {
+ return FMT_DISPATCH(visit_unhandled_arg());
+ }
+ Result visit_custom(Arg::CustomValue)
+ {
+ return FMT_DISPATCH(visit_unhandled_arg());
+ }
+
+ Result visit(const Arg &arg)
+ {
+ switch (arg.type)
+ {
+ default:
+ assert(false);
+ // Fall through.
+ case Arg::INT:
+ return FMT_DISPATCH(visit_int(arg.int_value));
+ case Arg::UINT:
+ return FMT_DISPATCH(visit_uint(arg.uint_value));
+ case Arg::LONG_LONG:
+ return FMT_DISPATCH(visit_long_long(arg.long_long_value));
+ case Arg::ULONG_LONG:
+ return FMT_DISPATCH(visit_ulong_long(arg.ulong_long_value));
+ case Arg::DOUBLE:
+ return FMT_DISPATCH(visit_double(arg.double_value));
+ case Arg::LONG_DOUBLE:
+ return FMT_DISPATCH(visit_long_double(arg.long_double_value));
+ case Arg::CHAR:
+ return FMT_DISPATCH(visit_char(arg.int_value));
+ case Arg::CSTRING:
+ {
+ Value::StringValue<char> str = arg.string;
+ str.size = 0;
+ return FMT_DISPATCH(visit_string(str));
+ }
+ case Arg::STRING:
+ return FMT_DISPATCH(visit_string(arg.string));
+ case Arg::WSTRING:
+ return FMT_DISPATCH(visit_wstring(arg.wstring));
+ case Arg::POINTER:
+ return FMT_DISPATCH(visit_pointer(arg.pointer));
+ case Arg::CUSTOM:
+ return FMT_DISPATCH(visit_custom(arg.custom));
+ }
+ }
+};
+
+class RuntimeError : public std::runtime_error
+{
+protected:
+ RuntimeError() : std::runtime_error("") {}
+};
+
+template <typename Char>
+class ArgFormatter;
+} // namespace internal
+
+/**
+An argument list.
+*/
+class ArgList
+{
+private:
+ uint64_t types_;
+ const internal::Value *values_;
+
+public:
+ // Maximum number of arguments that can be passed in ArgList.
+ enum { MAX_ARGS = 16 };
+
+ ArgList() : types_(0) {}
+ ArgList(ULongLong types, const internal::Value *values)
+ : types_(types), values_(values) {}
+
+ /**
+ Returns the argument at specified index.
+ */
+ internal::Arg operator[](unsigned index) const
+ {
+ using internal::Arg;
+ Arg arg;
+ if (index >= MAX_ARGS)
+ {
+ arg.type = Arg::NONE;
+ return arg;
+ }
+ unsigned shift = index * 4;
+ uint64_t mask = 0xf;
+ Arg::Type type =
+ static_cast<Arg::Type>((types_ & (mask << shift)) >> shift);
+ arg.type = type;
+ if (type != Arg::NONE)
+ {
+ internal::Value &value = arg;
+ value = values_[index];
+ }
+ return arg;
+ }
+};
+
+struct FormatSpec;
+
+namespace internal
+{
+
+class FormatterBase
+{
+private:
+ ArgList args_;
+ int next_arg_index_;
+
+ // Returns the argument with specified index.
+ Arg do_get_arg(unsigned arg_index, const char *&error);
+
+protected:
+ void set_args(const ArgList &args)
+ {
+ args_ = args;
+ next_arg_index_ = 0;
+ }
+
+ // Returns the next argument.
+ Arg next_arg(const char *&error);
+
+ // Checks if manual indexing is used and returns the argument with
+ // specified index.
+ Arg get_arg(unsigned arg_index, const char *&error);
+
+ template <typename Char>
+ void write(BasicWriter<Char> &w, const Char *start, const Char *end)
+ {
+ if (start != end)
+ w << BasicStringRef<Char>(start, end - start);
+ }
+};
+
+// A printf formatter.
+template <typename Char>
+class PrintfFormatter : private FormatterBase
+{
+private:
+ void parse_flags(FormatSpec &spec, const Char *&s);
+
+ // Returns the argument with specified index or, if arg_index is equal
+ // to the maximum unsigned value, the next argument.
+ Arg get_arg(const Char *s,
+ unsigned arg_index = (std::numeric_limits<unsigned>::max)());
+
+ // Parses argument index, flags and width and returns the argument index.
+ unsigned parse_header(const Char *&s, FormatSpec &spec);
+
+public:
+ void format(BasicWriter<Char> &writer,
+ BasicStringRef<Char> format, const ArgList &args);
+};
+} // namespace internal
+
+// A formatter.
+template <typename Char>
+class BasicFormatter : private internal::FormatterBase
+{
+private:
+ BasicWriter<Char> &writer_;
+ const Char *start_;
+
+ // Parses argument index and returns corresponding argument.
+ internal::Arg parse_arg_index(const Char *&s);
+
+public:
+ explicit BasicFormatter(BasicWriter<Char> &w) : writer_(w) {}
+
+ BasicWriter<Char> &writer()
+ {
+ return writer_;
+ }
+
+ void format(BasicStringRef<Char> format_str, const ArgList &args);
+
+ const Char *format(const Char *&format_str, const internal::Arg &arg);
+};
+
+enum Alignment
+{
+ ALIGN_DEFAULT, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, ALIGN_NUMERIC
+};
+
+// Flags.
+enum
+{
+ SIGN_FLAG = 1, PLUS_FLAG = 2, MINUS_FLAG = 4, HASH_FLAG = 8,
+ CHAR_FLAG = 0x10 // Argument has char type - used in error reporting.
+};
+
+// An empty format specifier.
+struct EmptySpec {};
+
+// A type specifier.
+template <char TYPE>
+struct TypeSpec : EmptySpec
+{
+ Alignment align() const
+ {
+ return ALIGN_DEFAULT;
+ }
+ unsigned width() const
+ {
+ return 0;
+ }
+ int precision() const
+ {
+ return -1;
+ }
+ bool flag(unsigned) const
+ {
+ return false;
+ }
+ char type() const
+ {
+ return TYPE;
+ }
+ char fill() const
+ {
+ return ' ';
+ }
+};
+
+// A width specifier.
+struct WidthSpec
+{
+ unsigned width_;
+ // Fill is always wchar_t and cast to char if necessary to avoid having
+ // two specialization of WidthSpec and its subclasses.
+ wchar_t fill_;
+
+ WidthSpec(unsigned width, wchar_t fill) : width_(width), fill_(fill) {}
+
+ unsigned width() const
+ {
+ return width_;
+ }
+ wchar_t fill() const
+ {
+ return fill_;
+ }
+};
+
+// An alignment specifier.
+struct AlignSpec : WidthSpec
+{
+ Alignment align_;
+
+ AlignSpec(unsigned width, wchar_t fill, Alignment align = ALIGN_DEFAULT)
+ : WidthSpec(width, fill), align_(align) {}
+
+ Alignment align() const
+ {
+ return align_;
+ }
+
+ int precision() const
+ {
+ return -1;
+ }
+};
+
+// An alignment and type specifier.
+template <char TYPE>
+struct AlignTypeSpec : AlignSpec
+{
+ AlignTypeSpec(unsigned width, wchar_t fill) : AlignSpec(width, fill) {}
+
+ bool flag(unsigned) const
+ {
+ return false;
+ }
+ char type() const
+ {
+ return TYPE;
+ }
+};
+
+// A full format specifier.
+struct FormatSpec : AlignSpec
+{
+ unsigned flags_;
+ int precision_;
+ char type_;
+
+ FormatSpec(
+ unsigned width = 0, char type = 0, wchar_t fill = ' ')
+ : AlignSpec(width, fill), flags_(0), precision_(-1), type_(type) {}
+
+ bool flag(unsigned f) const
+ {
+ return (flags_ & f) != 0;
+ }
+ int precision() const
+ {
+ return precision_;
+ }
+ char type() const
+ {
+ return type_;
+ }
+};
+
+// An integer format specifier.
+template <typename T, typename SpecT = TypeSpec<0>, typename Char = char>
+class IntFormatSpec : public SpecT
+{
+private:
+ T value_;
+
+public:
+ IntFormatSpec(T value, const SpecT &spec = SpecT())
+ : SpecT(spec), value_(value) {}
+
+ T value() const
+ {
+ return value_;
+ }
+};
+
+// A string format specifier.
+template <typename T>
+class StrFormatSpec : public AlignSpec
+{
+private:
+ const T *str_;
+
+public:
+ StrFormatSpec(const T *str, unsigned width, wchar_t fill)
+ : AlignSpec(width, fill), str_(str) {}
+
+ const T *str() const
+ {
+ return str_;
+ }
+};
+
+/**
+Returns an integer format specifier to format the value in base 2.
+*/
+IntFormatSpec<int, TypeSpec<'b'> > bin(int value);
+
+/**
+Returns an integer format specifier to format the value in base 8.
+*/
+IntFormatSpec<int, TypeSpec<'o'> > oct(int value);
+
+/**
+Returns an integer format specifier to format the value in base 16 using
+lower-case letters for the digits above 9.
+*/
+IntFormatSpec<int, TypeSpec<'x'> > hex(int value);
+
+/**
+Returns an integer formatter format specifier to format in base 16 using
+upper-case letters for the digits above 9.
+*/
+IntFormatSpec<int, TypeSpec<'X'> > hexu(int value);
+
+/**
+\rst
+Returns an integer format specifier to pad the formatted argument with the
+fill character to the specified width using the default (right) numeric
+alignment.
+
+**Example**::
+
+MemoryWriter out;
+out << pad(hex(0xcafe), 8, '0');
+// out.str() == "0000cafe"
+
+\endrst
+*/
+template <char TYPE_CODE, typename Char>
+IntFormatSpec<int, AlignTypeSpec<TYPE_CODE>, Char> pad(
+ int value, unsigned width, Char fill = ' ');
+
+#define FMT_DEFINE_INT_FORMATTERS(TYPE) \
+inline IntFormatSpec<TYPE, TypeSpec<'b'> > bin(TYPE value) { \
+ return IntFormatSpec<TYPE, TypeSpec<'b'> >(value, TypeSpec<'b'>()); \
+ } \
+ \
+inline IntFormatSpec<TYPE, TypeSpec<'o'> > oct(TYPE value) { \
+ return IntFormatSpec<TYPE, TypeSpec<'o'> >(value, TypeSpec<'o'>()); \
+ } \
+ \
+inline IntFormatSpec<TYPE, TypeSpec<'x'> > hex(TYPE value) { \
+ return IntFormatSpec<TYPE, TypeSpec<'x'> >(value, TypeSpec<'x'>()); \
+ } \
+ \
+inline IntFormatSpec<TYPE, TypeSpec<'X'> > hexu(TYPE value) { \
+ return IntFormatSpec<TYPE, TypeSpec<'X'> >(value, TypeSpec<'X'>()); \
+ } \
+ \
+template <char TYPE_CODE> \
+inline IntFormatSpec<TYPE, AlignTypeSpec<TYPE_CODE> > pad( \
+ IntFormatSpec<TYPE, TypeSpec<TYPE_CODE> > f, unsigned width) { \
+ return IntFormatSpec<TYPE, AlignTypeSpec<TYPE_CODE> >( \
+ f.value(), AlignTypeSpec<TYPE_CODE>(width, ' ')); \
+ } \
+ \
+/* For compatibility with older compilers we provide two overloads for pad, */ \
+/* one that takes a fill character and one that doesn't. In the future this */ \
+/* can be replaced with one overload making the template argument Char */ \
+/* default to char (C++11). */ \
+template <char TYPE_CODE, typename Char> \
+inline IntFormatSpec<TYPE, AlignTypeSpec<TYPE_CODE>, Char> pad( \
+ IntFormatSpec<TYPE, TypeSpec<TYPE_CODE>, Char> f, \
+ unsigned width, Char fill) { \
+ return IntFormatSpec<TYPE, AlignTypeSpec<TYPE_CODE>, Char>( \
+ f.value(), AlignTypeSpec<TYPE_CODE>(width, fill)); \
+ } \
+ \
+inline IntFormatSpec<TYPE, AlignTypeSpec<0> > pad( \
+ TYPE value, unsigned width) { \
+ return IntFormatSpec<TYPE, AlignTypeSpec<0> >( \
+ value, AlignTypeSpec<0>(width, ' ')); \
+ } \
+ \
+template <typename Char> \
+inline IntFormatSpec<TYPE, AlignTypeSpec<0>, Char> pad( \
+ TYPE value, unsigned width, Char fill) { \
+ return IntFormatSpec<TYPE, AlignTypeSpec<0>, Char>( \
+ value, AlignTypeSpec<0>(width, fill)); \
+ }
+
+FMT_DEFINE_INT_FORMATTERS(int)
+FMT_DEFINE_INT_FORMATTERS(long)
+FMT_DEFINE_INT_FORMATTERS(unsigned)
+FMT_DEFINE_INT_FORMATTERS(unsigned long)
+FMT_DEFINE_INT_FORMATTERS(LongLong)
+FMT_DEFINE_INT_FORMATTERS(ULongLong)
+
+/**
+\rst
+Returns a string formatter that pads the formatted argument with the fill
+character to the specified width using the default (left) string alignment.
+
+**Example**::
+
+std::string s = str(MemoryWriter() << pad("abc", 8));
+// s == "abc "
+
+\endrst
+*/
+template <typename Char>
+inline StrFormatSpec<Char> pad(
+ const Char *str, unsigned width, Char fill = ' ')
+{
+ return StrFormatSpec<Char>(str, width, fill);
+}
+
+inline StrFormatSpec<wchar_t> pad(
+ const wchar_t *str, unsigned width, char fill = ' ')
+{
+ return StrFormatSpec<wchar_t>(str, width, fill);
+}
+
+// Generates a comma-separated list with results of applying f to
+// numbers 0..n-1.
+# define FMT_GEN(n, f) FMT_GEN##n(f)
+# define FMT_GEN1(f) f(0)
+# define FMT_GEN2(f) FMT_GEN1(f), f(1)
+# define FMT_GEN3(f) FMT_GEN2(f), f(2)
+# define FMT_GEN4(f) FMT_GEN3(f), f(3)
+# define FMT_GEN5(f) FMT_GEN4(f), f(4)
+# define FMT_GEN6(f) FMT_GEN5(f), f(5)
+# define FMT_GEN7(f) FMT_GEN6(f), f(6)
+# define FMT_GEN8(f) FMT_GEN7(f), f(7)
+# define FMT_GEN9(f) FMT_GEN8(f), f(8)
+# define FMT_GEN10(f) FMT_GEN9(f), f(9)
+# define FMT_GEN11(f) FMT_GEN10(f), f(10)
+# define FMT_GEN12(f) FMT_GEN11(f), f(11)
+# define FMT_GEN13(f) FMT_GEN12(f), f(12)
+# define FMT_GEN14(f) FMT_GEN13(f), f(13)
+# define FMT_GEN15(f) FMT_GEN14(f), f(14)
+
+namespace internal
+{
+inline uint64_t make_type()
+{
+ return 0;
+}
+
+template <typename T>
+inline uint64_t make_type(const T &arg)
+{
+ return MakeValue<char>::type(arg);
+}
+
+#if FMT_USE_VARIADIC_TEMPLATES
+template <typename Arg, typename... Args>
+inline uint64_t make_type(const Arg &first, const Args & ... tail)
+{
+ return make_type(first) | (make_type(tail...) << 4);
+}
+#else
+
+struct ArgType
+{
+ uint64_t type;
+
+ ArgType() : type(0) {}
+
+ template <typename T>
+ ArgType(const T &arg) : type(make_type(arg)) {}
+};
+
+# define FMT_ARG_TYPE_DEFAULT(n) ArgType t##n = ArgType()
+
+inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT))
+{
+ return t0.type | (t1.type << 4) | (t2.type << 8) | (t3.type << 12) |
+ (t4.type << 16) | (t5.type << 20) | (t6.type << 24) | (t7.type << 28) |
+ (t8.type << 32) | (t9.type << 36) | (t10.type << 40) | (t11.type << 44) |
+ (t12.type << 48) | (t13.type << 52) | (t14.type << 56);
+}
+#endif
+} // namespace internal
+
+# define FMT_MAKE_TEMPLATE_ARG(n) typename T##n
+# define FMT_MAKE_ARG_TYPE(n) T##n
+# define FMT_MAKE_ARG(n) const T##n &v##n
+# define FMT_MAKE_REF_char(n) fmt::internal::MakeValue<char>(v##n)
+# define FMT_MAKE_REF_wchar_t(n) fmt::internal::MakeValue<wchar_t>(v##n)
+
+#if FMT_USE_VARIADIC_TEMPLATES
+// Defines a variadic function returning void.
+# define FMT_VARIADIC_VOID(func, arg_type) \
+ template <typename... Args> \
+ void func(arg_type arg1, const Args & ... args) { \
+ const fmt::internal::Value values[ \
+ fmt::internal::NonZero<sizeof...(Args)>::VALUE] = { \
+ fmt::internal::MakeValue<Char>(args)... \
+ }; \
+ func(arg1, ArgList(fmt::internal::make_type(args...), values)); \
+ }
+
+// Defines a variadic constructor.
+# define FMT_VARIADIC_CTOR(ctor, func, arg0_type, arg1_type) \
+ template <typename... Args> \
+ ctor(arg0_type arg0, arg1_type arg1, const Args & ... args) { \
+ using fmt::internal::MakeValue; \
+ const fmt::internal::Value values[ \
+ fmt::internal::NonZero<sizeof...(Args)>::VALUE] = { \
+ MakeValue<Char>(args)... \
+ }; \
+ func(arg0, arg1, ArgList(fmt::internal::make_type(args...), values)); \
+ }
+
+#else
+
+# define FMT_MAKE_REF(n) fmt::internal::MakeValue<Char>(v##n)
+# define FMT_MAKE_REF2(n) v##n
+
+// Defines a wrapper for a function taking one argument of type arg_type
+// and n additional arguments of arbitrary types.
+# define FMT_WRAP1(func, arg_type, n) \
+ template <FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> \
+ inline void func(arg_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) { \
+ const fmt::internal::Value vals[] = {FMT_GEN(n, FMT_MAKE_REF)}; \
+ func(arg1, fmt::ArgList( \
+ fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), vals)); \
+ }
+
+// Emulates a variadic function returning void on a pre-C++11 compiler.
+# define FMT_VARIADIC_VOID(func, arg_type) \
+ FMT_WRAP1(func, arg_type, 1) FMT_WRAP1(func, arg_type, 2) \
+ FMT_WRAP1(func, arg_type, 3) FMT_WRAP1(func, arg_type, 4) \
+ FMT_WRAP1(func, arg_type, 5) FMT_WRAP1(func, arg_type, 6) \
+ FMT_WRAP1(func, arg_type, 7) FMT_WRAP1(func, arg_type, 8) \
+ FMT_WRAP1(func, arg_type, 9) FMT_WRAP1(func, arg_type, 10)
+
+# define FMT_CTOR(ctor, func, arg0_type, arg1_type, n) \
+ template <FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> \
+ ctor(arg0_type arg0, arg1_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) { \
+ const fmt::internal::Value vals[] = {FMT_GEN(n, FMT_MAKE_REF)}; \
+ func(arg0, arg1, fmt::ArgList( \
+ fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), vals)); \
+ }
+
+// Emulates a variadic constructor on a pre-C++11 compiler.
+# define FMT_VARIADIC_CTOR(ctor, func, arg0_type, arg1_type) \
+ FMT_CTOR(ctor, func, arg0_type, arg1_type, 1) \
+ FMT_CTOR(ctor, func, arg0_type, arg1_type, 2) \
+ FMT_CTOR(ctor, func, arg0_type, arg1_type, 3) \
+ FMT_CTOR(ctor, func, arg0_type, arg1_type, 4) \
+ FMT_CTOR(ctor, func, arg0_type, arg1_type, 5) \
+ FMT_CTOR(ctor, func, arg0_type, arg1_type, 6) \
+ FMT_CTOR(ctor, func, arg0_type, arg1_type, 7) \
+ FMT_CTOR(ctor, func, arg0_type, arg1_type, 8) \
+ FMT_CTOR(ctor, func, arg0_type, arg1_type, 9) \
+ FMT_CTOR(ctor, func, arg0_type, arg1_type, 10)
+#endif
+
+// Generates a comma-separated list with results of applying f to pairs
+// (argument, index).
+#define FMT_FOR_EACH1(f, x0) f(x0, 0)
+#define FMT_FOR_EACH2(f, x0, x1) \
+ FMT_FOR_EACH1(f, x0), f(x1, 1)
+#define FMT_FOR_EACH3(f, x0, x1, x2) \
+ FMT_FOR_EACH2(f, x0 ,x1), f(x2, 2)
+#define FMT_FOR_EACH4(f, x0, x1, x2, x3) \
+ FMT_FOR_EACH3(f, x0, x1, x2), f(x3, 3)
+#define FMT_FOR_EACH5(f, x0, x1, x2, x3, x4) \
+ FMT_FOR_EACH4(f, x0, x1, x2, x3), f(x4, 4)
+#define FMT_FOR_EACH6(f, x0, x1, x2, x3, x4, x5) \
+ FMT_FOR_EACH5(f, x0, x1, x2, x3, x4), f(x5, 5)
+#define FMT_FOR_EACH7(f, x0, x1, x2, x3, x4, x5, x6) \
+ FMT_FOR_EACH6(f, x0, x1, x2, x3, x4, x5), f(x6, 6)
+#define FMT_FOR_EACH8(f, x0, x1, x2, x3, x4, x5, x6, x7) \
+ FMT_FOR_EACH7(f, x0, x1, x2, x3, x4, x5, x6), f(x7, 7)
+#define FMT_FOR_EACH9(f, x0, x1, x2, x3, x4, x5, x6, x7, x8) \
+ FMT_FOR_EACH8(f, x0, x1, x2, x3, x4, x5, x6, x7), f(x8, 8)
+#define FMT_FOR_EACH10(f, x0, x1, x2, x3, x4, x5, x6, x7, x8, x9) \
+ FMT_FOR_EACH9(f, x0, x1, x2, x3, x4, x5, x6, x7, x8), f(x9, 9)
+
+/**
+An error returned by an operating system or a language runtime,
+for example a file opening error.
+*/
+class SystemError : public internal::RuntimeError
+{
+private:
+ void init(int error_code, StringRef format_str, ArgList args);
+
+protected:
+ int error_code_;
+
+ typedef char Char; // For FMT_VARIADIC_CTOR.
+
+ SystemError() {}
+
+public:
+ /**
+ \rst
+ Constructs a :cpp:class:`fmt::SystemError` object with the description
+ of the form "*<message>*: *<system-message>*", where *<message>* is the
+ formatted message and *<system-message>* is the system message corresponding
+ to the error code.
+ *error_code* is a system error code as given by ``errno``.
+ \endrst
+ */
+ SystemError(int error_code, StringRef message)
+ {
+ init(error_code, message, ArgList());
+ }
+ FMT_VARIADIC_CTOR(SystemError, init, int, StringRef)
+
+ int error_code() const
+ {
+ return error_code_;
+ }
+};
+
+/**
+\rst
+This template provides operations for formatting and writing data into
+a character stream. The output is stored in a buffer provided by a subclass
+such as :cpp:class:`fmt::BasicMemoryWriter`.
+
+You can use one of the following typedefs for common character types:
+
++---------+----------------------+
+| Type | Definition |
++=========+======================+
+| Writer | BasicWriter<char> |
++---------+----------------------+
+| WWriter | BasicWriter<wchar_t> |
++---------+----------------------+
+
+\endrst
+*/
+template <typename Char>
+class BasicWriter
+{
+private:
+ // Output buffer.
+ internal::Buffer<Char> &buffer_;
+
+ FMT_DISALLOW_COPY_AND_ASSIGN(BasicWriter);
+
+ typedef typename internal::CharTraits<Char>::CharPtr CharPtr;
+
+#if _SECURE_SCL
+ // Returns pointer value.
+ static Char *get(CharPtr p)
+ {
+ return p.base();
+ }
+#else
+ static Char *get(Char *p)
+ {
+ return p;
+ }
+#endif
+
+ // Fills the padding around the content and returns the pointer to the
+ // content area.
+ static CharPtr fill_padding(CharPtr buffer,
+ unsigned total_size, std::size_t content_size, wchar_t fill);
+
+ // Grows the buffer by n characters and returns a pointer to the newly
+ // allocated area.
+ CharPtr grow_buffer(std::size_t n)
+ {
+ std::size_t size = buffer_.size();
+ buffer_.resize(size + n);
+ return internal::make_ptr(&buffer_[size], n);
+ }
+
+ // Prepare a buffer for integer formatting.
+ CharPtr prepare_int_buffer(unsigned num_digits,
+ const EmptySpec &, const char *prefix, unsigned prefix_size)
+ {
+ unsigned size = prefix_size + num_digits;
+ CharPtr p = grow_buffer(size);
+ std::copy(prefix, prefix + prefix_size, p);
+ return p + size - 1;
+ }
+
+ template <typename Spec>
+ CharPtr prepare_int_buffer(unsigned num_digits,
+ const Spec &spec, const char *prefix, unsigned prefix_size);
+
+ // Formats an integer.
+ template <typename T, typename Spec>
+ void write_int(T value, Spec spec);
+
+ // Formats a floating-point number (double or long double).
+ template <typename T>
+ void write_double(T value, const FormatSpec &spec);
+
+ // Writes a formatted string.
+ template <typename StrChar>
+ CharPtr write_str(
+ const StrChar *s, std::size_t size, const AlignSpec &spec);
+
+ template <typename StrChar>
+ void write_str(
+ const internal::Arg::StringValue<StrChar> &str, const FormatSpec &spec);
+
+ // This method is private to disallow writing a wide string to a
+ // char stream and vice versa. If you want to print a wide string
+ // as a pointer as std::ostream does, cast it to const void*.
+ // Do not implement!
+ void operator<<(typename internal::CharTraits<Char>::UnsupportedStrType);
+
+ friend class internal::ArgFormatter<Char>;
+ friend class internal::PrintfFormatter<Char>;
+
+protected:
+ /**
+ Constructs a ``BasicWriter`` object.
+ */
+ explicit BasicWriter(internal::Buffer<Char> &b) : buffer_(b) {}
+
+public:
+ /**
+ Destroys a ``BasicWriter`` object.
+ */
+ virtual ~BasicWriter() {}
+
+ /**
+ Returns the total number of characters written.
+ */
+ std::size_t size() const
+ {
+ return buffer_.size();
+ }
+
+ /**
+ Returns a pointer to the output buffer content. No terminating null
+ character is appended.
+ */
+ const Char *data() const FMT_NOEXCEPT(true)
+ {
+ return &buffer_[0];
+ }
+
+ /**
+ Returns a pointer to the output buffer content with terminating null
+ character appended.
+ */
+ const Char *c_str() const
+ {
+ std::size_t size = buffer_.size();
+ buffer_.reserve(size + 1);
+ buffer_[size] = '\0';
+ return &buffer_[0];
+ }
+
+ /**
+ Returns the content of the output buffer as an `std::string`.
+ */
+ std::basic_string<Char> str() const
+ {
+ return std::basic_string<Char>(&buffer_[0], buffer_.size());
+ }
+
+ /**
+ \rst
+ Writes formatted data.
+
+ *args* is an argument list representing arbitrary arguments.
+
+ **Example**::
+
+ MemoryWriter out;
+ out.write("Current point:\n");
+ out.write("({:+f}, {:+f})", -3.14, 3.14);
+
+ This will write the following output to the ``out`` object:
+
+ .. code-block:: none
+
+ Current point:
+ (-3.140000, +3.140000)
+
+ The output can be accessed using :meth:`data`, :meth:`c_str` or :meth:`str`
+ methods.
+
+ See also :ref:`syntax`.
+ \endrst
+ */
+ void write(BasicStringRef<Char> format, ArgList args)
+ {
+ BasicFormatter<Char>(*this).format(format, args);
+ }
+ FMT_VARIADIC_VOID(write, BasicStringRef<Char>)
+
+ BasicWriter &operator<<(int value)
+ {
+ return *this << IntFormatSpec<int>(value);
+ }
+ BasicWriter &operator<<(unsigned value)
+ {
+ return *this << IntFormatSpec<unsigned>(value);
+ }
+ BasicWriter &operator<<(long value)
+ {
+ return *this << IntFormatSpec<long>(value);
+ }
+ BasicWriter &operator<<(unsigned long value)
+ {
+ return *this << IntFormatSpec<unsigned long>(value);
+ }
+ BasicWriter &operator<<(LongLong value)
+ {
+ return *this << IntFormatSpec<LongLong>(value);
+ }
+
+ /**
+ Formats *value* and writes it to the stream.
+ */
+ BasicWriter &operator<<(ULongLong value)
+ {
+ return *this << IntFormatSpec<ULongLong>(value);
+ }
+
+ BasicWriter &operator<<(double value)
+ {
+ write_double(value, FormatSpec());
+ return *this;
+ }
+
+ /**
+ Formats *value* using the general format for floating-point numbers
+ (``'g'``) and writes it to the stream.
+ */
+ BasicWriter &operator<<(long double value)
+ {
+ write_double(value, FormatSpec());
+ return *this;
+ }
+
+ /**
+ Writes a character to the stream.
+ */
+ BasicWriter &operator<<(char value)
+ {
+ buffer_.push_back(value);
+ return *this;
+ }
+
+ BasicWriter &operator<<(wchar_t value)
+ {
+ buffer_.push_back(internal::CharTraits<Char>::convert(value));
+ return *this;
+ }
+
+ /**
+ Writes *value* to the stream.
+ */
+ BasicWriter &operator<<(fmt::BasicStringRef<Char> value)
+ {
+ const Char *str = value.c_str();
+ buffer_.append(str, str + value.size());
+ return *this;
+ }
+
+ template <typename T, typename Spec, typename FillChar>
+ BasicWriter &operator<<(IntFormatSpec<T, Spec, FillChar> spec)
+ {
+ internal::CharTraits<Char>::convert(FillChar());
+ write_int(spec.value(), spec);
+ return *this;
+ }
+
+ template <typename StrChar>
+ BasicWriter &operator<<(const StrFormatSpec<StrChar> &spec)
+ {
+ const StrChar *s = spec.str();
+ // TODO: error if fill is not convertible to Char
+ write_str(s, std::char_traits<Char>::length(s), spec);
+ return *this;
+ }
+
+ void clear() FMT_NOEXCEPT(true)
+ {
+ buffer_.clear();
+ }
+};
+
+template <typename Char>
+template <typename StrChar>
+typename BasicWriter<Char>::CharPtr BasicWriter<Char>::write_str(
+ const StrChar *s, std::size_t size, const AlignSpec &spec)
+{
+ CharPtr out = CharPtr();
+ if (spec.width() > size)
+ {
+ out = grow_buffer(spec.width());
+ Char fill = static_cast<Char>(spec.fill());
+ if (spec.align() == ALIGN_RIGHT)
+ {
+ std::fill_n(out, spec.width() - size, fill);
+ out += spec.width() - size;
+ }
+ else if (spec.align() == ALIGN_CENTER)
+ {
+ out = fill_padding(out, spec.width(), size, fill);
+ }
+ else
+ {
+ std::fill_n(out + size, spec.width() - size, fill);
+ }
+ }
+ else
+ {
+ out = grow_buffer(size);
+ }
+ std::copy(s, s + size, out);
+ return out;
+}
+
+template <typename Char>
+typename BasicWriter<Char>::CharPtr
+BasicWriter<Char>::fill_padding(
+ CharPtr buffer, unsigned total_size,
+ std::size_t content_size, wchar_t fill)
+{
+ std::size_t padding = total_size - content_size;
+ std::size_t left_padding = padding / 2;
+ Char fill_char = static_cast<Char>(fill);
+ std::fill_n(buffer, left_padding, fill_char);
+ buffer += left_padding;
+ CharPtr content = buffer;
+ std::fill_n(buffer + content_size, padding - left_padding, fill_char);
+ return content;
+}
+
+template <typename Char>
+template <typename Spec>
+typename BasicWriter<Char>::CharPtr
+BasicWriter<Char>::prepare_int_buffer(
+ unsigned num_digits, const Spec &spec,
+ const char *prefix, unsigned prefix_size)
+{
+ unsigned width = spec.width();
+ Alignment align = spec.align();
+ Char fill = static_cast<Char>(spec.fill());
+ if (spec.precision() > static_cast<int>(num_digits))
+ {
+ // Octal prefix '0' is counted as a digit, so ignore it if precision
+ // is specified.
+ if (prefix_size > 0 && prefix[prefix_size - 1] == '0')
+ --prefix_size;
+ unsigned number_size = prefix_size + spec.precision();
+ AlignSpec subspec(number_size, '0', ALIGN_NUMERIC);
+ if (number_size >= width)
+ return prepare_int_buffer(num_digits, subspec, prefix, prefix_size);
+ buffer_.reserve(width);
+ unsigned fill_size = width - number_size;
+ if (align != ALIGN_LEFT)
+ {
+ CharPtr p = grow_buffer(fill_size);
+ std::fill(p, p + fill_size, fill);
+ }
+ CharPtr result = prepare_int_buffer(
+ num_digits, subspec, prefix, prefix_size);
+ if (align == ALIGN_LEFT)
+ {
+ CharPtr p = grow_buffer(fill_size);
+ std::fill(p, p + fill_size, fill);
+ }
+ return result;
+ }
+ unsigned size = prefix_size + num_digits;
+ if (width <= size)
+ {
+ CharPtr p = grow_buffer(size);
+ std::copy(prefix, prefix + prefix_size, p);
+ return p + size - 1;
+ }
+ CharPtr p = grow_buffer(width);
+ CharPtr end = p + width;
+ if (align == ALIGN_LEFT)
+ {
+ std::copy(prefix, prefix + prefix_size, p);
+ p += size;
+ std::fill(p, end, fill);
+ }
+ else if (align == ALIGN_CENTER)
+ {
+ p = fill_padding(p, width, size, fill);
+ std::copy(prefix, prefix + prefix_size, p);
+ p += size;
+ }
+ else
+ {
+ if (align == ALIGN_NUMERIC)
+ {
+ if (prefix_size != 0)
+ {
+ p = std::copy(prefix, prefix + prefix_size, p);
+ size -= prefix_size;
+ }
+ }
+ else
+ {
+ std::copy(prefix, prefix + prefix_size, end - size);
+ }
+ std::fill(p, end - size, fill);
+ p = end;
+ }
+ return p - 1;
+}
+
+template <typename Char>
+template <typename T, typename Spec>
+void BasicWriter<Char>::write_int(T value, Spec spec)
+{
+ unsigned prefix_size = 0;
+ typedef typename internal::IntTraits<T>::MainType UnsignedType;
+ UnsignedType abs_value = value;
+ char prefix[4] = "";
+ if (internal::is_negative(value))
+ {
+ prefix[0] = '-';
+ ++prefix_size;
+ abs_value = 0 - abs_value;
+ }
+ else if (spec.flag(SIGN_FLAG))
+ {
+ prefix[0] = spec.flag(PLUS_FLAG) ? '+' : ' ';
+ ++prefix_size;
+ }
+ switch (spec.type())
+ {
+ case 0:
+ case 'd':
+ {
+ unsigned num_digits = internal::count_digits(abs_value);
+ CharPtr p = prepare_int_buffer(
+ num_digits, spec, prefix, prefix_size) + 1 - num_digits;
+ internal::format_decimal(get(p), abs_value, num_digits);
+ break;
+ }
+ case 'x':
+ case 'X':
+ {
+ UnsignedType n = abs_value;
+ if (spec.flag(HASH_FLAG))
+ {
+ prefix[prefix_size++] = '0';
+ prefix[prefix_size++] = spec.type();
+ }
+ unsigned num_digits = 0;
+ do
+ {
+ ++num_digits;
+ }
+ while ((n >>= 4) != 0);
+ Char *p = get(prepare_int_buffer(
+ num_digits, spec, prefix, prefix_size));
+ n = abs_value;
+ const char *digits = spec.type() == 'x' ?
+ "0123456789abcdef" : "0123456789ABCDEF";
+ do
+ {
+ *p-- = digits[n & 0xf];
+ }
+ while ((n >>= 4) != 0);
+ break;
+ }
+ case 'b':
+ case 'B':
+ {
+ UnsignedType n = abs_value;
+ if (spec.flag(HASH_FLAG))
+ {
+ prefix[prefix_size++] = '0';
+ prefix[prefix_size++] = spec.type();
+ }
+ unsigned num_digits = 0;
+ do
+ {
+ ++num_digits;
+ }
+ while ((n >>= 1) != 0);
+ Char *p = get(prepare_int_buffer(num_digits, spec, prefix, prefix_size));
+ n = abs_value;
+ do
+ {
+ *p-- = '0' + (n & 1);
+ }
+ while ((n >>= 1) != 0);
+ break;
+ }
+ case 'o':
+ {
+ UnsignedType n = abs_value;
+ if (spec.flag(HASH_FLAG))
+ prefix[prefix_size++] = '0';
+ unsigned num_digits = 0;
+ do
+ {
+ ++num_digits;
+ }
+ while ((n >>= 3) != 0);
+ Char *p = get(prepare_int_buffer(num_digits, spec, prefix, prefix_size));
+ n = abs_value;
+ do
+ {
+ *p-- = '0' + (n & 7);
+ }
+ while ((n >>= 3) != 0);
+ break;
+ }
+ default:
+ internal::report_unknown_type(
+ spec.type(), spec.flag(CHAR_FLAG) ? "char" : "integer");
+ break;
+ }
+}
+
+template <typename Char>
+template <typename T>
+void BasicWriter<Char>::write_double(
+ T value, const FormatSpec &spec)
+{
+ // Check type.
+ char type = spec.type();
+ bool upper = false;
+ switch (type)
+ {
+ case 0:
+ type = 'g';
+ break;
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'a':
+ break;
+ case 'F':
+#ifdef _MSC_VER
+ // MSVC's printf doesn't support 'F'.
+ type = 'f';
+#endif
+ // Fall through.
+ case 'E':
+ case 'G':
+ case 'A':
+ upper = true;
+ break;
+ default:
+ internal::report_unknown_type(type, "double");
+ break;
+ }
+
+ char sign = 0;
+ // Use getsign instead of value < 0 because the latter is always
+ // false for NaN.
+ if (internal::getsign(static_cast<double>(value)))
+ {
+ sign = '-';
+ value = -value;
+ }
+ else if (spec.flag(SIGN_FLAG))
+ {
+ sign = spec.flag(PLUS_FLAG) ? '+' : ' ';
+ }
+
+ if (value != value)
+ {
+ // Format NaN ourselves because sprintf's output is not consistent
+ // across platforms.
+ std::size_t size = 4;
+ const char *nan = upper ? " NAN" : " nan";
+ if (!sign)
+ {
+ --size;
+ ++nan;
+ }
+ CharPtr out = write_str(nan, size, spec);
+ if (sign)
+ *out = sign;
+ return;
+ }
+
+ if (internal::isinfinity(value))
+ {
+ // Format infinity ourselves because sprintf's output is not consistent
+ // across platforms.
+ std::size_t size = 4;
+ const char *inf = upper ? " INF" : " inf";
+ if (!sign)
+ {
+ --size;
+ ++inf;
+ }
+ CharPtr out = write_str(inf, size, spec);
+ if (sign)
+ *out = sign;
+ return;
+ }
+
+ std::size_t offset = buffer_.size();
+ unsigned width = spec.width();
+ if (sign)
+ {
+ buffer_.reserve(buffer_.size() + (std::max)(width, 1u));
+ if (width > 0)
+ --width;
+ ++offset;
+ }
+
+ // Build format string.
+ enum { MAX_FORMAT_SIZE = 10 }; // longest format: %#-*.*Lg
+ Char format[MAX_FORMAT_SIZE];
+ Char *format_ptr = format;
+ *format_ptr++ = '%';
+ unsigned width_for_sprintf = width;
+ if (spec.flag(HASH_FLAG))
+ *format_ptr++ = '#';
+ if (spec.align() == ALIGN_CENTER)
+ {
+ width_for_sprintf = 0;
+ }
+ else
+ {
+ if (spec.align() == ALIGN_LEFT)
+ *format_ptr++ = '-';
+ if (width != 0)
+ *format_ptr++ = '*';
+ }
+ if (spec.precision() >= 0)
+ {
+ *format_ptr++ = '.';
+ *format_ptr++ = '*';
+ }
+ if (internal::IsLongDouble<T>::VALUE)
+ *format_ptr++ = 'L';
+ *format_ptr++ = type;
+ *format_ptr = '\0';
+
+ // Format using snprintf.
+ Char fill = static_cast<Char>(spec.fill());
+ for (;;)
+ {
+ std::size_t size = buffer_.capacity() - offset;
+#if _MSC_VER
+ // MSVC's vsnprintf_s doesn't work with zero size, so reserve
+ // space for at least one extra character to make the size non-zero.
+ // Note that the buffer's capacity will increase by more than 1.
+ if (size == 0)
+ {
+ buffer_.reserve(offset + 1);
+ size = buffer_.capacity() - offset;
+ }
+#endif
+ Char *start = &buffer_[offset];
+ int n = internal::CharTraits<Char>::format_float(
+ start, size, format, width_for_sprintf, spec.precision(), value);
+ if (n >= 0 && offset + n < buffer_.capacity())
+ {
+ if (sign)
+ {
+ if ((spec.align() != ALIGN_RIGHT && spec.align() != ALIGN_DEFAULT) ||
+ *start != ' ')
+ {
+ *(start - 1) = sign;
+ sign = 0;
+ }
+ else
+ {
+ *(start - 1) = fill;
+ }
+ ++n;
+ }
+ if (spec.align() == ALIGN_CENTER &&
+ spec.width() > static_cast<unsigned>(n))
+ {
+ unsigned width = spec.width();
+ CharPtr p = grow_buffer(width);
+ std::copy(p, p + n, p + (width - n) / 2);
+ fill_padding(p, spec.width(), n, fill);
+ return;
+ }
+ if (spec.fill() != ' ' || sign)
+ {
+ while (*start == ' ')
+ *start++ = fill;
+ if (sign)
+ *(start - 1) = sign;
+ }
+ grow_buffer(n);
+ return;
+ }
+ // If n is negative we ask to increase the capacity by at least 1,
+ // but as std::vector, the buffer grows exponentially.
+ buffer_.reserve(n >= 0 ? offset + n + 1 : buffer_.capacity() + 1);
+ }
+}
+
+/**
+\rst
+This template provides operations for formatting and writing data into
+a character stream. The output is stored in a memory buffer that grows
+dynamically.
+
+You can use one of the following typedefs for common character types
+and the standard allocator:
+
++---------------+-----------------------------------------------+
+| Type | Definition |
++===============+===============================================+
+| MemoryWriter | BasicWriter<char, std::allocator<char>> |
++---------------+-----------------------------------------------+
+| WMemoryWriter | BasicWriter<wchar_t, std::allocator<wchar_t>> |
++---------------+-----------------------------------------------+
+
+**Example**::
+
+MemoryWriter out;
+out << "The answer is " << 42 << "\n";
+out.write("({:+f}, {:+f})", -3.14, 3.14);
+
+This will write the following output to the ``out`` object:
+
+.. code-block:: none
+
+The answer is 42
+(-3.140000, +3.140000)
+
+The output can be converted to an ``std::string`` with ``out.str()`` or
+accessed as a C string with ``out.c_str()``.
+\endrst
+*/
+template <typename Char, typename Allocator = std::allocator<Char> >
+class BasicMemoryWriter : public BasicWriter<Char>
+{
+private:
+ internal::MemoryBuffer<Char, internal::INLINE_BUFFER_SIZE, Allocator> buffer_;
+
+public:
+ explicit BasicMemoryWriter(const Allocator& alloc = Allocator())
+ : BasicWriter<Char>(buffer_), buffer_(alloc) {}
+
+#if FMT_USE_RVALUE_REFERENCES
+ /**
+ Constructs a ``BasicMemoryWriter`` object moving the content of the other
+ object to it.
+ */
+ BasicMemoryWriter(BasicMemoryWriter &&other)
+ : BasicWriter<Char>(buffer_), buffer_(std::move(other.buffer_))
+ {
+ }
+
+ /**
+ Moves the content of the other ``BasicMemoryWriter`` object to this one.
+ */
+ BasicMemoryWriter &operator=(BasicMemoryWriter &&other)
+ {
+ buffer_ = std::move(other.buffer_);
+ return *this;
+ }
+#endif
+};
+
+typedef BasicMemoryWriter<char> MemoryWriter;
+typedef BasicMemoryWriter<wchar_t> WMemoryWriter;
+
+// Formats a value.
+template <typename Char, typename T>
+void format(BasicFormatter<Char> &f, const Char *&format_str, const T &value)
+{
+ std::basic_ostringstream<Char> os;
+ os << value;
+ internal::Arg arg;
+ internal::Value &arg_value = arg;
+ std::basic_string<Char> str = os.str();
+ arg_value = internal::MakeValue<Char>(str);
+ arg.type = internal::Arg::STRING;
+ format_str = f.format(format_str, arg);
+}
+
+// Reports a system error without throwing an exception.
+// Can be used to report errors from destructors.
+void report_system_error(int error_code, StringRef message) FMT_NOEXCEPT(true);
+
+#ifdef _WIN32
+
+/**
+A Windows error.
+*/
+class WindowsError : public SystemError
+{
+private:
+ void init(int error_code, StringRef format_str, ArgList args);
+
+public:
+ /**
+ \rst
+ Constructs a :cpp:class:`fmt::WindowsError` object with the description
+ of the form "*<message>*: *<system-message>*", where *<message>* is the
+ formatted message and *<system-message>* is the system message corresponding
+ to the error code.
+ *error_code* is a Windows error code as given by ``GetLastError``.
+ \endrst
+ */
+ WindowsError(int error_code, StringRef message)
+ {
+ init(error_code, message, ArgList());
+ }
+ FMT_VARIADIC_CTOR(WindowsError, init, int, StringRef)
+};
+
+// Reports a Windows error without throwing an exception.
+// Can be used to report errors from destructors.
+void report_windows_error(int error_code, StringRef message) FMT_NOEXCEPT(true);
+
+#endif
+
+enum Color { BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE };
+
+/**
+Formats a string and prints it to stdout using ANSI escape sequences
+to specify color (experimental).
+Example:
+PrintColored(fmt::RED, "Elapsed time: {0:.2f} seconds") << 1.23;
+*/
+void print_colored(Color c, StringRef format, ArgList args);
+
+/**
+\rst
+Formats arguments and returns the result as a string.
+
+**Example**::
+
+std::string message = format("The answer is {}", 42);
+\endrst
+*/
+inline std::string format(StringRef format_str, ArgList args)
+{
+ MemoryWriter w;
+ w.write(format_str, args);
+ return w.str();
+}
+
+inline std::wstring format(WStringRef format_str, ArgList args)
+{
+ WMemoryWriter w;
+ w.write(format_str, args);
+ return w.str();
+}
+
+/**
+\rst
+Prints formatted data to the file *f*.
+
+**Example**::
+
+print(stderr, "Don't {}!", "panic");
+\endrst
+*/
+void print(std::FILE *f, StringRef format_str, ArgList args);
+
+/**
+\rst
+Prints formatted data to ``stdout``.
+
+**Example**::
+
+print("Elapsed time: {0:.2f} seconds", 1.23);
+\endrst
+*/
+void print(StringRef format_str, ArgList args);
+
+/**
+\rst
+Prints formatted data to the stream *os*.
+
+**Example**::
+
+print(cerr, "Don't {}!", "panic");
+\endrst
+*/
+void print(std::ostream &os, StringRef format_str, ArgList args);
+
+template <typename Char>
+void printf(BasicWriter<Char> &w, BasicStringRef<Char> format, ArgList args)
+{
+ internal::PrintfFormatter<Char>().format(w, format, args);
+}
+
+/**
+\rst
+Formats arguments and returns the result as a string.
+
+**Example**::
+
+std::string message = fmt::sprintf("The answer is %d", 42);
+\endrst
+*/
+inline std::string sprintf(StringRef format, ArgList args)
+{
+ MemoryWriter w;
+ printf(w, format, args);
+ return w.str();
+}
+
+/**
+\rst
+Prints formatted data to the file *f*.
+
+**Example**::
+
+fmt::fprintf(stderr, "Don't %s!", "panic");
+\endrst
+*/
+int fprintf(std::FILE *f, StringRef format, ArgList args);
+
+/**
+\rst
+Prints formatted data to ``stdout``.
+
+**Example**::
+
+fmt::printf("Elapsed time: %.2f seconds", 1.23);
+\endrst
+*/
+inline int printf(StringRef format, ArgList args)
+{
+ return fprintf(stdout, format, args);
+}
+
+/**
+Fast integer formatter.
+*/
+class FormatInt
+{
+private:
+ // Buffer should be large enough to hold all digits (digits10 + 1),
+ // a sign and a null character.
+ enum { BUFFER_SIZE = std::numeric_limits<ULongLong>::digits10 + 3 };
+ mutable char buffer_[BUFFER_SIZE];
+ char *str_;
+
+ // Formats value in reverse and returns the number of digits.
+ char *format_decimal(ULongLong value)
+ {
+ char *buffer_end = buffer_ + BUFFER_SIZE - 1;
+ while (value >= 100)
+ {
+ // Integer division is slow so do it for a group of two digits instead
+ // of for every digit. The idea comes from the talk by Alexandrescu
+ // "Three Optimization Tips for C++". See speed-test for a comparison.
+ unsigned index = (value % 100) * 2;
+ value /= 100;
+ *--buffer_end = internal::Data::DIGITS[index + 1];
+ *--buffer_end = internal::Data::DIGITS[index];
+ }
+ if (value < 10)
+ {
+ *--buffer_end = static_cast<char>('0' + value);
+ return buffer_end;
+ }
+ unsigned index = static_cast<unsigned>(value * 2);
+ *--buffer_end = internal::Data::DIGITS[index + 1];
+ *--buffer_end = internal::Data::DIGITS[index];
+ return buffer_end;
+ }
+
+ void FormatSigned(LongLong value)
+ {
+ ULongLong abs_value = static_cast<ULongLong>(value);
+ bool negative = value < 0;
+ if (negative)
+ abs_value = 0 - abs_value;
+ str_ = format_decimal(abs_value);
+ if (negative)
+ *--str_ = '-';
+ }
+
+public:
+ explicit FormatInt(int value)
+ {
+ FormatSigned(value);
+ }
+ explicit FormatInt(long value)
+ {
+ FormatSigned(value);
+ }
+ explicit FormatInt(LongLong value)
+ {
+ FormatSigned(value);
+ }
+ explicit FormatInt(unsigned value) : str_(format_decimal(value)) {}
+ explicit FormatInt(unsigned long value) : str_(format_decimal(value)) {}
+ explicit FormatInt(ULongLong value) : str_(format_decimal(value)) {}
+
+ /**
+ Returns the number of characters written to the output buffer.
+ */
+ std::size_t size() const
+ {
+ return buffer_ - str_ + BUFFER_SIZE - 1;
+ }
+
+ /**
+ Returns a pointer to the output buffer content. No terminating null
+ character is appended.
+ */
+ const char *data() const
+ {
+ return str_;
+ }
+
+ /**
+ Returns a pointer to the output buffer content with terminating null
+ character appended.
+ */
+ const char *c_str() const
+ {
+ buffer_[BUFFER_SIZE - 1] = '\0';
+ return str_;
+ }
+
+ /**
+ Returns the content of the output buffer as an `std::string`.
+ */
+ std::string str() const
+ {
+ return std::string(str_, size());
+ }
+};
+
+// Formats a decimal integer value writing into buffer and returns
+// a pointer to the end of the formatted string. This function doesn't
+// write a terminating null character.
+template <typename T>
+inline void format_decimal(char *&buffer, T value)
+{
+ typename internal::IntTraits<T>::MainType abs_value = value;
+ if (internal::is_negative(value))
+ {
+ *buffer++ = '-';
+ abs_value = 0 - abs_value;
+ }
+ if (abs_value < 100)
+ {
+ if (abs_value < 10)
+ {
+ *buffer++ = static_cast<char>('0' + abs_value);
+ return;
+ }
+ unsigned index = static_cast<unsigned>(abs_value * 2);
+ *buffer++ = internal::Data::DIGITS[index];
+ *buffer++ = internal::Data::DIGITS[index + 1];
+ return;
+ }
+ unsigned num_digits = internal::count_digits(abs_value);
+ internal::format_decimal(buffer, abs_value, num_digits);
+ buffer += num_digits;
+}
+} // ns fmt
+} // ns deatils
+} // ns spdlog
+
+#if FMT_GCC_VERSION
+// Use the system_header pragma to suppress warnings about variadic macros
+// because suppressing -Wvariadic-macros with the diagnostic pragma doesn't
+// work. It is used at the end because we want to suppress as little warnings
+// as possible.
+# pragma GCC system_header
+#endif
+
+// This is used to work around VC++ bugs in handling variadic macros.
+#define FMT_EXPAND(args) args
+
+// Returns the number of arguments.
+// Based on https://groups.google.com/forum/#!topic/comp.std.c/d-6Mj5Lko_s.
+#define FMT_NARG(...) FMT_NARG_(__VA_ARGS__, FMT_RSEQ_N())
+#define FMT_NARG_(...) FMT_EXPAND(FMT_ARG_N(__VA_ARGS__))
+#define FMT_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
+#define FMT_RSEQ_N() 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
+
+#define FMT_CONCAT(a, b) a##b
+#define FMT_FOR_EACH_(N, f, ...) \
+ FMT_EXPAND(FMT_CONCAT(FMT_FOR_EACH, N)(f, __VA_ARGS__))
+#define FMT_FOR_EACH(f, ...) \
+ FMT_EXPAND(FMT_FOR_EACH_(FMT_NARG(__VA_ARGS__), f, __VA_ARGS__))
+
+#define FMT_ADD_ARG_NAME(type, index) type arg##index
+#define FMT_GET_ARG_NAME(type, index) arg##index
+
+#if FMT_USE_VARIADIC_TEMPLATES
+# define FMT_VARIADIC_(Char, ReturnType, func, call, ...) \
+ template <typename... Args> \
+ ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), \
+ const Args & ... args) { \
+ using fmt::internal::Value; \
+ const Value values[fmt::internal::NonZero<sizeof...(Args)>::VALUE] = { \
+ fmt::internal::MakeValue<Char>(args)... \
+ }; \
+ call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), fmt::ArgList( \
+ fmt::internal::make_type(args...), values)); \
+ }
+#else
+// Defines a wrapper for a function taking __VA_ARGS__ arguments
+// and n additional arguments of arbitrary types.
+# define FMT_WRAP(Char, ReturnType, func, call, n, ...) \
+ template <FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> \
+ inline ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), \
+ FMT_GEN(n, FMT_MAKE_ARG)) { \
+ const fmt::internal::Value vals[] = {FMT_GEN(n, FMT_MAKE_REF_##Char)}; \
+ call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), fmt::ArgList( \
+ fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), vals)); \
+ }
+
+# define FMT_VARIADIC_(Char, ReturnType, func, call, ...) \
+ inline ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__)) { \
+ call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), fmt::ArgList()); \
+ } \
+ FMT_WRAP(Char, ReturnType, func, call, 1, __VA_ARGS__) \
+ FMT_WRAP(Char, ReturnType, func, call, 2, __VA_ARGS__) \
+ FMT_WRAP(Char, ReturnType, func, call, 3, __VA_ARGS__) \
+ FMT_WRAP(Char, ReturnType, func, call, 4, __VA_ARGS__) \
+ FMT_WRAP(Char, ReturnType, func, call, 5, __VA_ARGS__) \
+ FMT_WRAP(Char, ReturnType, func, call, 6, __VA_ARGS__) \
+ FMT_WRAP(Char, ReturnType, func, call, 7, __VA_ARGS__) \
+ FMT_WRAP(Char, ReturnType, func, call, 8, __VA_ARGS__) \
+ FMT_WRAP(Char, ReturnType, func, call, 9, __VA_ARGS__) \
+ FMT_WRAP(Char, ReturnType, func, call, 10, __VA_ARGS__) \
+ FMT_WRAP(Char, ReturnType, func, call, 11, __VA_ARGS__) \
+ FMT_WRAP(Char, ReturnType, func, call, 12, __VA_ARGS__) \
+ FMT_WRAP(Char, ReturnType, func, call, 13, __VA_ARGS__) \
+ FMT_WRAP(Char, ReturnType, func, call, 14, __VA_ARGS__) \
+ FMT_WRAP(Char, ReturnType, func, call, 15, __VA_ARGS__)
+#endif // FMT_USE_VARIADIC_TEMPLATES
+
+/**
+\rst
+Defines a variadic function with the specified return type, function name
+and argument types passed as variable arguments to this macro.
+
+**Example**::
+
+void print_error(const char *file, int line, const char *format,
+fmt::ArgList args) {
+fmt::print("{}: {}: ", file, line);
+fmt::print(format, args);
+}
+FMT_VARIADIC(void, print_error, const char *, int, const char *)
+
+``FMT_VARIADIC`` is used for compatibility with legacy C++ compilers that
+don't implement variadic templates. You don't have to use this macro if
+you don't need legacy compiler support and can use variadic templates
+directly::
+
+template <typename... Args>
+void print_error(const char *file, int line, const char *format,
+const Args & ... args) {
+fmt::print("{}: {}: ", file, line);
+fmt::print(format, args...);
+}
+\endrst
+*/
+#define FMT_VARIADIC(ReturnType, func, ...) \
+ FMT_VARIADIC_(char, ReturnType, func, return func, __VA_ARGS__)
+
+#define FMT_VARIADIC_W(ReturnType, func, ...) \
+ FMT_VARIADIC_(wchar_t, ReturnType, func, return func, __VA_ARGS__)
+
+namespace spdlog
+{
+namespace details
+{
+namespace fmt
+{
+FMT_VARIADIC(std::string, format, StringRef)
+FMT_VARIADIC_W(std::wstring, format, WStringRef)
+FMT_VARIADIC(void, print, StringRef)
+FMT_VARIADIC(void, print, std::FILE *, StringRef)
+FMT_VARIADIC(void, print, std::ostream &, StringRef)
+FMT_VARIADIC(void, print_colored, Color, StringRef)
+FMT_VARIADIC(std::string, sprintf, StringRef)
+FMT_VARIADIC(int, printf, StringRef)
+FMT_VARIADIC(int, fprintf, std::FILE *, StringRef)
+}
+}
+}
+
+// Restore warnings.
+#if FMT_GCC_VERSION >= 406
+# pragma GCC diagnostic pop
+#endif
+
+
+#define FMT_HEADER_ONLY
+# include "format.cc"
+
+#ifdef __GNUC__
+# pragma GCC diagnostic pop //pop -Wshadow warnings ignore
+#endif
+
+#endif // SPDLOG_FMT_FORMAT_H_
/src/sleek/device/console/details/format.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/sleek/device/console/details/mpmc_bounded_q.h
===================================================================
--- src/sleek/device/console/details/mpmc_bounded_q.h (nonexistent)
+++ src/sleek/device/console/details/mpmc_bounded_q.h (revision 22)
@@ -0,0 +1,175 @@
+/*
+A modified version of Bounded MPMC queue by Dmitry Vyukov.
+
+Original code from:
+http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue
+
+licensed by Dmitry Vyukov under the terms below:
+
+Simplified BSD license
+
+Copyright (c) 2010-2011 Dmitry Vyukov. All rights reserved.
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+1. Redistributions of source code must retain the above copyright notice, this list of
+conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice, this list
+of conditions and the following disclaimer in the documentation and/or other materials
+provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY DMITRY VYUKOV "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL DMITRY VYUKOV OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation are those of the authors and
+should not be interpreted as representing official policies, either expressed or implied, of Dmitry Vyukov.
+*/
+
+/*
+The code in its current form adds the license below:
+
+spdlog - an extremely fast and easy to use c++11 logging library.
+Copyright (c) 2014 Gabi Melman.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#pragma once
+
+#include <atomic>
+#include "../common.h"
+
+namespace spdlog
+{
+namespace details
+{
+
+template<typename T>
+class mpmc_bounded_queue
+{
+public:
+
+ using item_type = T;
+ mpmc_bounded_queue(size_t buffer_size)
+ : buffer_(new cell_t [buffer_size]),
+ buffer_mask_(buffer_size - 1)
+ {
+ //queue size must be power of two
+ if(!((buffer_size >= 2) && ((buffer_size & (buffer_size - 1)) == 0)))
+ throw spdlog_ex("async logger queue size must be power of two");
+
+ for (size_t i = 0; i != buffer_size; i += 1)
+ buffer_[i].sequence_.store(i, std::memory_order_relaxed);
+ enqueue_pos_.store(0, std::memory_order_relaxed);
+ dequeue_pos_.store(0, std::memory_order_relaxed);
+ }
+
+ ~mpmc_bounded_queue()
+ {
+ delete [] buffer_;
+ }
+
+
+ bool enqueue(T&& data)
+ {
+ cell_t* cell;
+ size_t pos = enqueue_pos_.load(std::memory_order_relaxed);
+ for (;;)
+ {
+ cell = &buffer_[pos & buffer_mask_];
+ size_t seq = cell->sequence_.load(std::memory_order_acquire);
+ intptr_t dif = (intptr_t)seq - (intptr_t)pos;
+ if (dif == 0)
+ {
+ if (enqueue_pos_.compare_exchange_weak(pos, pos + 1, std::memory_order_relaxed))
+ break;
+ }
+ else if (dif < 0)
+ {
+ return false;
+ }
+ else
+ {
+ pos = enqueue_pos_.load(std::memory_order_relaxed);
+ }
+ }
+ cell->data_ = std::move(data);
+ cell->sequence_.store(pos + 1, std::memory_order_release);
+ return true;
+ }
+
+ bool dequeue(T& data)
+ {
+ cell_t* cell;
+ size_t pos = dequeue_pos_.load(std::memory_order_relaxed);
+ for (;;)
+ {
+ cell = &buffer_[pos & buffer_mask_];
+ size_t seq =
+ cell->sequence_.load(std::memory_order_acquire);
+ intptr_t dif = (intptr_t)seq - (intptr_t)(pos + 1);
+ if (dif == 0)
+ {
+ if (dequeue_pos_.compare_exchange_weak(pos, pos + 1, std::memory_order_relaxed))
+ break;
+ }
+ else if (dif < 0)
+ return false;
+ else
+ pos = dequeue_pos_.load(std::memory_order_relaxed);
+ }
+ data = std::move(cell->data_);
+ cell->sequence_.store(pos + buffer_mask_ + 1, std::memory_order_release);
+ return true;
+ }
+
+private:
+ struct cell_t
+ {
+ std::atomic<size_t> sequence_;
+ T data_;
+ };
+
+ static size_t const cacheline_size = 64;
+ typedef char cacheline_pad_t [cacheline_size];
+
+ cacheline_pad_t pad0_;
+ cell_t* const buffer_;
+ size_t const buffer_mask_;
+ cacheline_pad_t pad1_;
+ std::atomic<size_t> enqueue_pos_;
+ cacheline_pad_t pad2_;
+ std::atomic<size_t> dequeue_pos_;
+ cacheline_pad_t pad3_;
+
+ mpmc_bounded_queue(mpmc_bounded_queue const&);
+ void operator = (mpmc_bounded_queue const&);
+};
+
+} // ns details
+} // ns spdlog
/src/sleek/device/console/details/mpmc_bounded_q.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/sleek/device/console/sinks/syslog_sink.h
===================================================================
--- src/sleek/device/console/sinks/syslog_sink.h (nonexistent)
+++ src/sleek/device/console/sinks/syslog_sink.h (revision 22)
@@ -0,0 +1,99 @@
+/*************************************************************************/
+/* spdlog - an extremely fast and easy to use c++11 logging library. */
+/* Copyright (c) 2014 Gabi Melman. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#pragma once
+
+#ifdef __linux__
+
+#include <array>
+#include <string>
+#include <syslog.h>
+
+#include "./sink.h"
+#include "../common.h"
+#include "../details/log_msg.h"
+
+
+namespace spdlog
+{
+namespace sinks
+{
+/**
+ * Sink that write to syslog using the `syscall()` library call.
+ *
+ * Locking is not needed, as `syslog()` itself is thread-safe.
+ */
+class syslog_sink : public sink
+{
+public:
+ //
+ syslog_sink(const std::string& ident = "", int syslog_option=0, int syslog_facility=LOG_USER):
+ _ident(ident)
+ {
+ _priorities[static_cast<int>(level::trace)] = LOG_DEBUG;
+ _priorities[static_cast<int>(level::debug)] = LOG_DEBUG;
+ _priorities[static_cast<int>(level::info)] = LOG_INFO;
+ _priorities[static_cast<int>(level::notice)] = LOG_NOTICE;
+ _priorities[static_cast<int>(level::warn)] = LOG_WARNING;
+ _priorities[static_cast<int>(level::err)] = LOG_ERR;
+ _priorities[static_cast<int>(level::critical)] = LOG_CRIT;
+ _priorities[static_cast<int>(level::alert)] = LOG_ALERT;
+ _priorities[static_cast<int>(level::emerg)] = LOG_EMERG;
+ _priorities[static_cast<int>(level::off)] = LOG_INFO;
+
+ //set ident to be program name if empty
+ ::openlog(_ident.empty()? nullptr:_ident.c_str(), syslog_option, syslog_facility);
+ }
+ ~syslog_sink()
+ {
+ ::closelog();
+ }
+
+ syslog_sink(const syslog_sink&) = delete;
+ syslog_sink& operator=(const syslog_sink&) = delete;
+
+ void log(const details::log_msg &msg) override
+ {
+ ::syslog(syslog_prio_from_level(msg), "%s", msg.formatted.str().c_str());
+ }
+
+
+
+private:
+ std::array<int, 10> _priorities;
+ //must store the ident because the man says openlog might use the pointer as is and not a string copy
+ const std::string _ident;
+
+ //
+ // Simply maps spdlog's log level to syslog priority level.
+ //
+ int syslog_prio_from_level(const details::log_msg &msg) const
+ {
+ return _priorities[static_cast<int>(msg.level)];
+ }
+};
+}
+}
+
+#endif
/src/sleek/device/console/sinks/syslog_sink.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/sleek/device/device.cpp
===================================================================
--- src/sleek/device/device.cpp (revision 21)
+++ src/sleek/device/device.cpp (revision 22)
@@ -1,5 +1,6 @@
#include "device.h"
#include "common/sdl.h"
+#include "common/sdl2.h"
#include "common/win.h"
#include "common/x11.h"
#include "common/xf86.h"
@@ -27,6 +28,9 @@
#if defined sdl_device_support
case DWM_SDL: return std::make_shared<Device_sdl>(info); break;
#endif
+ #if defined sdl2_device_support
+ case DWM_SDL: return std::make_shared<Device_sdl2>(info); break;
+ #endif
#if defined x11_device_support
case DWM_X11: return std::make_shared<Device_x11>(info); break;
#endif
@@ -87,7 +91,7 @@
return cpu;
}
- void Device::WarpMouse(const math::vector2di&) noexcept
+ void Device::WarpMouse(const math::vec2i&) noexcept
{
}
@@ -126,13 +130,13 @@
else evt = ext;
}
- void Device::setVideoSize(const math::vector2di &i) noexcept
+ void Device::setVideoSize(const math::vec2i &i) noexcept
{
info.size = i;
current->type = EVENT_WINDOW_RESIZE;
}
- void Device::setWindowPos(const math::vector2di&) noexcept
+ void Device::setWindowPos(const math::vec2i&) noexcept
{
}
@@ -150,7 +154,7 @@
return evt;
}
- math::vector2di Device::getDesktopVideoSize() const noexcept
+ math::vec2i Device::getDesktopVideoSize() const noexcept
{
}
/src/sleek/device/device.h
33,16 → 33,18
Device(const Device_stub&) noexcept;
virtual ~Device() noexcept;
 
virtual const DeviceWindowManager getType() const { return DWM_COUNT; }
 
virtual void setGamma(const math::pixel&) noexcept;
virtual void setCaption(const std::string&) noexcept;
virtual void setEventReceiver(event*) noexcept;
virtual void setVideoSize(const math::vector2di&) noexcept;
virtual void setWindowPos(const math::vector2di&) noexcept;
virtual void setVideoSize(const math::vec2i&) noexcept;
virtual void setWindowPos(const math::vec2i&) noexcept;
virtual void setFullScreen(bool) noexcept;
 
virtual void enableWindowDecorator(bool) noexcept;
 
virtual math::vector2di getDesktopVideoSize() const noexcept;
virtual math::vec2i getDesktopVideoSize() const noexcept;
 
virtual std::shared_ptr<os::cpuid> getCPUID() const noexcept;
virtual std::shared_ptr<spdlog::logger> getLogger() const noexcept;
61,7 → 63,7
return shared_from_this();
}
 
virtual void WarpMouse(const math::vector2di&) noexcept;
virtual void WarpMouse(const math::vec2i&) noexcept;
virtual void ShowMouse(bool) noexcept;
 
virtual bool run() noexcept;
/src/sleek/device/device_stub.h
2,7 → 2,7
#define __DEVICE_STUB_HEADER__
 
#include "../math/timer.h"
#include "../math/vector2d.h"
#include "../math/math.h"
#include <string>
 
namespace sleek
18,7 → 18,7
{
}
 
Device_stub(const math::vector2di sz, u8 b, bool fl = false) noexcept :
Device_stub(const math::vec2i sz, u8 b, bool fl = false) noexcept :
decorator(true), fullscreen(fl),
size(sz), bits(b),
name("SleekThink")
38,12 → 38,13
 
u8 bits;
bool fullscreen, decorator;
math::vector2di size;
math::vec2i size;
std::string name;
 
//! read only
 
void *visual;
void *fbconfig;
void *display;
void *window;
};
/src/sleek/device/event.h
5,7 → 5,7
#include "../gui/type.h"
#include "keycode.h"
 
#include "../math/vector2d.h"
#include "../math/math.h"
#include <vector>
 
namespace sleek
36,6 → 36,7
private:
friend class Device;
friend class Device_sdl;
friend class Device_sdl2;
friend class Device_win;
friend class Device_x11;
friend class Device_xf86;
60,7 → 61,7
gui::INTERFACE_EVENT_CODE code;
} gui;
 
math::vector2di mouse_pos;
math::vec2i mouse_pos;
};
}
}
/src/sleek/device/splash.cpp
6,7 → 6,7
{
namespace device
{
Splash::Splash(const DeviceWindowManager &dwm, const math::vector2di &size, bool window_decorator) noexcept
Splash::Splash(const DeviceWindowManager &dwm, const math::vec2i &size, bool window_decorator) noexcept
: csp(0), close([]{ return true; }), tm(new math::timer())
{
Device_stub info = Device_stub(size, 32, false);
88,7 → 88,7
renderer->setViewport(csp->getOriginalSize());
}
 
void Splash::resize(const math::vector2di &i) noexcept
void Splash::resize(const math::vec2i &i) noexcept
{
screen->setVideoSize(i);
screen->setWindowPos((screen->getDesktopVideoSize()-screen->getInfo().size)/2);
/src/sleek/device/splash.h
21,7 → 21,7
class Splash : public event, public std::enable_shared_from_this<Splash>
{
public:
Splash(const DeviceWindowManager &info = DWM_AUTO, const math::vector2di &size = math::vector2di(200,50), bool window_decorator = false) noexcept;
Splash(const DeviceWindowManager &info = DWM_AUTO, const math::vec2i &size = math::vec2i(200,50), bool window_decorator = false) noexcept;
~Splash() noexcept;
 
inline std::shared_ptr<Splash> getptr() noexcept
37,7 → 37,7
std::shared_ptr<driver::texture> getPicture() const noexcept;
 
void resizeFromPicture() noexcept;
void resize(const math::vector2di&) noexcept;
void resize(const math::vec2i&) noexcept;
 
driver::context* getRenderer() const noexcept;
gui::interface* getGUIEnvirnoment() const noexcept;
/src/sleek/driver/context.cpp
1,6 → 1,13
#include "context.h"
#include "ogl3/ogl_context.h"
 
#include "ogl3/ogl3_context.h"
#include "ogl4/ogl4_context.h"
 
//#include "dx11/dx11_context.h"
//#include "dx12/dx12_context.h"
//#include "vk/vk_context.h"
//#include "metal/metal_context.h"
 
namespace sleek
{
namespace driver
19,8 → 26,11
switch(cx)
{
case RCTX_OGL3:
return std::make_shared<ogl_context>(d, s);
return std::make_shared<ogl3_context>(d, s);
break;
case RCTX_OGL4:
return std::make_shared<ogl4_context>(d, s);
break;
#ifdef d3d_context_support
case RCTX_D3D:
return std::make_shared<d3d_context>(d, s);
/src/sleek/driver/context.h
18,8 → 18,11
{
enum RENDER_CONTEXT
{
// ready
// ready to use
// but there have some old deprecated fixed-pipline remaining here
RCTX_OGL3,
// experiemental at this time
RCTX_OGL4,
// not yet
RCTX_D3D_12,
// not yet
54,14 → 57,14
virtual std::shared_ptr<identifier> createTextureArray(texture_array*, bool dsa = true) const noexcept = 0;
virtual std::shared_ptr<identifier> createTexture3d(texture3d*, bool dsa = true) const noexcept = 0;
 
virtual std::shared_ptr<identifier> createVBO(MeshBuffer *o, VBO_BUFFER_TYPE t, VBO_BUFFER_ALIGNMENT a = VBO_STATIC, bool dsa = true) const noexcept = 0;
virtual std::shared_ptr<identifier> createVAO(MeshBuffer *o, VAO_ALIGNMENT v = VAO_STATIC, VAO_ALIGNMENT e = VAO_STATIC, bool dsa = true) const noexcept = 0;
virtual std::shared_ptr<shader> createShader(bool dsa = true) const noexcept = 0;
 
virtual void setViewport(const math::vector2di& i) noexcept = 0;
virtual void setViewport(const math::vec2i& i) noexcept = 0;
virtual void setAntialiasing(const AntiailiasingMode &i) noexcept = 0;
 
virtual AntiailiasingMode getAntiailiasing() const noexcept = 0;
virtual math::vector2di getViewport() const noexcept = 0;
virtual math::vec2i getViewport() const noexcept = 0;
 
inline std::shared_ptr<context> getptr()
{
/src/sleek/driver/driver.h
36,37 → 36,37
return shared_from_this();
}
 
virtual void drawPixel(const math::vector2di, const math::pixel c = {}) const noexcept = 0;
virtual void drawPixel(const math::vector3df, const math::pixel c = {}) const noexcept = 0;
virtual void drawLine(const math::vector2di, const math::vector2di, const math::pixel c = {}) const noexcept = 0;
virtual void drawLine(const math::vector3df, const math::vector3df, const math::pixel c = {}) const noexcept = 0;
virtual void drawArc(const math::vector2di, u32, u32, u32, const math::pixel c = {}) const noexcept = 0;
virtual void drawPixel(const math::vec2i, const math::pixel c = {}) const noexcept = 0;
virtual void drawPixel(const math::vec3f, const math::pixel c = {}) const noexcept = 0;
virtual void drawLine(const math::vec2i, const math::vec2i, const math::pixel c = {}) const noexcept = 0;
virtual void drawLine(const math::vec3f, const math::vec3f, const math::pixel c = {}) const noexcept = 0;
virtual void drawArc(const math::vec2i, u32, u32, u32, const math::pixel c = {}) const noexcept = 0;
 
virtual void drawCube(const math::aabbox2di, const math::vector3df rot, const math::pixel upperleft, const math::pixel upperright, const math::pixel lowerleft, const math::pixel lowerright) const noexcept = 0;
virtual void drawCube(const math::aabbox2di, const math::vector3df rot = {0, 0, 0}, const math::pixel c = {}) const noexcept = 0;
virtual void drawCube(const math::aabbox3df, const math::vector3df rot = {0, 0, 0}, const math::pixel c = {}) const noexcept = 0;
virtual void drawCube(const math::vector2di, const math::vector2di, const math::vector3df rot = {0, 0, 0}, const math::pixel c = {}) const noexcept = 0;
virtual void drawCube(const math::vector3df, const math::vector3df, const math::vector3df rot = {0, 0, 0}, const math::pixel c = {}) const noexcept = 0;
virtual void drawCube(const math::aabbox2di, const math::vec3f rot, const math::pixel upperleft, const math::pixel upperright, const math::pixel lowerleft, const math::pixel lowerright) const noexcept = 0;
virtual void drawCube(const math::aabbox2di, const math::vec3f rot = {0, 0, 0}, const math::pixel c = {}) const noexcept = 0;
virtual void drawCube(const math::aabbox3df, const math::vec3f rot = {0, 0, 0}, const math::pixel c = {}) const noexcept = 0;
virtual void drawCube(const math::vec2i, const math::vec2i, const math::vec3f rot = {0, 0, 0}, const math::pixel c = {}) const noexcept = 0;
virtual void drawCube(const math::vec3f, const math::vec3f, const math::vec3f rot = {0, 0, 0}, const math::pixel c = {}) const noexcept = 0;
 
virtual void drawCircle(const math::vector2di pos, u32 radius = 5.f, const math::pixel c = {}) const noexcept = 0;
virtual void drawCircle(const math::vec2i pos, u32 radius = 5.f, const math::pixel c = {}) const noexcept = 0;
 
virtual void drawPolygon(const math::vector2di, const math::vector2di, const math::vector2di, const math::pixel c = {}) const noexcept = 0;
virtual void drawPolygon(const math::vector3df, const math::vector3df, const math::vector3df, const math::pixel c = {}) const noexcept = 0;
virtual void drawPolygonList(const math::vector2di *a, u32 n, const math::vector2di, const math::vector3df rot = {0, 0, 0}, const math::pixel c = {}) const noexcept = 0;
virtual void drawPolygonList(const math::vector3df *a, u32 n, const math::vector3df, const math::vector3df rot = {0, 0, 0}, const math::pixel c = {}) const noexcept = 0;
virtual void drawPolygon(const math::vec2i, const math::vec2i, const math::vec2i, const math::pixel c = {}) const noexcept = 0;
virtual void drawPolygon(const math::vec3f, const math::vec3f, const math::vec3f, const math::pixel c = {}) const noexcept = 0;
virtual void drawPolygonList(const math::vec2i *a, u32 n, const math::vec2i, const math::vec3f rot = {0, 0, 0}, const math::pixel c = {}) const noexcept = 0;
virtual void drawPolygonList(const math::vec3f *a, u32 n, const math::vec3f, const math::vec3f rot = {0, 0, 0}, const math::pixel c = {}) const noexcept = 0;
 
virtual void drawFBO(fbo*) const noexcept = 0;
 
virtual void drawTexture(texture*, const math::vector2di pos = {0, 0}, const math::vector3df rot = {0, 0, 0}, const math::vector2df uv = {1.f, 1.f}) const noexcept = 0;
virtual void drawTexture(texture*, const math::vector3df pos = {0, 0, 0}, const math::vector3df rot = {0, 0, 0}, const math::vector2df uv = {1.f, 1.f}) const noexcept = 0;
virtual void drawTexture(texture*, const math::vec2i pos = {0, 0}, const math::vec3f rot = {0, 0, 0}, const math::vec2f uv = {1.f, 1.f}) const noexcept = 0;
virtual void drawTexture(texture*, const math::vec3f pos = {0, 0, 0}, const math::vec3f rot = {0, 0, 0}, const math::vec2f uv = {1.f, 1.f}) const noexcept = 0;
 
virtual void drawTextureCenter(texture*, const math::vector2di pos = {0, 0}, const math::vector3df rot = {0, 0, 0}, const math::vector2df uv = {1.f, 1.f}) const noexcept = 0;
virtual void drawTextureCenter(texture*, const math::vector3df pos = {0, 0, 0}, const math::vector3df rot = {0, 0, 0}, const math::vector2df uv = {1.f, 1.f}) const noexcept = 0;
virtual void drawTextureCenter(texture*, const math::vec2i pos = {0, 0}, const math::vec3f rot = {0, 0, 0}, const math::vec2f uv = {1.f, 1.f}) const noexcept = 0;
virtual void drawTextureCenter(texture*, const math::vec3f pos = {0, 0, 0}, const math::vec3f rot = {0, 0, 0}, const math::vec2f uv = {1.f, 1.f}) const noexcept = 0;
 
virtual void drawTextureScale(texture*, const math::vector2di pos = {0, 0}, const math::vector3df rot = {0, 0, 0}, const math::vector3df scl = {0, 0, 0}, const math::vector2df uv = {1.f, 1.f}) const noexcept = 0;
virtual void drawTextureScale(texture*, const math::vector3df pos = {0, 0, 0}, const math::vector3df rot = {0, 0, 0}, const math::vector3df scl = {0, 0, 0}, const math::vector2df uv = {1.f, 1.f}) const noexcept = 0;
virtual void drawTextureScale(texture*, const math::vec2i pos = {0, 0}, const math::vec3f rot = {0, 0, 0}, const math::vec3f scl = {0, 0, 0}, const math::vec2f uv = {1.f, 1.f}) const noexcept = 0;
virtual void drawTextureScale(texture*, const math::vec3f pos = {0, 0, 0}, const math::vec3f rot = {0, 0, 0}, const math::vec3f scl = {0, 0, 0}, const math::vec2f uv = {1.f, 1.f}) const noexcept = 0;
 
virtual void drawMesh(MeshBuffer*, const math::vector3df, const math::vector3df rot = {0, 0, 0}) const noexcept = 0;
virtual void drawMesh(MeshBuffer*, const math::vec3f, const math::vec3f rot = {0, 0, 0}) const noexcept = 0;
 
virtual void setActiveMaterial(std::shared_ptr<material>) noexcept = 0;
virtual std::shared_ptr<material> getActiveMaterial() const noexcept = 0;
/src/sleek/driver/fbo.cpp
4,7 → 4,7
{
namespace driver
{
fbo::fbo(device::Device *mom, const math::vector2di &i, std::vector<FBO_ATTACHMENT> a) noexcept
fbo::fbo(device::Device *mom, const math::vec2i &i, std::vector<FBO_ATTACHMENT> a) noexcept
: identifier(0), dev(mom), size(i), enabled(false), attachment(a)
{
}
13,7 → 13,7
{
}
 
math::vector2di fbo::getSize() const noexcept
math::vec2i fbo::getSize() const noexcept
{
return size;
}
/src/sleek/driver/fbo.h
4,8 → 4,8
#include <iosfwd>
#include <fstream>
#include <string>
#include "../math/vector2d.h"
#include "../math/vector3d.h"
 
#include "../math/math.h"
#include "../math/pixel.h"
#include "material.h"
#include "context.h"
40,7 → 40,7
class fbo : public identifier
{
public:
fbo(device::Device*, const math::vector2di &size, std::vector<FBO_ATTACHMENT>) noexcept;
fbo(device::Device*, const math::vec2i &size, std::vector<FBO_ATTACHMENT>) noexcept;
virtual ~fbo() noexcept;
 
virtual HARDWARE_IDENTIFIER_TYPE getType() const noexcept
48,7 → 48,7
return HIT_FBO;
}
 
virtual math::vector2di getSize() const noexcept;
virtual math::vec2i getSize() const noexcept;
virtual void* getHardwareLink() const noexcept = 0;
 
virtual void enable(bool) noexcept;
60,7 → 60,7
protected:
bool enabled;
std::vector<FBO_ATTACHMENT> attachment;
math::vector2di size;
math::vec2i size;
device::Device *dev;
};
}
/src/sleek/driver/geometry.cpp
1,7 → 1,11
#include "mesh.h"
#include "geometry.h"
#include "vertex.h"
#include "index.h"
#include <math.h>
 
#include "../library/glm/glm.hpp"
 
namespace sleek
{
namespace driver
14,27 → 18,29
{
}
 
MeshBuffer* Geometry::createPlane(const math::vector2df &size, const u32 polyCountX, const u32 polyCountY, const math::pixel &color) const noexcept
MeshBuffer* Geometry::createPlane(const math::vec2f &size, const u32 polyCountX, const u32 polyCountY, const math::pixel &color) const noexcept
{
MeshBuffer *tmp = new MeshBuffer();
tmp->vertices.resize(4);
tmp->vertices[0].Pos = math::vector3df(-size.x/2, 0,-size.y/2);
tmp->vertices[1].Pos = math::vector3df( size.x/2, 0,-size.y/2);
tmp->vertices[2].Pos = math::vector3df( size.x/2, 0, size.y/2);
tmp->vertices[3].Pos = math::vector3df(-size.x/2, 0, size.y/2);
tmp->vertices[0].Pos = {-size.x/2, 0,-size.y/2};
tmp->vertices[1].Pos = { size.x/2, 0,-size.y/2};
tmp->vertices[2].Pos = { size.x/2, 0, size.y/2};
tmp->vertices[3].Pos = {-size.x/2, 0, size.y/2};
 
tmp->vertices[0].Coord = math::vector2df(0.0f, 0.0f);
tmp->vertices[1].Coord = math::vector2df(1.0f, 0.0f);
tmp->vertices[2].Coord = math::vector2df(1.0f, 1.0f);
tmp->vertices[3].Coord = math::vector2df(0.0f, 1.0f);
tmp->vertices[0].Coord = {0.0f, 0.0f};
tmp->vertices[1].Coord = {1.0f, 0.0f};
tmp->vertices[2].Coord = {1.0f, 1.0f};
tmp->vertices[3].Coord = {0.0f, 1.0f};
 
tmp->vertices[0].Normal = math::vector3df( 0.0f, 1.0f, 0.f);
tmp->vertices[1].Normal = math::vector3df( 0.0f, 1.0f, 0.f);
tmp->vertices[2].Normal = math::vector3df( 0.0f, 1.0f, 0.f);
tmp->vertices[3].Normal = math::vector3df( 0.0f, 1.0f, 0.f);
tmp->vertices[0].Normal = { 0.0f, 1.0f, 0.f};
tmp->vertices[1].Normal = { 0.0f, 1.0f, 0.f};
tmp->vertices[2].Normal = { 0.0f, 1.0f, 0.f};
tmp->vertices[3].Normal = { 0.0f, 1.0f, 0.f};
 
tmp->vertices[0].Color = color; tmp->vertices[1].Color = color;
tmp->vertices[2].Color = color; tmp->vertices[3].Color = color;
tmp->vertices[0].Color = color;
tmp->vertices[1].Color = color;
tmp->vertices[2].Color = color;
tmp->vertices[3].Color = color;
tmp->indices.resize(2);
tmp->indices[0] = index<3u>(0u,2u,1u);
tmp->indices[1] = index<3u>(0u,3u,2u);
41,27 → 47,29
return tmp;
}
 
MeshBuffer* Geometry::createWall(const math::vector2df &size, const math::pixel &color) const noexcept
MeshBuffer* Geometry::createWall(const math::vec2f &size, const math::pixel &color) const noexcept
{
MeshBuffer *tmp = new MeshBuffer();
tmp->vertices.resize(4);
tmp->vertices[0].Pos = math::vector3df(-size.x/2,-size.y/2, 0);
tmp->vertices[1].Pos = math::vector3df( size.x/2,-size.y/2, 0);
tmp->vertices[2].Pos = math::vector3df( size.x/2, size.y/2, 0);
tmp->vertices[3].Pos = math::vector3df(-size.x/2, size.y/2, 0);
tmp->vertices[0].Pos = {-size.x/2,-size.y/2, 0};
tmp->vertices[1].Pos = { size.x/2,-size.y/2, 0};
tmp->vertices[2].Pos = { size.x/2, size.y/2, 0};
tmp->vertices[3].Pos = {-size.x/2, size.y/2, 0};
 
tmp->vertices[0].Coord = math::vector2df(0.0f, 0.0f);
tmp->vertices[1].Coord = math::vector2df(1.0f, 0.0f);
tmp->vertices[2].Coord = math::vector2df(1.0f, 1.0f);
tmp->vertices[3].Coord = math::vector2df(0.0f, 1.0f);
tmp->vertices[0].Coord = {0.0f, 0.0f};
tmp->vertices[1].Coord = {1.0f, 0.0f};
tmp->vertices[2].Coord = {1.0f, 1.0f};
tmp->vertices[3].Coord = {0.0f, 1.0f};
 
tmp->vertices[0].Normal = math::vector3df( 0.0f, 0.0f, 1.f);
tmp->vertices[1].Normal = math::vector3df( 0.0f, 0.0f, 1.f);
tmp->vertices[2].Normal = math::vector3df( 0.0f, 0.0f, 1.f);
tmp->vertices[3].Normal = math::vector3df( 0.0f, 0.0f, 1.f);
tmp->vertices[0].Normal = { 0.0f, 0.0f, 1.f};
tmp->vertices[1].Normal = { 0.0f, 0.0f, 1.f};
tmp->vertices[2].Normal = { 0.0f, 0.0f, 1.f};
tmp->vertices[3].Normal = { 0.0f, 0.0f, 1.f};
 
tmp->vertices[ 0].Color = color; tmp->vertices[ 1].Color = color;
tmp->vertices[ 2].Color = color; tmp->vertices[ 3].Color = color;
tmp->vertices[0].Color = color;
tmp->vertices[1].Color = color;
tmp->vertices[2].Color = color;
tmp->vertices[3].Color = color;
tmp->indices.resize(2);
tmp->indices[0] = index<3u>(0u,2u,1u);
tmp->indices[1] = index<3u>(2u,1u,3u);
68,7 → 76,7
return tmp;
}
 
MeshBuffer* Geometry::createCircle(const math::vector2df &radiusxy, const f32 step_x, const f32 step_y, const math::pixel &color) const noexcept
MeshBuffer* Geometry::createCircle(const math::vec2f &radiusxy, const f32 step_x, const f32 step_y, const math::pixel &color) const noexcept
{
MeshBuffer *tmp = new MeshBuffer();
tmp->vertices.resize(step_x*step_y+1);
80,7 → 88,7
for(register float y = 0.f; x<step_y; ++y)
{
angley += radiusxy.y;
tmp->vertices[psize].Pos = math::vector3df(sin(anglex), 0, cos(angley));
tmp->vertices[psize].Pos = math::vec3f(sin(anglex), 0, cos(angley));
psize++;
}
}
87,91 → 95,282
return tmp;
}
 
MeshBuffer* Geometry::createSphere(const f32 radius, const u32 polyCountX, const u32 polyCountY, const math::pixel &color) const noexcept
MeshBuffer* Geometry::createSphere(const f32 radius, u32 polyCountX, u32 polyCountY, const math::pixel &color) const noexcept
{
MeshBuffer *tmp = new MeshBuffer();
tmp->vertices.resize(polyCountX*polyCountY);
 
polyCountX = std::max(polyCountX, 2u);
polyCountY = std::max(polyCountY, 2u);
 
const u32 polyCountXPitch = polyCountX+1;
 
tmp->indices.reserve(polyCountX*polyCountY*6);
{
const u32 polyCountSq = polyCountXPitch * polyCountY; // top point
const u32 polyCountSq1 = polyCountSq + 1; // bottom point
const u32 polyCountSqM1 = (polyCountY - 1) * polyCountXPitch; // last row's first vertex
u32 level = 0;
 
for(u32 p1 = 0; p1 < polyCountY-1; ++p1)
{
for(u32 p2 = 0; p2 < polyCountX - 1; ++p2)
{
const u32 curr = level + p2;
tmp->indices.push_back(index<3>(curr + polyCountXPitch, curr, curr + 1));
tmp->indices.push_back(index<3>(curr + polyCountXPitch, curr + 1, curr + 1 + polyCountXPitch));
}
 
tmp->indices.push_back(index<3>(
level + polyCountX - 1 + polyCountXPitch,
level + polyCountX - 1,
level + polyCountX
));
tmp->indices.push_back(index<3>(
level + polyCountX - 1 + polyCountXPitch,
level + polyCountX,
level + polyCountX + polyCountXPitch
));
level += polyCountXPitch;
}
 
for(u32 p2 = 0; p2 < polyCountX - 1; ++p2)
{
tmp->indices.push_back(index<3>(polyCountSq, p2 + 1, p2));
tmp->indices.push_back(index<3>(polyCountSqM1 + p2, polyCountSqM1 + p2 + 1, polyCountSq1));
}
 
tmp->indices.push_back(index<3>(polyCountSq, polyCountX, polyCountX-1));
tmp->indices.push_back(index<3>(polyCountSqM1 + polyCountX - 1, polyCountSqM1, polyCountSq1));
}
 
tmp->vertices.reserve(polyCountX*polyCountY);
{
const f64 AngleX = 2 * PI / polyCountX;
const f64 AngleY = PI / polyCountY;
 
u32 i=0;
f64 axz, ay = 0;
 
tmp->vertices.resize((polyCountXPitch * polyCountY) + 2);
for(u32 y = 0; y < polyCountY; ++y)
{
ay += AngleY;
const f64 sinay = sin(ay);
axz = 0;
 
for(u32 xz = 0;xz < polyCountX; ++xz)
{
const math::vec3f pos(
radius/2.f * cos(axz) * sinay,
radius/2.f * cos(ay),
radius/2.f * sin(axz) * sinay
);
 
math::vec3f normal = glm::normalize(pos);
 
f32 tu = 0.5f;
 
if(normal.y != -1.0f && normal.y != 1.0f)
tu = acos(math::clamp(normal.x/sinay, -1.0, 1.0)) * 0.5 * RECIPROCAL_PI;
if(normal.z < 0.0f)
tu = 1-tu;
 
tmp->vertices[i].Pos = pos;
tmp->vertices[i].Normal = normal;
tmp->vertices[i].Color = color;
tmp->vertices[i].Coord.x = tu;
tmp->vertices[i].Coord.y = ay*RECIPROCAL_PI;
 
++i;
axz += AngleX;
}
 
tmp->vertices[i] = tmp->vertices[i-polyCountX];
tmp->vertices[i].Coord.x = 1.0f;
++i;
}
 
tmp->vertices[i].Pos = {0.0f, radius/2.f,0.0f};
tmp->vertices[i].Normal = math::vec3f(0.0f,1.f,0.0f);
tmp->vertices[i].Coord = math::vec2f(0.5f,1.0f);
tmp->vertices[i].Color = color;
 
++i;
 
tmp->vertices[i].Pos = {0.0f, -radius/2.f,0.0f};
tmp->vertices[i].Normal = math::vec3f(0.0f,-1.f,0.0f);
tmp->vertices[i].Coord = math::vec2f(0.5f,0.0f);
tmp->vertices[i].Color = color;
}
return tmp;
}
 
MeshBuffer* Geometry::createCube(const math::vector3df &size, const math::pixel &color) const noexcept
MeshBuffer* Geometry::createIcoSphere(const f32 radius, u32 subdivide, const math::pixel &color) const noexcept
{
MeshBuffer *tmp = new MeshBuffer();
subdivide = std::min(subdivide, 9u);
 
//! --------------------------------------
 
static constexpr const float phi = (1+sqrt(5))/2.;
struct triangle { math::vec3f a, b, c; };
 
static const math::vec3f vertex[12] = {
{ phi, 1,0}, { phi,-1,0}, {-phi, 1,0}, {-phi,-1,0},
{ 1,0, phi}, { 1,0,-phi}, {-1,0, phi}, {-1,0,-phi},
{0, phi, 1}, {0, phi,-1}, {0,-phi, 1}, {0,-phi,-1}
};
 
static const uint index[][3] = {
{ 2, 8, 9}, { 9, 8, 0}, { 0, 8, 4}, { 4, 8, 6}, { 6, 8, 2},
{ 3,11,10}, {10,11, 1}, { 1,11, 5}, { 5,11, 7}, { 7,11, 3},
{ 3, 2, 7}, { 7, 2, 9}, { 7, 9, 5}, { 5, 9, 0}, { 5, 0, 1},
{ 1, 0, 4}, { 1, 4,10}, {10, 4, 6}, {10, 6, 3}, { 3, 6, 2}
};
//! --------------------------------------
 
std::vector<triangle> old_vert;
std::vector<triangle> cur_vert;
 
cur_vert.resize(sizeof(index)/sizeof(index[0]));
 
for(int i = 0; i<cur_vert.size(); ++i)
{
cur_vert[i].a = glm::normalize(vertex[index[i][0]]);
cur_vert[i].b = glm::normalize(vertex[index[i][1]]);
cur_vert[i].c = glm::normalize(vertex[index[i][2]]);
}
 
for(int s = 0; s<subdivide; ++s)
{
for(int i = 0; i<cur_vert.size(); ++i)
{
math::vec3f v1 = cur_vert[i].a;
math::vec3f v2 = cur_vert[i].b;
math::vec3f v3 = cur_vert[i].c;
math::vec3f v4 = glm::normalize(v1 + v2);
math::vec3f v5 = glm::normalize(v2 + v3);
math::vec3f v6 = glm::normalize(v3 + v1);
old_vert.push_back({v1, v4, v6});
old_vert.push_back({v4, v2, v5});
old_vert.push_back({v6, v5, v3});
old_vert.push_back({v4, v5, v6});
}
old_vert.swap(cur_vert);
old_vert.clear();
}
 
tmp->vertices.resize(cur_vert.size()*3);
tmp->indices.resize(cur_vert.size());
 
for(unsigned int i = 0; i<cur_vert.size(); ++i)
{
tmp->vertices[i*3+0].Pos = cur_vert[i].a * (radius/2.f);
tmp->vertices[i*3+1].Pos = cur_vert[i].b * (radius/2.f);
tmp->vertices[i*3+2].Pos = cur_vert[i].c * (radius/2.f);
 
tmp->vertices[i*3+0].Normal = cur_vert[i].a;
tmp->vertices[i*3+1].Normal = cur_vert[i].b;
tmp->vertices[i*3+2].Normal = cur_vert[i].c;
 
tmp->vertices[i*3+0].Color = color;
tmp->vertices[i*3+1].Color = color;
tmp->vertices[i*3+2].Color = color;
 
tmp->vertices[i*3+0].Coord.x = 0.5f - atan2(cur_vert[i].a.z, cur_vert[i].a.x)/(float)(2.0f*PI);
tmp->vertices[i*3+1].Coord.x = 0.5f - atan2(cur_vert[i].b.z, cur_vert[i].b.x)/(float)(2.0f*PI);
tmp->vertices[i*3+2].Coord.x = 0.5f - atan2(cur_vert[i].c.z, cur_vert[i].c.x)/(float)(2.0f*PI);
 
tmp->vertices[i*3+0].Coord.y = 0.5f - (0.2f * asin(cur_vert[i].a.y) / 2.0f*PI);
tmp->vertices[i*3+1].Coord.y = 0.5f - (0.2f * asin(cur_vert[i].b.y) / 2.0f*PI);
tmp->vertices[i*3+2].Coord.y = 0.5f - (0.2f * asin(cur_vert[i].c.y) / 2.0f*PI);
 
tmp->indices[i].vertex[0] = i*3;
tmp->indices[i].vertex[1] = i*3+1u;
tmp->indices[i].vertex[2] = i*3+2u;
}
 
return tmp;
}
 
MeshBuffer* Geometry::createCube(const math::vec3f &size, const math::pixel &color) const noexcept
{
MeshBuffer *tmp = new MeshBuffer();
tmp->vertices.resize(24);
tmp->vertices[ 0].Pos = math::vector3df(-size.x/2,-size.y/2, size.z/2);
tmp->vertices[ 1].Pos = math::vector3df( size.x/2,-size.y/2, size.z/2);
tmp->vertices[ 2].Pos = math::vector3df( size.x/2, size.y/2, size.z/2);
tmp->vertices[ 3].Pos = math::vector3df(-size.x/2, size.y/2, size.z/2);
tmp->vertices[ 4].Pos = math::vector3df(-size.x/2,-size.y/2,-size.z/2);
tmp->vertices[ 5].Pos = math::vector3df(-size.x/2, size.y/2,-size.z/2);
tmp->vertices[ 6].Pos = math::vector3df( size.x/2, size.y/2,-size.z/2);
tmp->vertices[ 7].Pos = math::vector3df( size.x/2,-size.y/2,-size.z/2);
tmp->vertices[ 8].Pos = math::vector3df(-size.x/2, size.y/2,-size.z/2);
tmp->vertices[ 9].Pos = math::vector3df(-size.x/2, size.y/2, size.z/2);
tmp->vertices[10].Pos = math::vector3df( size.x/2, size.y/2, size.z/2);
tmp->vertices[11].Pos = math::vector3df( size.x/2, size.y/2,-size.z/2);
tmp->vertices[12].Pos = math::vector3df(-size.x/2,-size.y/2,-size.z/2);
tmp->vertices[13].Pos = math::vector3df( size.x/2,-size.y/2,-size.z/2);
tmp->vertices[14].Pos = math::vector3df( size.x/2,-size.y/2, size.z/2);
tmp->vertices[15].Pos = math::vector3df(-size.x/2,-size.y/2, size.z/2);
tmp->vertices[16].Pos = math::vector3df( size.x/2,-size.y/2,-size.z/2);
tmp->vertices[17].Pos = math::vector3df( size.x/2, size.y/2,-size.z/2);
tmp->vertices[18].Pos = math::vector3df( size.x/2, size.y/2, size.z/2);
tmp->vertices[19].Pos = math::vector3df( size.x/2,-size.y/2, size.z/2);
tmp->vertices[20].Pos = math::vector3df(-size.x/2,-size.y/2,-size.z/2);
tmp->vertices[21].Pos = math::vector3df(-size.x/2,-size.y/2, size.z/2);
tmp->vertices[22].Pos = math::vector3df(-size.x/2, size.y/2, size.z/2);
tmp->vertices[23].Pos = math::vector3df(-size.x/2, size.y/2,-size.z/2);
tmp->vertices[ 0].Pos = {-size.x/2,-size.y/2, size.z/2};
tmp->vertices[ 1].Pos = { size.x/2,-size.y/2, size.z/2};
tmp->vertices[ 2].Pos = { size.x/2, size.y/2, size.z/2};
tmp->vertices[ 3].Pos = {-size.x/2, size.y/2, size.z/2};
tmp->vertices[ 4].Pos = {-size.x/2,-size.y/2,-size.z/2};
tmp->vertices[ 5].Pos = {-size.x/2, size.y/2,-size.z/2};
tmp->vertices[ 6].Pos = { size.x/2, size.y/2,-size.z/2};
tmp->vertices[ 7].Pos = { size.x/2,-size.y/2,-size.z/2};
tmp->vertices[ 8].Pos = {-size.x/2, size.y/2,-size.z/2};
tmp->vertices[ 9].Pos = {-size.x/2, size.y/2, size.z/2};
tmp->vertices[10].Pos = { size.x/2, size.y/2, size.z/2};
tmp->vertices[11].Pos = { size.x/2, size.y/2,-size.z/2};
tmp->vertices[12].Pos = {-size.x/2,-size.y/2,-size.z/2};
tmp->vertices[13].Pos = { size.x/2,-size.y/2,-size.z/2};
tmp->vertices[14].Pos = { size.x/2,-size.y/2, size.z/2};
tmp->vertices[15].Pos = {-size.x/2,-size.y/2, size.z/2};
tmp->vertices[16].Pos = { size.x/2,-size.y/2,-size.z/2};
tmp->vertices[17].Pos = { size.x/2, size.y/2,-size.z/2};
tmp->vertices[18].Pos = { size.x/2, size.y/2, size.z/2};
tmp->vertices[19].Pos = { size.x/2,-size.y/2, size.z/2};
tmp->vertices[20].Pos = {-size.x/2,-size.y/2,-size.z/2};
tmp->vertices[21].Pos = {-size.x/2,-size.y/2, size.z/2};
tmp->vertices[22].Pos = {-size.x/2, size.y/2, size.z/2};
tmp->vertices[23].Pos = {-size.x/2, size.y/2,-size.z/2};
 
tmp->vertices[ 0].Coord = math::vector2df(0.0f, 0.0f);
tmp->vertices[ 1].Coord = math::vector2df(1.0f, 0.0f);
tmp->vertices[ 2].Coord = math::vector2df(1.0f, 1.0f);
tmp->vertices[ 3].Coord = math::vector2df(0.0f, 1.0f);
tmp->vertices[ 4].Coord = math::vector2df(1.0f, 0.0f);
tmp->vertices[ 5].Coord = math::vector2df(1.0f, 1.0f);
tmp->vertices[ 6].Coord = math::vector2df(0.0f, 1.0f);
tmp->vertices[ 7].Coord = math::vector2df(0.0f, 0.0f);
tmp->vertices[ 8].Coord = math::vector2df(0.0f, 1.0f);
tmp->vertices[ 9].Coord = math::vector2df(0.0f, 0.0f);
tmp->vertices[10].Coord = math::vector2df(1.0f, 0.0f);
tmp->vertices[11].Coord = math::vector2df(1.0f, 1.0f);
tmp->vertices[12].Coord = math::vector2df(1.0f, 1.0f);
tmp->vertices[13].Coord = math::vector2df(0.0f, 1.0f);
tmp->vertices[14].Coord = math::vector2df(0.0f, 0.0f);
tmp->vertices[15].Coord = math::vector2df(1.0f, 0.0f);
tmp->vertices[16].Coord = math::vector2df(1.0f, 0.0f);
tmp->vertices[17].Coord = math::vector2df(1.0f, 1.0f);
tmp->vertices[18].Coord = math::vector2df(0.0f, 1.0f);
tmp->vertices[19].Coord = math::vector2df(0.0f, 0.0f);
tmp->vertices[20].Coord = math::vector2df(0.0f, 0.0f);
tmp->vertices[21].Coord = math::vector2df(1.0f, 0.0f);
tmp->vertices[22].Coord = math::vector2df(1.0f, 1.0f);
tmp->vertices[23].Coord = math::vector2df(0.0f, 1.0f);
tmp->vertices[ 0].Coord = {0.0f, 0.0f};
tmp->vertices[ 1].Coord = {1.0f, 0.0f};
tmp->vertices[ 2].Coord = {1.0f, 1.0f};
tmp->vertices[ 3].Coord = {0.0f, 1.0f};
tmp->vertices[ 4].Coord = {1.0f, 0.0f};
tmp->vertices[ 5].Coord = {1.0f, 1.0f};
tmp->vertices[ 6].Coord = {0.0f, 1.0f};
tmp->vertices[ 7].Coord = {0.0f, 0.0f};
tmp->vertices[ 8].Coord = {0.0f, 1.0f};
tmp->vertices[ 9].Coord = {0.0f, 0.0f};
tmp->vertices[10].Coord = {1.0f, 0.0f};
tmp->vertices[11].Coord = {1.0f, 1.0f};
tmp->vertices[12].Coord = {1.0f, 1.0f};
tmp->vertices[13].Coord = {0.0f, 1.0f};
tmp->vertices[14].Coord = {0.0f, 0.0f};
tmp->vertices[15].Coord = {1.0f, 0.0f};
tmp->vertices[16].Coord = {1.0f, 0.0f};
tmp->vertices[17].Coord = {1.0f, 1.0f};
tmp->vertices[18].Coord = {0.0f, 1.0f};
tmp->vertices[19].Coord = {0.0f, 0.0f};
tmp->vertices[20].Coord = {0.0f, 0.0f};
tmp->vertices[21].Coord = {1.0f, 0.0f};
tmp->vertices[22].Coord = {1.0f, 1.0f};
tmp->vertices[23].Coord = {0.0f, 1.0f};
 
tmp->vertices[ 0].Normal = math::vector3df( 0.0f, 0.0f, 1.f);
tmp->vertices[ 1].Normal = math::vector3df( 0.0f, 0.0f, 1.f);
tmp->vertices[ 2].Normal = math::vector3df( 0.0f, 0.0f, 1.f);
tmp->vertices[ 3].Normal = math::vector3df( 0.0f, 0.0f, 1.f);
tmp->vertices[ 4].Normal = math::vector3df( 0.0f, 0.0f,-1.0f);
tmp->vertices[ 5].Normal = math::vector3df( 0.0f, 0.0f,-1.0f);
tmp->vertices[ 6].Normal = math::vector3df( 0.0f, 0.0f,-1.0f);
tmp->vertices[ 7].Normal = math::vector3df( 0.0f, 0.0f,-1.0f);
tmp->vertices[ 8].Normal = math::vector3df( 0.0f, 1.0f, 0.0f);
tmp->vertices[ 9].Normal = math::vector3df( 0.0f, 1.0f, 0.0f);
tmp->vertices[10].Normal = math::vector3df( 0.0f, 1.0f, 0.0f);
tmp->vertices[11].Normal = math::vector3df( 0.0f, 1.0f, 0.0f);
tmp->vertices[12].Normal = math::vector3df( 0.0f,-1.0f, 0.0f);
tmp->vertices[13].Normal = math::vector3df( 0.0f,-1.0f, 0.0f);
tmp->vertices[14].Normal = math::vector3df( 0.0f,-1.0f, 0.0f);
tmp->vertices[15].Normal = math::vector3df( 0.0f,-1.0f, 0.0f);
tmp->vertices[16].Normal = math::vector3df( 1.0f, 0.0f, 0.0f);
tmp->vertices[17].Normal = math::vector3df( 1.0f, 0.0f, 0.0f);
tmp->vertices[18].Normal = math::vector3df( 1.0f, 0.0f, 0.0f);
tmp->vertices[19].Normal = math::vector3df( 1.0f, 0.0f, 0.0f);
tmp->vertices[20].Normal = math::vector3df(-1.0f, 0.0f, 0.0f);
tmp->vertices[21].Normal = math::vector3df(-1.0f, 0.0f, 0.0f);
tmp->vertices[22].Normal = math::vector3df(-1.0f, 0.0f, 0.0f);
tmp->vertices[23].Normal = math::vector3df(-1.0f, 0.0f, 0.0f);
tmp->vertices[ 0].Normal = { 0.0f, 0.0f, 1.0f};
tmp->vertices[ 1].Normal = { 0.0f, 0.0f, 1.0f};
tmp->vertices[ 2].Normal = { 0.0f, 0.0f, 1.0f};
tmp->vertices[ 3].Normal = { 0.0f, 0.0f, 1.0f};
tmp->vertices[ 4].Normal = { 0.0f, 0.0f,-1.0f};
tmp->vertices[ 5].Normal = { 0.0f, 0.0f,-1.0f};
tmp->vertices[ 6].Normal = { 0.0f, 0.0f,-1.0f};
tmp->vertices[ 7].Normal = { 0.0f, 0.0f,-1.0f};
tmp->vertices[ 8].Normal = { 0.0f, 1.0f, 0.0f};
tmp->vertices[ 9].Normal = { 0.0f, 1.0f, 0.0f};
tmp->vertices[10].Normal = { 0.0f, 1.0f, 0.0f};
tmp->vertices[11].Normal = { 0.0f, 1.0f, 0.0f};
tmp->vertices[12].Normal = { 0.0f,-1.0f, 0.0f};
tmp->vertices[13].Normal = { 0.0f,-1.0f, 0.0f};
tmp->vertices[14].Normal = { 0.0f,-1.0f, 0.0f};
tmp->vertices[15].Normal = { 0.0f,-1.0f, 0.0f};
tmp->vertices[16].Normal = { 1.0f, 0.0f, 0.0f};
tmp->vertices[17].Normal = { 1.0f, 0.0f, 0.0f};
tmp->vertices[18].Normal = { 1.0f, 0.0f, 0.0f};
tmp->vertices[19].Normal = { 1.0f, 0.0f, 0.0f};
tmp->vertices[20].Normal = {-1.0f, 0.0f, 0.0f};
tmp->vertices[21].Normal = {-1.0f, 0.0f, 0.0f};
tmp->vertices[22].Normal = {-1.0f, 0.0f, 0.0f};
tmp->vertices[23].Normal = {-1.0f, 0.0f, 0.0f};
 
tmp->vertices[ 0].Color = color; tmp->vertices[ 1].Color = color;
tmp->vertices[ 2].Color = color; tmp->vertices[ 3].Color = color;
201,7 → 400,7
return tmp;
}
 
MeshBuffer* Geometry::createPolygone(const math::vector3df &a,const math::vector3df &b,const math::vector3df &c, const math::pixel &color) const noexcept
MeshBuffer* Geometry::createPolygone(const math::vec3f &a,const math::vec3f &b,const math::vec3f &c, const math::pixel &color) const noexcept
{
MeshBuffer *tmp = new MeshBuffer();
tmp->vertices.resize(3);
208,69 → 407,69
tmp->vertices[0].Pos = a;
tmp->vertices[1].Pos = b;
tmp->vertices[2].Pos = c;
tmp->vertices[ 0].Color = color;
tmp->vertices[ 1].Color = color;
tmp->vertices[ 2].Color = color;
tmp->vertices[ 3].Color = color;
tmp->vertices[0].Color = color;
tmp->vertices[1].Color = color;
tmp->vertices[2].Color = color;
tmp->vertices[3].Color = color;
tmp->indices.resize(1);
tmp->indices[ 0] = index<3>(0u, 1u, 2u);
return tmp;
}
 
MeshBuffer* Geometry::createPyramid(const math::vector3df &size, const math::pixel &color) const noexcept
MeshBuffer* Geometry::createPyramid(const math::vec3f &size, const math::pixel &color) const noexcept
{
MeshBuffer *tmp = new MeshBuffer();
tmp->vertices.resize(16);
tmp->vertices[ 0].Pos = math::vector3df(-size.x/2,-size.y/2,-size.z/2);
tmp->vertices[ 1].Pos = math::vector3df( size.x/2,-size.y/2,-size.z/2);
tmp->vertices[ 2].Pos = math::vector3df( size.x/2,-size.y/2, size.z/2);
tmp->vertices[ 3].Pos = math::vector3df(-size.x/2,-size.y/2, size.z/2);
tmp->vertices[ 4].Pos = math::vector3df(-size.x/2,-size.y/2,-size.z/2);
tmp->vertices[ 5].Pos = math::vector3df( size.x/2,-size.y/2,-size.z/2);
tmp->vertices[ 6].Pos = math::vector3df( 0, size.y/2, 0);
tmp->vertices[ 7].Pos = math::vector3df( size.x/2,-size.y/2,-size.z/2);
tmp->vertices[ 8].Pos = math::vector3df( size.x/2,-size.y/2, size.z/2);
tmp->vertices[ 9].Pos = math::vector3df( 0, size.y/2, 0);
tmp->vertices[10].Pos = math::vector3df( size.x/2,-size.y/2, size.z/2);
tmp->vertices[11].Pos = math::vector3df(-size.x/2,-size.y/2, size.z/2);
tmp->vertices[12].Pos = math::vector3df( 0, size.y/2, 0);
tmp->vertices[13].Pos = math::vector3df(-size.x/2,-size.y/2,-size.z/2);
tmp->vertices[14].Pos = math::vector3df(-size.x/2,-size.y/2, size.z/2);
tmp->vertices[15].Pos = math::vector3df( 0, size.y/2, 0);
tmp->vertices[ 0].Pos = {-size.x/2,-size.y/2,-size.z/2};
tmp->vertices[ 1].Pos = { size.x/2,-size.y/2,-size.z/2};
tmp->vertices[ 2].Pos = { size.x/2,-size.y/2, size.z/2};
tmp->vertices[ 3].Pos = {-size.x/2,-size.y/2, size.z/2};
tmp->vertices[ 4].Pos = {-size.x/2,-size.y/2,-size.z/2};
tmp->vertices[ 5].Pos = { size.x/2,-size.y/2,-size.z/2};
tmp->vertices[ 6].Pos = { 0, size.y/2, 0};
tmp->vertices[ 7].Pos = { size.x/2,-size.y/2,-size.z/2};
tmp->vertices[ 8].Pos = { size.x/2,-size.y/2, size.z/2};
tmp->vertices[ 9].Pos = { 0, size.y/2, 0};
tmp->vertices[10].Pos = { size.x/2,-size.y/2, size.z/2};
tmp->vertices[11].Pos = {-size.x/2,-size.y/2, size.z/2};
tmp->vertices[12].Pos = { 0, size.y/2, 0};
tmp->vertices[13].Pos = {-size.x/2,-size.y/2,-size.z/2};
tmp->vertices[14].Pos = {-size.x/2,-size.y/2, size.z/2};
tmp->vertices[15].Pos = { 0, size.y/2, 0};
 
tmp->vertices[ 0].Coord = math::vector2df(1.0f, 1.0f);
tmp->vertices[ 1].Coord = math::vector2df(0.0f, 1.0f);
tmp->vertices[ 2].Coord = math::vector2df(0.0f, 0.0f);
tmp->vertices[ 3].Coord = math::vector2df(1.0f, 0.0f);
tmp->vertices[ 4].Coord = math::vector2df(0.0f, 0.0f);
tmp->vertices[ 5].Coord = math::vector2df(1.0f, 0.0f);
tmp->vertices[ 6].Coord = math::vector2df(0.5f, 1.0f);
tmp->vertices[ 7].Coord = math::vector2df(0.0f, 0.0f);
tmp->vertices[ 8].Coord = math::vector2df(1.0f, 0.0f);
tmp->vertices[ 9].Coord = math::vector2df(0.5f, 1.0f);
tmp->vertices[10].Coord = math::vector2df(0.0f, 0.0f);
tmp->vertices[11].Coord = math::vector2df(1.0f, 0.0f);
tmp->vertices[12].Coord = math::vector2df(0.5f, 1.0f);
tmp->vertices[13].Coord = math::vector2df(0.0f, 0.0f);
tmp->vertices[14].Coord = math::vector2df(1.0f, 0.0f);
tmp->vertices[15].Coord = math::vector2df(0.5f, 1.0f);
tmp->vertices[ 0].Coord = {1.0f, 1.0f};
tmp->vertices[ 1].Coord = {0.0f, 1.0f};
tmp->vertices[ 2].Coord = {0.0f, 0.0f};
tmp->vertices[ 3].Coord = {1.0f, 0.0f};
tmp->vertices[ 4].Coord = {0.0f, 0.0f};
tmp->vertices[ 5].Coord = {1.0f, 0.0f};
tmp->vertices[ 6].Coord = {0.5f, 1.0f};
tmp->vertices[ 7].Coord = {0.0f, 0.0f};
tmp->vertices[ 8].Coord = {1.0f, 0.0f};
tmp->vertices[ 9].Coord = {0.5f, 1.0f};
tmp->vertices[10].Coord = {0.0f, 0.0f};
tmp->vertices[11].Coord = {1.0f, 0.0f};
tmp->vertices[12].Coord = {0.5f, 1.0f};
tmp->vertices[13].Coord = {0.0f, 0.0f};
tmp->vertices[14].Coord = {1.0f, 0.0f};
tmp->vertices[15].Coord = {0.5f, 1.0f};
 
tmp->vertices[ 0].Normal = math::vector3df( 0.0f,-1.0f, 0.0f);
tmp->vertices[ 1].Normal = math::vector3df( 0.0f,-1.0f, 0.0f);
tmp->vertices[ 2].Normal = math::vector3df( 0.0f,-1.0f, 0.0f);
tmp->vertices[ 3].Normal = math::vector3df( 0.0f,-1.0f, 0.0f);
tmp->vertices[ 4].Normal = math::vector3df(-1.0f,-1.0f,-1.0f);
tmp->vertices[ 5].Normal = math::vector3df( 1.0f,-1.0f,-1.0f);
tmp->vertices[ 6].Normal = math::vector3df( 0.0f, 1.0f, 0.0f);
tmp->vertices[ 7].Normal = math::vector3df( 1.0f,-1.0f,-1.0f);
tmp->vertices[ 8].Normal = math::vector3df( 1.0f,-1.0f, 1.0f);
tmp->vertices[ 9].Normal = math::vector3df( 0.0f, 1.0f, 0.0f);
tmp->vertices[10].Normal = math::vector3df( 1.0f,-1.0f, 1.0f);
tmp->vertices[11].Normal = math::vector3df(-1.0f,-1.0f, 1.0f);
tmp->vertices[12].Normal = math::vector3df( 0.0f, 1.0f, 0.0f);
tmp->vertices[13].Normal = math::vector3df(-1.0f,-1.0f,-1.0f);
tmp->vertices[14].Normal = math::vector3df(-1.0f,-1.0f, 1.0f);
tmp->vertices[15].Normal = math::vector3df( 0.0f, 1.0f, 0.0f);
tmp->vertices[ 0].Normal = { 0.0f,-1.0f, 0.0f};
tmp->vertices[ 1].Normal = { 0.0f,-1.0f, 0.0f};
tmp->vertices[ 2].Normal = { 0.0f,-1.0f, 0.0f};
tmp->vertices[ 3].Normal = { 0.0f,-1.0f, 0.0f};
tmp->vertices[ 4].Normal = {-1.0f,-1.0f,-1.0f};
tmp->vertices[ 5].Normal = { 1.0f,-1.0f,-1.0f};
tmp->vertices[ 6].Normal = { 0.0f, 1.0f, 0.0f};
tmp->vertices[ 7].Normal = { 1.0f,-1.0f,-1.0f};
tmp->vertices[ 8].Normal = { 1.0f,-1.0f, 1.0f};
tmp->vertices[ 9].Normal = { 0.0f, 1.0f, 0.0f};
tmp->vertices[10].Normal = { 1.0f,-1.0f, 1.0f};
tmp->vertices[11].Normal = {-1.0f,-1.0f, 1.0f};
tmp->vertices[12].Normal = { 0.0f, 1.0f, 0.0f};
tmp->vertices[13].Normal = {-1.0f,-1.0f,-1.0f};
tmp->vertices[14].Normal = {-1.0f,-1.0f, 1.0f};
tmp->vertices[15].Normal = { 0.0f, 1.0f, 0.0f};
 
tmp->vertices[ 0].Color = color; tmp->vertices[ 1].Color = color;
tmp->vertices[ 2].Color = color; tmp->vertices[ 3].Color = color;
281,12 → 480,12
tmp->vertices[12].Color = color; tmp->vertices[13].Color = color;
tmp->vertices[14].Color = color; tmp->vertices[15].Color = color;
tmp->indices.resize(6);
tmp->indices[ 0] = index<3>( 0u, 2u, 1u);
tmp->indices[ 1] = index<3>( 0u, 3u, 2u);
tmp->indices[ 2] = index<3>( 4u, 5u, 6u);
tmp->indices[ 3] = index<3>( 7u, 8u, 9u);
tmp->indices[ 4] = index<3>(10u,11u,12u);
tmp->indices[ 5] = index<3>(13u,14u,15u);
tmp->indices[0] = index<3>( 0u, 2u, 1u);
tmp->indices[1] = index<3>( 0u, 3u, 2u);
tmp->indices[2] = index<3>( 4u, 5u, 6u);
tmp->indices[3] = index<3>( 7u, 8u, 9u);
tmp->indices[4] = index<3>(10u,11u,12u);
tmp->indices[5] = index<3>(13u,14u,15u);
return tmp;
}
 
/src/sleek/driver/geometry.h
16,13 → 16,14
Geometry() noexcept;
~Geometry() noexcept;
 
MeshBuffer* createPlane(const math::vector2df &size = math::vector2df(5.f,5.f), const u32 polyCountX = 1, const u32 polyCountY = 1, const math::pixel &color = math::pixel(255,255,255,255)) const noexcept;
MeshBuffer* createWall(const math::vector2df &size = math::vector2df(5.f,5.f), const math::pixel &color = math::pixel(255,255,255,255)) const noexcept;
MeshBuffer* createCircle(const math::vector2df &radiusxy = math::vector2df(5.f,5.f), const f32 step_x = 10, const f32 step_y = 10, const math::pixel &color = math::pixel(255,255,255,255)) const noexcept;
MeshBuffer* createSphere(const f32 radius = 5.f, const u32 polyCountX = 16, const u32 polyCountY = 16, const math::pixel &color = math::pixel(255,255,255,255)) const noexcept; // not implented
MeshBuffer* createCube(const math::vector3df &size = math::vector3df(5.f, 5.f, 5.f), const math::pixel &color = math::pixel(255,255,255,255)) const noexcept;
MeshBuffer* createPolygone(const math::vector3df&,const math::vector3df&,const math::vector3df&, const math::pixel &color = math::pixel(255,255,255,255)) const noexcept;
MeshBuffer* createPyramid(const math::vector3df &size = math::vector3df(5.f, 5.f, 5.f), const math::pixel &color = math::pixel(255,255,255,255)) const noexcept;
MeshBuffer* createPlane(const math::vec2f &size = math::vec2f(5.f,5.f), const u32 polyCountX = 1, const u32 polyCountY = 1, const math::pixel &color = math::pixel(255,255,255,255)) const noexcept;
MeshBuffer* createWall(const math::vec2f &size = math::vec2f(5.f,5.f), const math::pixel &color = math::pixel(255,255,255,255)) const noexcept;
MeshBuffer* createCircle(const math::vec2f &radiusxy = math::vec2f(5.f,5.f), const f32 step_x = 10, const f32 step_y = 10, const math::pixel &color = math::pixel(255,255,255,255)) const noexcept;
MeshBuffer* createSphere(const f32 radius = 5.f, u32 polyCountX = 16, u32 polyCountY = 16, const math::pixel &color = math::pixel(255,255,255,255)) const noexcept;
MeshBuffer* createIcoSphere(const f32 radius = 5.f, u32 subdivide = 0, const math::pixel &color = math::pixel(255,255,255,255)) const noexcept;
MeshBuffer* createCube(const math::vec3f &size = math::vec3f(5.f, 5.f, 5.f), const math::pixel &color = math::pixel(255,255,255,255)) const noexcept;
MeshBuffer* createPolygone(const math::vec3f&,const math::vec3f&,const math::vec3f&, const math::pixel &color = math::pixel(255,255,255,255)) const noexcept;
MeshBuffer* createPyramid(const math::vec3f &size = math::vec3f(5.f, 5.f, 5.f), const math::pixel &color = math::pixel(255,255,255,255)) const noexcept;
MeshBuffer* createTorus(const f32 radiusX = 5.f, const f32 radiusY = 2.5f, const u32 polyCountX = 16, const u32 polyCountY = 16, const math::pixel &color = math::pixel(255,255,255,255)) const noexcept; // not implented
MeshBuffer* createCone(const f32 radius = 5.f, const f32 length = 5.f, const u32 tesselation = 1, const math::pixel &color = math::pixel(255,255,255,255)) const noexcept; // not implented
MeshBuffer* createCylindre(const f32 radius = 5.f, const f32 length = 5.f, const u32 tesselation = 1, const math::pixel &color = math::pixel(255,255,255,255)) const noexcept; // not implented
/src/sleek/driver/identifier.h
12,23 → 12,26
HIT_NULL,
HIT_TEXTURE,
HIT_FBO,
HIT_VBO,
//HIT_VBO, //! deperecated
HIT_VAO,
HIT_SHADER,
HIT_USER_TYPE
};
 
enum VBO_BUFFER_TYPE
{
VBO_VERTEX_BUFFER,
VBO_INDEX_BUFFER,
VBO_COUNT
};
/** deprecated
enum VBO_BUFFER_TYPE
{
VBO_VERTEX_BUFFER,
VBO_INDEX_BUFFER,
VBO_COUNT
};
*/
 
enum VBO_BUFFER_ALIGNMENT
enum VAO_ALIGNMENT
{
VBO_STATIC,
VBO_DYNAMIC,
VBO_STREAM,
VAO_STATIC,
VAO_DYNAMIC,
VAO_STREAM,
};
 
struct identifier : public std::enable_shared_from_this<identifier>
/src/sleek/driver/material.h
7,7 → 7,7
#include "rtype.h"
#include "context.h"
#include "material.h"
#include "../math/vector3d.h"
#include "../math/math.h"
 
namespace sleek
{
18,7 → 18,7
public:
material() noexcept : psize(1)
{
scale = math::vector3df(1);
scale = math::vec3f(1);
 
fac = rfc_off;
ant = ral_off;
25,6 → 25,7
mode = rmd_polygon;
mat = rmt_solid;
shd = rsd_smooth;
wire = rwf_fill;
 
Texture.reserve(reserved_texture);
effect = 0;
41,6 → 42,7
 
inline void setShader(std::shared_ptr<identifier> i) noexcept { effect = i; }
 
inline void setWireframe(const u32 i) noexcept { wire = i; }
inline void setMode(const render_mode i) noexcept { mode = i; }
inline void setPointSize(const f32 i) noexcept { psize = i; }
inline void setShadeModel(const u32 i) noexcept { shd = i; }
47,11 → 49,11
inline void setFaceCulling(const u32 i) noexcept { fac = i; }
inline void setAntialiasing(const u32 i) noexcept { ant = i; }
inline void setMaterialRender(const u32 i) noexcept { mat = i; }
inline void setScale(const math::vector3df &i) noexcept { scale = i; }
inline void setScale(const math::vec3f &i) noexcept { scale = i; }
 
/** ***************************************************** **/
 
inline math::vector3df getScale() const noexcept { return scale; }
inline math::vec3f getScale() const noexcept { return scale; }
inline u32 getMaterialRender() const noexcept { return mat; }
inline u32 getAntialiasing() const noexcept { return ant; }
inline u32 getFaceCulling() const noexcept { return fac; }
58,6 → 60,7
inline u32 getShadeModel() const noexcept { return shd; }
inline f32 getPointSize() const noexcept { return psize; }
inline render_mode getMode() const noexcept { return mode; }
inline u32 getWireframe() const noexcept { return wire; }
 
inline std::shared_ptr<identifier> getShader() const noexcept { return effect; }
 
65,8 → 68,8
public:
render_mode mode;
f32 psize;
u32 ant, mat, shd, fac;
math::vector3df scale;
u32 ant, mat, shd, fac, wire;
math::vec3f scale;
 
std::shared_ptr<identifier> effect;
};
/src/sleek/driver/mesh.cpp
6,8 → 6,7
{
MeshBuffer::MeshBuffer() noexcept
{
for(int i = 0; i<VBO_COUNT; ++i)
gpu[i] = nullptr;
gpu = nullptr;
}
 
MeshBuffer::~MeshBuffer() noexcept
14,14 → 13,14
{
}
 
void MeshBuffer::setIdentifier(VBO_BUFFER_TYPE t, std::shared_ptr<identifier> vbo) noexcept
void MeshBuffer::setIdentifier(std::shared_ptr<identifier> vbo) noexcept
{
gpu[t] = vbo;
gpu = vbo;
}
 
std::shared_ptr<identifier> MeshBuffer::getIdentifier(VBO_BUFFER_TYPE t) const noexcept
std::shared_ptr<identifier> MeshBuffer::getIdentifier() const noexcept
{
return gpu[t];
return gpu;
}
 
math::aabbox3df MeshBuffer::getBoundingBox() const noexcept
/src/sleek/driver/mesh.h
28,8 → 28,8
virtual void recalculateBoundingBox() noexcept;
virtual math::aabbox3df getBoundingBox() const noexcept;
 
virtual void setIdentifier(VBO_BUFFER_TYPE, std::shared_ptr<identifier>) noexcept;
virtual std::shared_ptr<identifier> getIdentifier(VBO_BUFFER_TYPE) const noexcept;
virtual void setIdentifier(std::shared_ptr<identifier>) noexcept;
virtual std::shared_ptr<identifier> getIdentifier() const noexcept;
 
std::vector<vertex> vertices;
std::vector<index<3>> indices;
38,9 → 38,9
friend class driver;
 
math::aabbox3df box;
math::vector3df scale;
math::vec3f scale;
 
std::shared_ptr<identifier> gpu[VBO_COUNT];
std::shared_ptr<identifier> gpu;
};
}
}
/src/sleek/driver/ogl3/ogl3.h
0,0 → 1,17
#define GL_GLEXT_LEGACY 1
#define GLEW_STATIC 1
#define GL3_PROTOTYPES 1
 
//#include <opengl/gl.h>
//#include <opengl/gl3.h>
#include <opengl/GLee.h>
//#include <opengl/glew.h>
 
#include <opengl/GLTool.h>
 
 
#if defined __linux
#include <GL/glx.h>
#elif defined WIN32 || WIN64
#include <windows.h>
#endif
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/sleek/driver/ogl3/ogl3_context.cpp
===================================================================
--- src/sleek/driver/ogl3/ogl3_context.cpp (nonexistent)
+++ src/sleek/driver/ogl3/ogl3_context.cpp (revision 22)
@@ -0,0 +1,357 @@
+#include "../../device/device.h"
+#include "ogl3_context.h"
+#include "ogl3_driver.h"
+#include "ogl3_texture.h"
+#include "ogl3_texture_array.h"
+#include "ogl3_texture_3d.h"
+#include "ogl3_vao.h"
+#include "ogl3_shader.h"
+#include <string.h>
+
+namespace sleek
+{
+ namespace driver
+ {
+ ogl3_context::ogl3_context(std::shared_ptr<device::Device> &d, std::shared_ptr<context> s) noexcept
+ : context(d, s), dsa(false), txarray(false), tx3d(false)
+ {
+ auto sogl = (s && s->getType() == RCTX_OGL3) ?
+ reinterpret_cast<ogl3_context*>(s.get()) : 0;
+
+ if(d->getType() != device::DWM_SDL)
+ {
+ #if defined __linux
+ cx = nullptr;
+
+ if(checkExtension("GLX_ARB_create_context") && d->getInfo().fbconfig)
+ {
+ typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
+ glXCreateContextAttribsARBProc glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc)glXGetProcAddressARB( (const GLubyte *) "glXCreateContextAttribsARB" );
+ if(glXCreateContextAttribsARB)
+ {
+ int context_attribs[] =
+ {
+ GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
+ GLX_CONTEXT_MINOR_VERSION_ARB, 1,
+ None
+ };
+
+ cx = glXCreateContextAttribsARB(
+ (Display*)d->getInfo().display,
+ *(GLXFBConfig*)d->getInfo().fbconfig,
+ 0, True, context_attribs
+ );
+
+ if(!cx)
+ printf("glXCreateContextAttribsARB failed\n");
+ }
+ }
+
+ if(!cx)
+ cx = glXCreateContext((Display*)d->getInfo().display, (XVisualInfo*)d->getInfo().visual, sogl ? sogl->cx : 0, GL_TRUE);
+
+ printf("Direct Rendering: %s\n", glXIsDirect((Display*)d->getInfo().display, cx) ? "Yes" : "No");
+ #elif defined WIN32 || WIN64
+ cx = wglCreateContext((HDC)d->getInfo().display);
+ #endif
+ }
+
+ bind();
+
+ printf("OpenGL version: %s\n",(char*)glGetString(GL_VERSION));
+ printf("OpenGL render: %s\n",(char*)glGetString(GL_RENDERER));
+ printf("OpenGL vendor: %s\n",(char*)glGetString(GL_VENDOR));
+
+ #if defined GL_VERSION_2_0 || defined GL_ARB_shader_objects
+ if(checkExtension("GL_ARB_shader_objects"))
+ {
+ printf("GLSL available: ");
+ if(checkExtension("GL_ARB_vertex_shader")) printf("vertex");
+ if(checkExtension("GL_ARB_fragment_shader")) printf("/fragment");
+ #if defined GL_ARB_geometry_shader4 || defined GL_EXT_geometry_shader4 || defined GL_NV_geometry_program4 || defined GL_NV_geometry_shader4
+ if(checkExtension("GL_ARB_geometry_shader4") ||
+ checkExtension("GL_EXT_geometry_shader4") ||
+ checkExtension("GL_NV_geometry_program4") ||
+ checkExtension("GL_NV_geometry_shader4"))
+ printf("/geometry\n");
+ else printf("\n");
+ #else
+ printf("\n");
+ #endif
+ }
+ else
+ {
+ printf("GLSL extention not found\n");
+ }
+ #else
+ printf("GLSL extention not compiled\n");
+ #endif
+
+ //!
+
+ if(checkExtension("GL_ARB_multitexture"))
+ {
+ int texture_unity = reserved_texture;
+ glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texture_unity);
+ glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB,&texture_unity);
+ printf("Max texture units initialized: %d\n", texture_unity);
+ }
+ else printf("GL_ARB_multitexture: test fail\n");
+
+ if(checkExtension("GL_EXT_direct_state_access"))
+ {
+ printf("GL_EXT_direct_state_access: Yes\n");
+ dsa = true;
+ }
+ else printf("GL_EXT_direct_state_access: No\n");
+
+ if(checkExtension("GL_EXT_texture_array"))
+ {
+ printf("GL_EXT_texture_array: Yes\n");
+ txarray = true;
+ }
+ else printf("GL_EXT_texture_array: No\n");
+
+ if(checkExtension("GL_EXT_texture3D"))
+ {
+ printf("GL_EXT_texture3D: Yes\n");
+ tx3d = true;
+ }
+ else printf("GL_EXT_texture3D: No\n");
+
+ printf("=========================================================================\n");
+ }
+
+ ogl3_context::~ogl3_context() noexcept
+ {
+ if(win->getType() != device::DWM_SDL)
+ {
+ #if defined __linux
+ glXDestroyContext((Display*)win->getInfo().display, cx);
+ #elif defined WIN32 || WIN64
+ wglDeleteContext(cx);
+ #endif
+ }
+ }
+
+ void ogl3_context::setAntialiasing(const AntiailiasingMode &i) noexcept
+ {
+ aam = i;
+ switch(i)
+ {
+ case DAM_FAST:
+ glHint(GL_FOG_HINT, GL_FASTEST);
+ glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
+ glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
+ glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
+ glHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
+ break;
+ case DAM_NICE:
+ glHint(GL_FOG_HINT, GL_NICEST);
+ glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
+ glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
+ glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
+ glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
+ break;
+ default:
+ glHint(GL_FOG_HINT, GL_DONT_CARE);
+ glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
+ glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE);
+ glHint(GL_POINT_SMOOTH_HINT, GL_DONT_CARE);
+ glHint(GL_POLYGON_SMOOTH_HINT, GL_DONT_CARE);
+ break;
+ }
+ }
+
+ void ogl3_context::setViewport(const math::vec2i& i) noexcept
+ {
+ viewport = i;
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+
+ glOrtho(0, i.x, 0, i.y, 0.f,1.f);
+ glViewport(0, 0, i.x, i.y);
+ testError(__LINE__, __FILE__);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ }
+
+ AntiailiasingMode ogl3_context::getAntiailiasing() const noexcept
+ {
+ return aam;
+ }
+
+ math::vec2i ogl3_context::getViewport() const noexcept
+ {
+ return viewport;
+ }
+
+ std::shared_ptr<driver> ogl3_context::createDriver() noexcept
+ {
+ return std::make_shared<ogl3_driver>(win, getptr());
+ }
+
+ std::shared_ptr<identifier> ogl3_context::createTexture(texture *o, bool DSA) const noexcept
+ {
+ if(dsa && DSA) return std::make_shared<ogl3_texture<true>>(o);
+ return std::make_shared<ogl3_texture<false>>(o);
+ }
+
+ std::shared_ptr<identifier> ogl3_context::createTextureArray(texture_array *o, bool DSA) const noexcept
+ {
+ if(dsa && DSA) return std::make_shared<ogl3_texture_array<true>>(o);
+ return std::make_shared<ogl3_texture_array<false>>(o);
+ }
+
+ std::shared_ptr<identifier> ogl3_context::createTexture3d(texture3d *o, bool DSA) const noexcept
+ {
+ if(dsa && DSA) return std::make_shared<ogl3_texture_3d<true>>(o);
+ return std::make_shared<ogl3_texture_3d<false>>(o);
+ }
+
+ std::shared_ptr<identifier> ogl3_context::createVAO(MeshBuffer *o, VAO_ALIGNMENT t, VAO_ALIGNMENT a, bool DSA) const noexcept
+ {
+ std::shared_ptr<identifier> tmp;
+
+ if(dsa && DSA) tmp = std::make_shared<ogl3_vao_identifer<true>>(o, t, a);
+ else tmp = std::make_shared<ogl3_vao_identifer<false>>(o, t, a);
+
+ o->setIdentifier(tmp);
+ return tmp;
+ }
+
+ std::shared_ptr<shader> ogl3_context::createShader(bool DSA) const noexcept
+ {
+ if(dsa && DSA) return std::make_shared<ogl3_shader<true>>();
+ return std::make_shared<ogl3_shader<false>>();
+ }
+
+ std::shared_ptr<texture> ogl3_context::createScreenshot(const math::aabbox2du &rec) const noexcept
+ {
+ auto tmp = std::make_shared<texture>(rec.getSize(), TXFMT_RGB);
+ glReadBuffer(GL_FRONT);
+ glReadPixels(
+ rec.upperleft.x, rec.upperleft.y,
+ rec.lowerright.x, rec.lowerright.y,
+ GL_RGB, GL_UNSIGNED_BYTE,
+ tmp->getBuffer()
+ );
+ glReadBuffer(GL_BACK);
+ return tmp;
+ }
+
+ bool ogl3_context::checkExtension(const char *name) noexcept
+ {
+ const GLubyte *extensions = NULL;
+ const GLubyte *debut;
+ GLubyte *place, *fin;
+
+ place = (GLubyte*)strchr(name, ' ');
+
+ if(place || *name == '\0')
+ return false;
+
+ extensions = glGetString(GL_EXTENSIONS);
+
+ #if defined __linux
+ if(!extensions)
+ extensions = (const GLubyte*)glXQueryExtensionsString(
+ (Display*)win->getInfo().display, 0
+ );
+ #else
+ #error TODO
+ #endif
+
+ if(!extensions)
+ {
+ printf("query extensions string failed\n");
+ return false;
+ }
+
+ debut = extensions;
+ for(;;)
+ {
+ place =(GLubyte *) strstr((const char *) debut, name);
+ if(!place) break;
+ fin = place + strlen(name);
+ if(place == debut || *(place - 1) == ' ')
+ if(*fin == ' ' || *fin == '\0')
+ return true;
+ debut = fin;
+ }
+
+ return false;
+ }
+
+ bool ogl3_context::testError(int line, const std::string &file) const noexcept
+ {
+ GLenum er;
+
+ while((er = glGetError()) != GL_NO_ERROR)
+ std::cerr << file.c_str() << ":" << line << " >> GL: " << GLErrorString(er) << std::endl;
+
+ return er != GL_NO_ERROR;
+ }
+
+ bool ogl3_context::testError() const noexcept
+ {
+ GLenum er;
+
+ while((er = glGetError()) != GL_NO_ERROR)
+ std::cerr << "GL:" << GLErrorString(er) << std::endl;
+
+ return er != GL_NO_ERROR;
+ }
+
+ bool ogl3_context::bind() noexcept
+ {
+ if(win->getType() == device::DWM_SDL)
+ return true;
+
+ #if defined __linux
+ return glXMakeCurrent(
+ (Display*)win->getInfo().display,
+ *(Window*)win->getInfo().window,
+ cx
+ );
+ #elif defined WIN32 || WIN64
+ return wglMakeCurrent(dc, gl);
+ #endif
+ }
+
+ void ogl3_context::begin(const math::pixel &color) noexcept
+ {
+ glEnable(GL_TEXTURE_2D);
+ glClearColor((f32)(color.red/255.f),(f32)(color.green/255.f),(f32)(color.blue/255.f),(f32)(color.alpha/255.f));
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ glPushMatrix();
+ glStencilFunc(GL_ALWAYS, 0x0, 0x4);
+ glStencilMask(0x4);
+ glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
+ glEnable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE0_ARB);
+ glColor4ub(255,255,255,255);
+ testError(__LINE__, __FILE__);
+ }
+
+ void ogl3_context::end() noexcept
+ {
+ testError(__LINE__, __FILE__);
+ glPopMatrix();
+ glFlush();
+
+ if(win->getType() != device::DWM_SDL)
+ {
+ #if defined __linux
+ glXSwapBuffers((Display*)win->getInfo().display, *(Window*)win->getInfo().window);
+ #elif defined WIN32 || WIN64
+ SwapBuffers(dc);
+ #endif
+ }
+
+ glDisable(GL_TEXTURE_2D);
+ }
+ }
+}
Index: src/sleek/driver/ogl3/ogl3_context.h
===================================================================
--- src/sleek/driver/ogl3/ogl3_context.h (nonexistent)
+++ src/sleek/driver/ogl3/ogl3_context.h (revision 22)
@@ -0,0 +1,61 @@
+#ifndef __OGL3_CONTEXT_HEADER__
+#define __OGL3_CONTEXT_HEADER__
+
+#include "ogl3.h"
+#include "../context.h"
+
+namespace sleek
+{
+ namespace driver
+ {
+ class ogl3_context : public context
+ {
+ public:
+ ogl3_context(std::shared_ptr<device::Device>&, std::shared_ptr<context> shared = nullptr) noexcept;
+ virtual ~ogl3_context() noexcept;
+
+ virtual RENDER_CONTEXT getType() const noexcept
+ {
+ return RCTX_OGL3;
+ }
+
+ virtual std::shared_ptr<driver> createDriver() noexcept;
+ virtual std::shared_ptr<texture> createScreenshot(const math::aabbox2du&) const noexcept;
+
+ virtual std::shared_ptr<identifier> createTexture(texture *o, bool dsa = true) const noexcept;
+ virtual std::shared_ptr<identifier> createTextureArray(texture_array*, bool dsa = true) const noexcept;
+ virtual std::shared_ptr<identifier> createTexture3d(texture3d*, bool dsa = true) const noexcept;
+
+ virtual std::shared_ptr<identifier> createVAO(MeshBuffer *o, VAO_ALIGNMENT t = VAO_STATIC, VAO_ALIGNMENT e = VAO_STATIC, bool dsa = true) const noexcept;
+ virtual std::shared_ptr<shader> createShader(bool dsa = true) const noexcept;
+
+ virtual void setViewport(const math::vec2i& i) noexcept;
+ virtual void setAntialiasing(const AntiailiasingMode &i) noexcept;
+
+ virtual AntiailiasingMode getAntiailiasing() const noexcept;
+ virtual math::vec2i getViewport() const noexcept;
+
+ bool testError(int line, const std::string &file) const noexcept;
+
+ virtual bool bind() noexcept;
+ virtual void begin(const math::pixel &clearcolor = math::pixel(0xFFAAFFFF)) noexcept;
+ virtual void end() noexcept;
+ protected:
+ math::vec2i viewport;
+ AntiailiasingMode aam;
+
+ #if defined __linux
+ GLXContext cx;
+ #elif defined WIN32 || WIN64
+ HGLRC cx;
+ #endif
+
+ bool checkExtension(const char *name) noexcept;
+ bool testError() const noexcept;
+ private:
+ bool dsa, txarray, tx3d;
+ };
+ }
+}
+
+#endif
/src/sleek/driver/ogl3/ogl3_context.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/sleek/driver/ogl3/ogl3_driver.cpp
===================================================================
--- src/sleek/driver/ogl3/ogl3_driver.cpp (nonexistent)
+++ src/sleek/driver/ogl3/ogl3_driver.cpp (revision 22)
@@ -0,0 +1,604 @@
+#include "../../device/device.h"
+#include "ogl3_context.h"
+#include "ogl3_driver.h"
+
+#include <cstddef>
+
+static const GLuint ogl3_render_mode[] =
+{
+ GL_POINTS,
+ GL_LINES,
+ GL_LINE_LOOP,
+ GL_TRIANGLES,
+ GL_QUADS
+};
+
+namespace sleek
+{
+ namespace driver
+ {
+ ogl3_driver::ogl3_driver(std::shared_ptr<device::Device> dev, std::shared_ptr<context> c) noexcept
+ : driver(dev, c)
+ {
+ quad = glGenLists(1);
+ quadc = glGenLists(1);
+ cubec = glGenLists(1);
+
+ glNewList(quad , GL_COMPILE);
+ glBegin(GL_QUADS);
+ glQuad();
+ glEnd();
+ glEndList();
+
+ glNewList(quadc, GL_COMPILE);
+ glBegin(GL_QUADS);
+ glQuadCenter();
+ glEnd();
+ glEndList();
+
+ glNewList(quadc, GL_COMPILE);
+ glBegin(GL_QUADS);
+ glCubeCenter();
+ glEnd();
+ glEndList();
+
+ setActiveMaterial(mat);
+ }
+
+ ogl3_driver::~ogl3_driver() noexcept
+ {
+ glDeleteLists(quad , 1);
+ glDeleteLists(quadc, 1);
+ glDeleteLists(cubec, 1);
+ }
+
+ void ogl3_driver::beginTo2D() const noexcept
+ {
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0, src->getInfo().size.x, src->getInfo().size.y, 0, -1.f, 1.f);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ }
+
+ void ogl3_driver::endFrom2D() const noexcept
+ {
+ glEnable(GL_DEPTH_TEST);
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ }
+
+ void ogl3_driver::ObjectRenderBegin() const noexcept
+ {
+ glPushMatrix();
+ if(mat && mat->effect)
+ mat->effect->update();
+ ctx->testError(-1, "shader_callback");
+ glColor4ub(255,255,255,255);
+ }
+
+ void ogl3_driver::ObjectRenderEnd() const noexcept
+ {
+ glPopMatrix();
+ }
+
+ void ogl3_driver::drawPixel(const math::vec2i pos, const math::pixel clr) const noexcept
+ {
+ ObjectRenderBegin();
+ beginTo2D();
+ glColor4ub(clr.red, clr.green, clr.blue, clr.alpha);
+ glBegin(GL_POINTS);
+ glVertex2f(pos.x, pos.y);
+ glEnd();
+ endFrom2D();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawPixel(const math::vec3f pos, const math::pixel clr) const noexcept
+ {
+ if(!src->ready()) return;
+ ObjectRenderBegin();
+ glColor4ub(clr.red, clr.green, clr.blue, clr.alpha);
+ glBegin(GL_POINTS);
+ glVertex3f(pos.x, pos.y, pos.z);
+ glEnd();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawLine(const math::vec2i a, const math::vec2i b, const math::pixel clr) const noexcept
+ {
+ if(!src->ready()) return;
+ ObjectRenderBegin();
+ beginTo2D();
+ glBegin(GL_LINES);
+ glColor4ub(clr.red, clr.green, clr.blue, clr.alpha);
+ glVertex2f(a.x, a.y);
+ glVertex2f(b.x, b.y);
+ glEnd();
+ endFrom2D();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawLine(const math::vec3f a, const math::vec3f b, const math::pixel clr) const noexcept
+ {
+ if(!src->ready()) return;
+ ObjectRenderBegin();
+ glBegin(GL_LINES);
+ glColor4ub(clr.red, clr.green, clr.blue, clr.alpha);
+ glVertex3f(a.x, a.y, a.z);
+ glVertex3f(b.x, b.y, b.z);
+ glEnd();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawArc(const math::vec2i pos, u32 radius, u32 start, u32 end, const math::pixel clr) const noexcept
+ {
+ if(!src->ready()) return;
+ f32 p = sqrt(radius*radius);
+ math::vec2i vdata[] = { math::vec2i(sin(start*DegToRad)*radius+pos.x, cos(start*DegToRad)*radius+pos.y), pos };
+ for(f32 i = start+p; i<end+p; i += p)
+ {
+ vdata[1] = math::vec2i(sin(i*DegToRad)*radius+pos.x, cos(i*DegToRad)*radius+pos.y);
+ drawLine(vdata[0], vdata[1], clr);
+ vdata[0] = vdata[1];
+ }
+ }
+
+ void ogl3_driver::drawCube(const math::aabbox2di c, const math::vec3f rot, const math::pixel upperleft, const math::pixel upperright, const math::pixel lowerleft, const math::pixel lowerright) const noexcept
+ {
+ if(!src->ready()) return;
+ math::vec2i pos = c.getCenter();
+
+ ObjectRenderBegin();
+ beginTo2D();
+ glTranslatef(pos.x,pos.y,0);
+ glRotatef(rot.x,rot.y,rot.z);
+ glScalef(c.getSize().x, c.getSize().y,1);
+
+ glBegin(ogl3_render_mode[mat->getMode()]);
+ glNormal3f(0,0,0);
+
+ glColor4ub(lowerleft.red, lowerleft.green, lowerleft.blue, lowerleft.alpha);
+ glTexCoord3i(0,0,0);
+ glVertex3f(-0.5f, 0.5f,0);
+
+ glColor4ub(upperleft.red, upperleft.green, upperleft.blue, upperleft.alpha);
+ glTexCoord3i(0,1,0);
+ glVertex3f(-0.5f,-0.5f,0);
+
+ glColor4ub(upperright.red, upperright.green, upperright.blue, upperright.alpha);
+ glTexCoord3i(1,1,0);
+ glVertex3f( 0.5f,-0.5f,0);
+
+ glColor4ub(lowerright.red, lowerright.green, lowerright.blue, lowerright.alpha);
+ glTexCoord3i(1,0,0);
+ glVertex3f( 0.5f, 0.5f,0);
+
+ glEnd();
+ endFrom2D();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawCube(const math::aabbox2di c, const math::vec3f rot, const math::pixel clr) const noexcept
+ {
+ if(!src->ready()) return;
+ math::vec2i pos = c.getCenter();
+
+ ObjectRenderBegin();
+ beginTo2D();
+ glTranslatef(pos.x,pos.y,0);
+ glRotatef(rot.x,rot.y,rot.z);
+ glScalef(c.getSize().x, c.getSize().y,1);
+ glBegin(ogl3_render_mode[mat->getMode()]);
+ glColor4ub(clr.red, clr.green, clr.blue, clr.alpha);
+ glQuadCenter();
+ glEnd();
+ endFrom2D();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawCube(const math::aabbox3df c, const math::vec3f rot, const math::pixel clr) const noexcept
+ {
+ if(!src->ready()) return;
+ math::vec3f pos = c.getCenter();
+
+ ObjectRenderBegin();
+ glTranslatef(pos.x,pos.y,pos.z);
+ glRotatef(rot.x,rot.y,rot.z);
+ glScalef(c.getSize().x, c.getSize().y, c.getSize().z);
+ glBegin(GL_QUADS);
+ glColor4ub(clr.red, clr.green, clr.blue, clr.alpha);
+ glCubeCenter();
+ glEnd();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawCube(const math::vec2i a, const math::vec2i b, const math::vec3f rot, const math::pixel clr) const noexcept
+ {
+ drawCube(math::aabbox2di(a,b), rot, clr);
+ }
+
+ void ogl3_driver::drawCube(const math::vec3f a, const math::vec3f b, const math::vec3f rot, const math::pixel clr) const noexcept
+ {
+ drawCube(math::aabbox3df(a,b), rot, clr);
+ }
+
+ void ogl3_driver::drawCircle(const math::vec2i pos, u32 radius, const math::pixel clr) const noexcept
+ {
+ f32 p = sqrt(radius*radius);
+ math::vec2i start = math::vec2i(sin(0*DegToRad)*radius, cos(0*DegToRad)*radius);
+ for(register f32 i = 0; i<360; i += 12)
+ {
+ math::vec2i end = math::vec2i(sin(i*DegToRad)*radius, cos(i*DegToRad)*radius);
+ drawLine(start+pos, end+pos, clr);
+ start = end;
+ }
+ }
+
+ void ogl3_driver::drawPolygon(const math::vec2i a, const math::vec2i b, const math::vec2i c, const math::pixel clr) const noexcept
+ {
+ drawLine(a, b, clr);
+ drawLine(b, c, clr);
+ drawLine(c, a, clr);
+ }
+
+ void ogl3_driver::drawPolygon(const math::vec3f a, const math::vec3f b, const math::vec3f c, const math::pixel clr) const noexcept
+ {
+ drawLine(a, b, clr);
+ drawLine(b, c, clr);
+ drawLine(c, a, clr);
+ }
+
+ void ogl3_driver::drawPolygonList(const math::vec2i *a, u32 n, const math::vec2i pos, const math::vec3f rot, const math::pixel clr) const noexcept
+ {
+ ObjectRenderBegin();
+ beginTo2D();
+ glTranslatef(pos.x,pos.y,0);
+ glRotatef(rot.x,rot.y,rot.z);
+ glBegin(ogl3_render_mode[mat->getMode()]);
+ glColor4ub(clr.red, clr.green, clr.blue, clr.alpha);
+ for(u32 i = 0; i< n; ++i)
+ glVertex2f(a[i].x,a[i].y);
+ glEnd();
+ endFrom2D();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawPolygonList(const math::vec3f *a, u32 n, const math::vec3f pos, const math::vec3f rot, const math::pixel clr) const noexcept
+ {
+ ObjectRenderBegin();
+ glTranslatef(pos.x,pos.y,pos.z);
+ glRotatef(rot.x,rot.y,rot.z);
+ glBegin(ogl3_render_mode[mat->getMode()]);
+ glColor4ub(clr.red, clr.green, clr.blue, clr.alpha);
+ for(u32 i = 0; i< n; ++i)
+ glVertex3f(a[i].x,a[i].y, a[i].z);
+ glEnd();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawFBO(fbo *tex) const noexcept
+ {
+ ObjectRenderBegin();
+ beginTo2D();
+ glEnable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE0_ARB);
+ tex->bind();
+ glColor4ub(255,255,255,255);
+ glTranslatef(0,0,0);
+ glScalef(tex->getSize().x,tex->getSize().y,1);
+ glCallList(quad);
+ glDisable(GL_TEXTURE_2D);
+ endFrom2D();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawTexture(texture *tex, const math::vec2i pos, const math::vec3f rot, const math::vec2f uv) const noexcept
+ {
+ ObjectRenderBegin();
+ beginTo2D();
+ glEnable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE0_ARB);
+ tex->getIdentifier()->bind();
+ glColor4ub(255,255,255,255);
+ glTranslatef(pos.x,pos.y,0);
+ glRotatef(rot.x,rot.y,rot.z);
+ glScalef(tex->getOriginalSize().x,tex->getOriginalSize().y,1);
+ glBegin(GL_QUADS);
+ glNormal3f(0,0,0);
+ glTexCoord3f(0,0,0); glVertex3f(0,0,0);
+ glTexCoord3f(uv.x,0,0); glVertex3f(1,0,0);
+ glTexCoord3f(uv.x,uv.y,0); glVertex3f(1,1,0);
+ glTexCoord3f(0,uv.y,0); glVertex3f(0,1,0);
+ glEnd();
+ tex->getIdentifier()->unbind();
+ endFrom2D();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawTexture(texture *tex, const math::vec3f pos, const math::vec3f rot, const math::vec2f uv) const noexcept
+ {
+ ObjectRenderBegin();
+ glEnable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE0_ARB);
+ tex->getIdentifier()->bind();
+ glColor4ub(255,255,255,255);
+ glTranslatef(pos.x,pos.y,pos.z);
+ glRotatef(rot.x,rot.y,rot.z);
+ glScalef(tex->getOriginalSize().x,tex->getOriginalSize().y,1);
+ glBegin(GL_QUADS);
+ glNormal3f(0,0,0);
+ glTexCoord3f(0,uv.y,0); glVertex3f(-0.5f,-0.5f,0);
+ glTexCoord3f(uv.x,uv.y,0); glVertex3f( 0.5f,-0.5f,0);
+ glTexCoord3f(uv.x,0,0); glVertex3f( 0.5f, 0.5f,0);
+ glTexCoord3f(0,0,0); glVertex3f(-0.5f, 0.5f,0);
+ glEnd();
+ tex->getIdentifier()->unbind();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawTextureScale(texture *tex, const math::vec2i pos, const math::vec3f rot, const math::vec3f scl, const math::vec2f uv) const noexcept
+ {
+ ObjectRenderBegin();
+ beginTo2D();
+ glEnable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE0_ARB);
+ tex->getIdentifier()->bind();
+ glColor4ub(255,255,255,255);
+ glTranslatef(pos.x,pos.y,0);
+ glRotatef(rot.x,rot.y,rot.z);
+ glScalef(scl.x,scl.y,scl.z);
+ glBegin(GL_QUADS);
+ glNormal3f(0,0,0);
+ glTexCoord3f(0,0,0); glVertex3f(0,0,0);
+ glTexCoord3f(uv.x,0,0); glVertex3f(1,0,0);
+ glTexCoord3f(uv.x,uv.y,0); glVertex3f(1,1,0);
+ glTexCoord3f(0,uv.y,0); glVertex3f(0,1,0);
+ glEnd();
+ tex->getIdentifier()->unbind();
+ endFrom2D();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawTextureScale(texture *tex, const math::vec3f pos, const math::vec3f rot, const math::vec3f scl, const math::vec2f uv) const noexcept
+ {
+ ObjectRenderBegin();
+ glEnable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE0_ARB);
+ tex->getIdentifier()->bind();
+ glColor4ub(255,255,255,255);
+ glTranslatef(pos.x,pos.y,pos.z);
+ glRotatef(rot.x,rot.y,rot.z);
+ glScalef(scl.x,scl.y,scl.z);
+ glBegin(GL_QUADS);
+ glNormal3f(0,0,0);
+ glTexCoord3f(0,uv.y,0); glVertex3f(-0.5f,-0.5f,0);
+ glTexCoord3f(uv.x,uv.y,0); glVertex3f( 0.5f,-0.5f,0);
+ glTexCoord3f(uv.x,0,0); glVertex3f( 0.5f, 0.5f,0);
+ glTexCoord3f(0,0,0); glVertex3f(-0.5f, 0.5f,0);
+ glEnd();
+ tex->getIdentifier()->unbind();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawTextureCenter(texture *tex, const math::vec2i pos, const math::vec3f rot, const math::vec2f uv) const noexcept
+ {
+ ObjectRenderBegin();
+ beginTo2D();
+ glEnable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE0_ARB);
+ tex->getIdentifier()->bind();
+ glColor4ub(255,255,255,255);
+ glTranslatef(pos.x,pos.y,0);
+ glRotatef(rot.x,rot.y,rot.z);
+ glScalef(tex->getOriginalSize().x,tex->getOriginalSize().y,1);
+ glBegin(GL_QUADS);
+ glNormal3f(0,0,0);
+ glTexCoord3f(0,uv.y,0); glVertex3f(-0.5f,-0.5f,0);
+ glTexCoord3f(uv.x,uv.y,0); glVertex3f( 0.5f,-0.5f,0);
+ glTexCoord3f(uv.x,0,0); glVertex3f( 0.5f, 0.5f,0);
+ glTexCoord3f(0,0,0); glVertex3f(-0.5f, 0.5f,0);
+ glEnd();
+ tex->getIdentifier()->unbind();
+ endFrom2D();
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawTextureCenter(texture *tex, const math::vec3f pos, const math::vec3f rot, const math::vec2f uv) const noexcept
+ {
+ ObjectRenderBegin();
+ glEnable(GL_TEXTURE_2D);
+ glActiveTexture(GL_TEXTURE0_ARB);
+ tex->getIdentifier()->bind();
+ glColor4ub(255,255,255,255);
+ glTranslatef(pos.x,pos.y,pos.z);
+ glRotatef(rot.x,rot.y,rot.z);
+ glScalef(tex->getOriginalSize().x,tex->getOriginalSize().y,1);
+ glBegin(GL_QUADS);
+ glNormal3f(0,0,1);
+ glTexCoord3f(0,uv.y,0); glVertex3f(-0.5f,-0.5f,0);
+ glTexCoord3f(uv.x,uv.y,0); glVertex3f( 0.5f,-0.5f,0);
+ glTexCoord3f(uv.x,0,0); glVertex3f( 0.5f, 0.5f,0);
+ glTexCoord3f(0,0,0); glVertex3f(-0.5f, 0.5f,0);
+ glEnd();
+ glDisable(GL_TEXTURE_2D);
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::drawMesh(MeshBuffer *m, const math::vec3f pos, const math::vec3f rot) const noexcept
+ {
+ ObjectRenderBegin();
+ glColor4ub(255,255,255,255);
+ glTranslatef(pos.x,pos.y,pos.z);
+ glRotatef(rot.x,rot.y,rot.z);
+ glScalef(mat->getScale().x,mat->getScale().y,mat->getScale().z);
+
+ local_bind vao(m->getIdentifier());
+
+ void *iptr = vao.ifNotBind(m->indices.data());
+ void *vptr = vao.ifNotBind(m->vertices.data());
+
+ ctx->testError(__LINE__, __FILE__);
+ if(!vao.bind)
+ {
+ glEnableClientState(GL_NORMAL_ARRAY);
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_COLOR_ARRAY);
+ glEnableClientState(GL_INDEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+
+ glVertexPointer(3, GL_FLOAT, sizeof(vertex), vptr + offsetof(vertex, Pos));
+ glNormalPointer(GL_FLOAT, sizeof(vertex), vptr + offsetof(vertex, Normal));
+ glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(vertex), vptr + offsetof(vertex, Color));
+ glTexCoordPointer(2, GL_FLOAT, sizeof(vertex), vptr + offsetof(vertex, Coord));
+
+ glDrawElements(ogl3_render_mode[mat->getMode()], m->indices.size()*3, GL_UNSIGNED_INT, iptr);
+
+ glDisableClientState(GL_COLOR_ARRAY);
+ glDisableClientState(GL_INDEX_ARRAY);
+ glDisableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ }
+ else
+ {
+ glDrawElements(ogl3_render_mode[mat->getMode()], m->indices.size()*3, GL_UNSIGNED_INT, iptr);
+ }
+
+ ctx->testError(__LINE__, __FILE__);
+
+ ObjectRenderEnd();
+ }
+
+ void ogl3_driver::setActiveMaterial(std::shared_ptr<material> i) noexcept
+ {
+ ctx->testError(__LINE__, __FILE__);
+ static void(*_glState[2])(GLenum) = {&glDisable, &glEnable};
+
+ if(mat)
+ {
+ if(mat->effect)
+ mat->effect->unbind();
+ else
+ {
+ int start = i ? i->Texture.size() : 0;
+ for(int stage = start; stage<mat->Texture.size(); ++stage)
+ {
+ glActiveTexture(GL_TEXTURE0_ARB+stage);
+ if(mat->Texture[stage])
+ mat->Texture[stage]->unbind();
+ }
+ }
+ }
+
+ _glState[bool(i.get())](GL_BLEND);
+ ctx->testError(__LINE__, __FILE__);
+
+ if(i)
+ {
+ _glState[bool(i->ant & ral_polygone)](GL_POLYGON_SMOOTH);
+ _glState[bool(i->ant & ral_line)](GL_LINE_SMOOTH);
+ _glState[bool(i->mat & rmt_solid)](GL_DEPTH_TEST);
+ _glState[bool(i->mat & rmt_lighting)](GL_LIGHTING);
+ _glState[bool(i->mat & rmt_fog)](GL_FOG);
+ _glState[bool(i->fac != rfc_off)](GL_CULL_FACE);
+
+ glShadeModel(i->shd & rsd_flat ? GL_FLAT : GL_SMOOTH);
+
+ if(!mat || mat->psize != i->psize)
+ {
+ // deprecated & performance cost
+ glPointSize(i->psize);
+ glLineWidth(i->psize);
+ }
+
+ glPolygonMode(GL_FRONT_AND_BACK, i->wire ? GL_LINE : GL_FILL);
+
+ /////////////////////////////////////////
+
+ static const GLenum _wire[] = {
+ GL_FILL, GL_LINE
+ };
+
+ static const GLenum _cull[] = {
+ 0, GL_BACK,
+ GL_FRONT, 0,
+ GL_FRONT_AND_BACK
+ };
+
+ //if(!mat || mat->wire != i->wire)
+ // glPolygonMode(_cull[i->fac], _wire[i->wire]);
+
+ if(i->fac != rfc_off && (!mat || mat->fac != i->fac))
+ glCullFace(_cull[i->fac]);
+
+ /////////////////////////////////////////
+
+ if(!mat || mat->mat != i->mat)
+ {
+ if(i->mat == rmt_solid)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ else if(i->mat == rmt_add)
+ glBlendFunc(GL_ONE, GL_ONE);
+ else if(i->mat == rmt_sub)
+ glBlendFunc(GL_ONE_MINUS_SRC_COLOR, GL_ZERO);
+ else
+ glBlendFunc(GL_ONE, GL_ZERO);
+ }
+
+ /////////////////////////////////////////
+ ctx->testError(__LINE__, __FILE__);
+ /////////////////////////////////////////
+
+ if(i->effect)
+ i->effect->bind();
+ else
+ {
+ int stage = 0;
+ if(mat)
+ {
+ int end = std::min(mat->Texture.size(), i->Texture.size());
+ for(; stage<end; ++stage)
+ {
+ if(i->Texture[stage] == mat->Texture[stage])
+ continue;
+
+ glActiveTextureARB(GL_TEXTURE0_ARB+stage);
+
+ if(i->Texture[stage])
+ i->Texture[stage]->bind();
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD);
+ }
+ }
+
+ ctx->testError(__LINE__, __FILE__);
+
+ for(; stage<i->Texture.size(); ++stage)
+ {
+ glActiveTextureARB(GL_TEXTURE0_ARB+stage);
+
+ if(i->Texture[stage])
+ i->Texture[stage]->bind();
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD);
+ }
+ }
+ }
+
+ ctx->testError(__LINE__, __FILE__);
+ mat = i;
+ }
+
+ std::shared_ptr<material> ogl3_driver::getActiveMaterial() const noexcept
+ {
+ return mat;
+ }
+ }
+}
Index: src/sleek/driver/ogl3/ogl3_driver.h
===================================================================
--- src/sleek/driver/ogl3/ogl3_driver.h (nonexistent)
+++ src/sleek/driver/ogl3/ogl3_driver.h (revision 22)
@@ -0,0 +1,68 @@
+#ifndef OGL3_DRIVER
+#define OGL3_DRIVER
+
+#include "ogl3.h"
+#include "../driver.h"
+
+namespace sleek
+{
+ namespace device
+ {
+ class Device;
+ }
+ namespace driver
+ {
+ class ogl3_driver : public driver
+ {
+ public:
+ ogl3_driver(std::shared_ptr<device::Device>, std::shared_ptr<context>) noexcept;
+ virtual ~ogl3_driver() noexcept;
+
+ virtual void drawPixel(const math::vec2i, const math::pixel c = {}) const noexcept;
+ virtual void drawPixel(const math::vec3f, const math::pixel c = {}) const noexcept;
+ virtual void drawLine(const math::vec2i, const math::vec2i, const math::pixel c = {}) const noexcept;
+ virtual void drawLine(const math::vec3f, const math::vec3f, const math::pixel c = {}) const noexcept;
+ virtual void drawArc(const math::vec2i, u32, u32, u32, const math::pixel c = {}) const noexcept;
+
+ virtual void drawCube(const math::aabbox2di, const math::vec3f rot, const math::pixel upperleft, const math::pixel upperright, const math::pixel lowerleft, const math::pixel lowerright) const noexcept;
+ virtual void drawCube(const math::aabbox2di, const math::vec3f rot = {0, 0, 0}, const math::pixel c = {}) const noexcept;
+ virtual void drawCube(const math::aabbox3df, const math::vec3f rot = {0, 0, 0}, const math::pixel c = {}) const noexcept;
+ virtual void drawCube(const math::vec2i, const math::vec2i, const math::vec3f rot = {0, 0, 0}, const math::pixel c = {}) const noexcept;
+ virtual void drawCube(const math::vec3f, const math::vec3f, const math::vec3f rot = {0, 0, 0}, const math::pixel c = {}) const noexcept;
+
+ virtual void drawCircle(const math::vec2i pos, u32 radius = 5.f, const math::pixel c = {}) const noexcept;
+
+ virtual void drawPolygon(const math::vec2i, const math::vec2i, const math::vec2i, const math::pixel c = {}) const noexcept;
+ virtual void drawPolygon(const math::vec3f, const math::vec3f, const math::vec3f, const math::pixel c = {}) const noexcept;
+ virtual void drawPolygonList(const math::vec2i *a, u32 n, const math::vec2i, const math::vec3f rot = {0, 0, 0}, const math::pixel c = {}) const noexcept;
+ virtual void drawPolygonList(const math::vec3f *a, u32 n, const math::vec3f, const math::vec3f rot = {0, 0, 0}, const math::pixel c = {}) const noexcept;
+
+ virtual void drawFBO(fbo*) const noexcept;
+
+ virtual void drawTexture(texture*, const math::vec2i pos = {0, 0}, const math::vec3f rot = {0, 0, 0}, const math::vec2f uv = {1.f, 1.f}) const noexcept;
+ virtual void drawTexture(texture*, const math::vec3f pos = {0, 0, 0}, const math::vec3f rot = {0, 0, 0}, const math::vec2f uv = {1.f, 1.f}) const noexcept;
+
+ virtual void drawTextureCenter(texture*, const math::vec2i pos = {0, 0}, const math::vec3f rot = {0, 0, 0}, const math::vec2f uv = {1.f, 1.f}) const noexcept;
+ virtual void drawTextureCenter(texture*, const math::vec3f pos = {0, 0, 0}, const math::vec3f rot = {0, 0, 0}, const math::vec2f uv = {1.f, 1.f}) const noexcept;
+
+ virtual void drawTextureScale(texture*, const math::vec2i pos = {0, 0}, const math::vec3f rot = {0, 0, 0}, const math::vec3f scl = {0, 0, 0}, const math::vec2f uv = {1.f, 1.f}) const noexcept;
+ virtual void drawTextureScale(texture*, const math::vec3f pos = {0, 0, 0}, const math::vec3f rot = {0, 0, 0}, const math::vec3f scl = {0, 0, 0}, const math::vec2f uv = {1.f, 1.f}) const noexcept;
+
+ virtual void drawMesh(MeshBuffer*, math::vec3f, math::vec3f rot = {0, 0, 0}) const noexcept;
+
+ virtual void setActiveMaterial(std::shared_ptr<material>) noexcept;
+ virtual std::shared_ptr<material> getActiveMaterial() const noexcept;
+
+ virtual void ObjectRenderBegin() const noexcept;
+ virtual void ObjectRenderEnd() const noexcept;
+
+ virtual void beginTo2D() const noexcept;
+ virtual void endFrom2D() const noexcept;
+ protected:
+ //display list (quad and point render accelerator)
+ GLuint quad, quadc, cubec;
+ };
+ }
+}
+
+#endif
/src/sleek/driver/ogl3/ogl3_driver.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/sleek/driver/ogl3/ogl3_fbo.cpp
===================================================================
--- src/sleek/driver/ogl3/ogl3_fbo.cpp (nonexistent)
+++ src/sleek/driver/ogl3/ogl3_fbo.cpp (revision 22)
@@ -0,0 +1,164 @@
+#include "ogl3_fbo.h"
+
+namespace sleek
+{
+ namespace driver
+ {
+ static const GLuint ogl3_fbo_attachment[] = {
+ GL_COLOR_ATTACHMENT0_EXT,
+ GL_COLOR_ATTACHMENT1_EXT,
+ GL_COLOR_ATTACHMENT2_EXT,
+ GL_COLOR_ATTACHMENT3_EXT,
+ GL_COLOR_ATTACHMENT4_EXT,
+ GL_COLOR_ATTACHMENT5_EXT,
+ GL_COLOR_ATTACHMENT6_EXT,
+ GL_COLOR_ATTACHMENT7_EXT,
+ GL_COLOR_ATTACHMENT8_EXT,
+ GL_COLOR_ATTACHMENT9_EXT,
+ GL_COLOR_ATTACHMENT10_EXT,
+ GL_COLOR_ATTACHMENT11_EXT,
+ GL_COLOR_ATTACHMENT12_EXT,
+ GL_COLOR_ATTACHMENT13_EXT,
+ GL_COLOR_ATTACHMENT14_EXT,
+ GL_COLOR_ATTACHMENT15_EXT,
+ GL_DEPTH_ATTACHMENT_EXT,
+ GL_STENCIL_ATTACHMENT_EXT
+ };
+
+ template<>
+ ogl3_fbo<false>::ogl3_fbo(device::Device *mom, const math::vec2i &i, std::vector<FBO_ATTACHMENT> a) noexcept : fbo(mom, i, a)
+ {
+ glGenFramebuffersEXT(1, &framebuffer);
+ glGenRenderbuffersEXT(1, &depthbuffer);
+
+ glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, framebuffer);
+ glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, size.x, size.y);
+ status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
+
+ switch(status)
+ {
+ case GL_FRAMEBUFFER_COMPLETE_EXT: break;
+ case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
+ printf("GL_FRAMEBUFFER_UNSUPPORTED_EXT!\n");
+ return;
+ break;
+ default:
+ return;
+ }
+
+ for(int i = 0; i<attachment.size(); ++i)
+ {
+ GLuint texture;
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, size.x, size.y, 0, GL_BGR, GL_UNSIGNED_BYTE, 0);
+ textures.push_back(texture);
+ }
+ }
+
+ template<>
+ ogl3_fbo<true>::ogl3_fbo(device::Device *mom, const math::vec2i &i, std::vector<FBO_ATTACHMENT> a) noexcept : fbo(mom, i, a)
+ {
+ glGenFramebuffersEXT(1, &framebuffer);
+ glGenRenderbuffersEXT(1, &depthbuffer);
+
+ glNamedRenderbufferStorageEXT(framebuffer, GL_DEPTH_COMPONENT24, size.x, size.y);
+ status = glCheckNamedFramebufferStatusEXT(framebuffer, GL_FRAMEBUFFER_EXT);
+
+ switch(status)
+ {
+ case GL_FRAMEBUFFER_COMPLETE_EXT: break;
+ case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
+ printf("GL_FRAMEBUFFER_UNSUPPORTED_EXT!\n");
+ return;
+ break;
+ default:
+ return;
+ }
+
+ for(int i = 0; i<attachment.size(); ++i)
+ {
+ GLuint texture;
+ glGenTextures(1, &texture);
+ glTextureParameteriEXT(texture, GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTextureParameteriEXT(texture, GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTextureParameteriEXT(texture, GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTextureParameteriEXT(texture, GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTextureImage2DEXT(texture, GL_TEXTURE_2D, 0, GL_RGB, size.x, size.y, 0, GL_BGR, GL_UNSIGNED_BYTE, 0);
+ textures.push_back(texture);
+ }
+ }
+
+ template<bool dsa>
+ ogl3_fbo<dsa>::~ogl3_fbo() noexcept
+ {
+ glDeleteRenderbuffersEXT(1, &depthbuffer);
+ glDeleteFramebuffersEXT(1, &framebuffer);
+
+ for(int i = 0; i<textures.size(); ++i)
+ glDeleteTextures(1, &textures[i]);
+ }
+
+ template<bool dsa>
+ void* ogl3_fbo<dsa>::getHardwareLink() const noexcept
+ {
+ return (GLuint*)&framebuffer;
+ }
+
+ template<>
+ void ogl3_fbo<false>::update() const noexcept
+ {
+ if(!enabled)
+ return;
+
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer);
+ glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthbuffer);
+
+ for(int i = 0; i<textures.size(); ++i)
+ {
+ glFramebufferTexture2DEXT(
+ GL_FRAMEBUFFER_EXT,
+ ogl3_fbo_attachment[attachment[i]],
+ GL_TEXTURE_2D, textures[i], 0
+ );
+ }
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ }
+
+ template<>
+ void ogl3_fbo<true>::update() const noexcept
+ {
+ if(!enabled) return;
+ glNamedFramebufferRenderbufferEXT(framebuffer, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthbuffer);
+
+ for(int i = 0; i<textures.size(); ++i)
+ {
+ glNamedFramebufferTexture2DEXT(
+ framebuffer,
+ ogl3_fbo_attachment[attachment[i]],
+ GL_TEXTURE_2D, textures[i], 0
+ );
+ }
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ }
+
+ template<bool dsa>
+ void ogl3_fbo<dsa>::bind() const noexcept
+ {
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer);
+ }
+
+ template<bool dsa>
+ void ogl3_fbo<dsa>::unbind() const noexcept
+ {
+ if(!enabled) return;
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+ }
+ }
+}
/src/sleek/driver/ogl3/ogl3_fbo.cpp
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/sleek/driver/ogl3/ogl3_fbo.h
===================================================================
--- src/sleek/driver/ogl3/ogl3_fbo.h (nonexistent)
+++ src/sleek/driver/ogl3/ogl3_fbo.h (revision 22)
@@ -0,0 +1,33 @@
+#ifndef OGL3_FBO
+#define OGL3_FBO
+
+#include "ogl3.h"
+#include "../fbo.h"
+
+namespace sleek
+{
+ namespace driver
+ {
+ template<bool dsa>
+ class ogl3_fbo : public fbo
+ {
+ public:
+ ogl3_fbo(device::Device*, const math::vec2i &size, std::vector<FBO_ATTACHMENT>) noexcept;
+ virtual ~ogl3_fbo() noexcept;
+
+ virtual void* getHardwareLink() const noexcept;
+
+ virtual void update() const noexcept;
+ virtual void bind() const noexcept;
+ virtual void unbind() const noexcept;
+ protected:
+ GLenum status;
+ GLuint framebuffer;
+ GLuint depthbuffer;
+ std::vector<GLuint> textures;
+ private:
+ };
+ }
+}
+
+#endif
/src/sleek/driver/ogl3/ogl3_fbo.h
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/sleek/driver/ogl3/ogl3_shader.cpp
===================================================================
--- src/sleek/driver/ogl3/ogl3_shader.cpp (nonexistent)
+++ src/sleek/driver/ogl3/ogl3_shader.cpp (revision 22)
@@ -0,0 +1,442 @@
+#include "../material.h"
+#include "ogl3_shader.h"
+#include <stdlib.h>
+#include <string.h>
+
+#define GL_GEOMETRY_SHADER 0x8DD9
+
+
+static const char* const defaultFragmentShader =
+ "void main(void)"
+ "{"
+ " gl_FragColor = gl_Color;"
+ "}";
+
+static const char* const defaultVertexShader =
+ "void main(void)"
+ "{"
+ " gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;"
+ "}";
+
+static const char* const defaultGeometryShader =
+ "#version 330\n"
+ "void main()"
+ "{"
+ " for(int i = 0; i < gl_in.length(); i++)"
+ " {"
+ " gl_Position = gl_in[i].gl_Position;"
+ " EmitVertex();"
+ " }"
+ " EndPrimitive();"
+ "}";
+
+namespace sleek
+{
+ namespace driver
+ {
+ inline void Print_GLSL_Error(const GLuint shad) noexcept
+ {
+ #ifdef __linux
+ GLsizei logsize = 0;
+ char *log = NULL;
+ glGetShaderiv(shad, GL_INFO_LOG_LENGTH, &logsize);
+ log = new char[logsize];
+ glGetShaderInfoLog(shad, logsize, &logsize, log);
+ printf("%s\n", log);
+ delete[] log;
+ #endif
+ }
+ inline void Print_PROG_Error(const GLuint prog) noexcept
+ {
+ #ifdef __linux
+ char *log = NULL;
+ GLsizei logsize = 0;
+ glGetProgramInfoLog(prog, logsize, &logsize, log);
+ log = new char[logsize];
+ memset(log, '\0', logsize);
+ glGetInfoLogARB(prog, logsize, &logsize, log);
+ printf("%s\n", log);
+ delete[] log;
+ #endif
+ }
+
+ template<>
+ ogl3_shader<false>::ogl3_shader() noexcept : shader(), compiled(GL_FALSE)
+ {
+ if(!(prog = glCreateProgram()))
+ printf("Can't creat shader programme\n");
+
+ if(!(vs = glCreateShader(GL_VERTEX_SHADER)))
+ printf("Can't create vertex shader\n");
+
+ if(!(ps = glCreateShader(GL_FRAGMENT_SHADER)))
+ printf("Can't create fragment shader\n");
+
+ if(!(gs = glCreateShader(GL_GEOMETRY_SHADER)))
+ printf("Can't create geometry shader\n");
+
+ setFragmentShader(defaultFragmentShader, "main");
+ setGeometryShader(defaultGeometryShader, "main");
+ setVertexShader(defaultVertexShader, "main");
+ }
+
+ template<>
+ ogl3_shader<true>::ogl3_shader() noexcept : shader(), compiled(GL_FALSE)
+ {
+ if(!(prog = glCreateProgram()))
+ printf("Can't creat shader programme\n");
+
+ if(!(vs = glCreateShader(GL_VERTEX_SHADER)))
+ printf("Can't create vertex shader\n");
+
+ if(!(ps = glCreateShader(GL_FRAGMENT_SHADER)))
+ printf("Can't create fragment shader\n");
+
+