Compare commits

...

175 Commits

Author SHA1 Message Date
Steffen Fündgens
965c3f96f9 still merging... 2014-12-02 13:19:19 +01:00
Steffen Fündgens
4adc1198b8 Merged master and converter 2014-12-02 13:17:33 +01:00
Steffen Fündgens
b6c694b350 Compositions.xml makes sense now 2014-12-02 13:13:20 +01:00
Faerbit
f38ced6603 Moving shader management completely into graphics. 2014-12-01 17:49:59 +01:00
Faerbit
64aeae8143 Removing spammy comments. 2014-12-01 17:44:58 +01:00
Faerbit
8b21495faa Adding namespacing. 2014-12-01 17:40:39 +01:00
Faerbit
be1abf584f Removing useless includes. 2014-12-01 17:40:06 +01:00
Steffen Fündgens
315d5aec04 implemented all methods of the converter class, needs testing 2014-12-01 14:09:55 +01:00
Faerbit
ed889ebd76 Reexporting Block.obj, because normals were missing. 2014-12-01 13:55:47 +01:00
Faerbit
777d33699e Removing backup blender files. 2014-12-01 13:54:10 +01:00
Faerbit
02641d7f1c Adding OBJ-file load messages for easier debugging. 2014-12-01 13:53:01 +01:00
Faerbit
c96d081e3d Do not build GLFW examples and tests. 2014-12-01 13:16:04 +01:00
Faerbit
e1d14c1884 Removing useless includes. 2014-12-01 12:58:04 +01:00
Faerbit
117e3715b4 Updating glfw to version 3.0.4. 2014-12-01 12:53:19 +01:00
Faerbit
27080179e4 Revert "Updating glfw." Code was not ready for release.
This reverts commit 81234ca22a.
2014-12-01 12:44:08 +01:00
Faerbit
043205455f Moving application class to it's own file. 2014-12-01 12:41:19 +01:00
Faerbit
4daf4c8ccf Let member function use it own class and not the global variable. 2014-12-01 12:33:00 +01:00
Faerbit
81234ca22a Updating glfw. 2014-12-01 12:32:04 +01:00
Faerbit
8317188314 Removing big textures as they are not needed. 2014-11-29 02:06:46 +01:00
Faerbit
139945614b Merge branch 'master' of github.com:Faerbit/swp 2014-11-29 01:37:38 +01:00
Faerbit
f3f870c2d1 Removing useless files. 2014-11-29 01:36:59 +01:00
Jasper
edb17a9e67 Merge branch 'master' of github.com:Faerbit/swp 2014-11-28 17:07:54 +01:00
Steffen Fündgens
9f1a931b0b added example Compositions.xml, implemented most of newComposition() method 2014-11-28 17:05:49 +01:00
Jasper
91de258030 Reduced memory usage of trianglemesh 2014-11-28 17:01:56 +01:00
Faerbit
c5abdba83e Added skydome blender file. 2014-11-28 16:49:28 +01:00
Faerbit
869e1ed415 Moved Blenderfiles out of Levels because of packaging. 2014-11-28 16:47:35 +01:00
Jasper
59bb4a91a7 Merge branch 'master' of github.com:Faerbit/swp 2014-11-28 16:46:44 +01:00
Jasper
ad61969176 Added basic Triangle Mesh, pending reading out of .obj and then testing. 2014-11-28 16:46:35 +01:00
sfroitzheim
414da9ba7e Added switch models and textures in 2 seperate parts (switchInner is the movable object - size may needs to be changed in the future) 2014-11-28 16:38:55 +01:00
sfroitzheim
150a556c22 Added all blender files (except marble, as I don't have the newest and smoothed version) 2014-11-28 16:31:50 +01:00
sfroitzheim
00cdbe4c5e Fixed origin of block. 2014-11-28 15:28:03 +01:00
Jasper
594f336204 Added a constraint for distances, as such a constraint did not exist in bullet.Why, IDK. 2014-11-28 13:52:03 +01:00
Jasper
9d39bec46f Multiple objects now working, for exact implimentation check level.cc and comment in physics.hh. Additionally multiple comments have been added to physics.hh to support the use of these functions 2014-11-28 12:06:17 +01:00
Faerbit
d58147a935 You can render objects with multiple shaders now. 2014-11-28 00:17:56 +01:00
Faerbit
4881367004 Adding run.sh script 2014-11-27 23:58:33 +01:00
Faerbit
6a05ec47dd Changing paramter order. 2014-11-27 22:02:25 +01:00
Faerbit
6bb0974c67 Specifying upload path. 2014-11-27 21:53:22 +01:00
Faerbit
6a82bf122c Fixing script not in PATH. 2014-11-27 21:45:19 +01:00
Faerbit
c63382ba29 Fixing stupid mistake. 2014-11-27 21:38:10 +01:00
Faerbit
215b37f15e Changing file hoster once again to dropbox. 2014-11-27 21:37:09 +01:00
Faerbit
fab8665424 Adding module to plowshare. 2014-11-27 13:32:51 +01:00
Faerbit
b9b2f5769e Fixing yaml formatting. 2014-11-27 13:25:18 +01:00
Faerbit
50c08d79ec Changing how plowshare is installed. 2014-11-27 13:24:39 +01:00
Faerbit
60ff3452ca Adding -y to apt-get. 2014-11-27 13:20:18 +01:00
Faerbit
65eba6a97a Changing upload target to mediafire and upload tool to plowshare because megacmd sucks. 2014-11-27 13:19:02 +01:00
Faerbit
b57b559748 Reverting to upload instead of sync, because sync looks really broken. 2014-11-27 12:55:41 +01:00
Faerbit
ca4ccaef10 Syncing files instead of forcing them to mega. 2014-11-27 12:36:30 +01:00
Faerbit
6f44ea1416 Always uploading Windows build. 2014-11-27 12:09:45 +01:00
Faerbit
cc6818cd65 Adding zip. 2014-11-27 05:40:53 +01:00
Faerbit
2a99eb16d5 Should fix weird bug with CMake. 2014-11-27 05:35:45 +01:00
Faerbit
6af0dcc427 Adding missing paramter. 2014-11-27 05:31:54 +01:00
Faerbit
1dc99cdf39 Upgrading docker image to newest version. 2014-11-27 05:31:17 +01:00
Faerbit
79e8f777b3 Trying compilation on circle with docker. 2014-11-27 05:27:19 +01:00
Faerbit
76745a1da8 Adding dockerfile. 2014-11-27 05:18:40 +01:00
Faerbit
90630c7ab6 Fixing another syntax error. 2014-11-27 00:41:21 +01:00
Faerbit
afdaa05d27 Fixing syntax. 2014-11-27 00:40:46 +01:00
Faerbit
3621592e4c Added spaces. 2014-11-27 00:32:44 +01:00
Faerbit
a49c023305 Check if windows build exists before trying to do anything with it. 2014-11-27 00:23:51 +01:00
Faerbit
c6a330f35a Do not suppress output of apt-get anymore. 2014-11-27 00:16:17 +01:00
Faerbit
bdee3a0740 Only copy linux builds to artifacts. 2014-11-27 00:14:56 +01:00
Faerbit
6ef713107e Changing root path. 2014-11-26 23:57:33 +01:00
Faerbit
98d0e955e8 Try building linux first. 2014-11-26 23:49:40 +01:00
Faerbit
6b80e179f4 Another try at cross compilation on circle. 2014-11-26 23:46:21 +01:00
Faerbit
b3c285b4c2 Another try at cross compilation on circle. 2014-11-26 23:44:09 +01:00
Faerbit
e2dd7724ac Trying without C++ 11. 2014-11-26 23:29:41 +01:00
Faerbit
4335eeb00e Adding binutils. 2014-11-26 23:09:04 +01:00
Faerbit
8d6483877b Changing dependencies. 2014-11-26 23:06:51 +01:00
Faerbit
99280607e1 Adding 64 bit compiler. 2014-11-26 23:05:01 +01:00
Faerbit
d31e50cfa8 Enabling error message. 2014-11-26 23:02:55 +01:00
Faerbit
24c149b656 Another try at cross compilation on circle. 2014-11-26 23:02:01 +01:00
Faerbit
fe4563e1d0 Forgot one windows thing. 2014-11-26 01:58:58 +01:00
Faerbit
ae18362112 Removing travis.yml because it is useless. 2014-11-26 01:54:00 +01:00
Faerbit
45ccc55786 Deactivating Windows build for now. 2014-11-26 01:53:37 +01:00
Faerbit
35012faeec Another try at cross compilation on circle. 2014-11-26 01:45:24 +01:00
Faerbit
f17a9d4374 Another try at cross compilation on circle. 2014-11-26 01:39:45 +01:00
Faerbit
cdfc6fa94a Another try at cross compilation on circle. 2014-11-26 00:56:16 +01:00
Faerbit
c6c9c83eb7 Testing out cross compilation on circle. 2014-11-26 00:43:52 +01:00
Faerbit
1af78cb6e5 Replaced cmake wrapper with own options. 2014-11-26 00:39:54 +01:00
Faerbit
3504e10102 Made Mega upload optional. 2014-11-26 00:39:26 +01:00
Faerbit
28c2347594 Do not recreate zip file everytime. 2014-11-26 00:39:03 +01:00
Faerbit
e4734ae34a Another try at Mega deployment. 2014-11-25 22:08:51 +01:00
Faerbit
ef80d0124a Another try at Mega deployment. 2014-11-25 22:07:28 +01:00
Faerbit
79440e2edd Limiting circle builds to master branch. 2014-11-25 22:06:55 +01:00
Faerbit
96c3ea4aac Another try at Mega deployment. 2014-11-25 22:03:32 +01:00
Faerbit
3c2ce439e5 Another try at Circle Artifacts. 2014-11-25 21:54:53 +01:00
Faerbit
bed712f669 Trying Circle Artifacts. 2014-11-25 21:53:00 +01:00
Faerbit
b6c8c7ed57 Configuring mega upload. 2014-11-25 21:46:37 +01:00
Faerbit
dd1705b023 Another try at mega deployment. 2014-11-25 21:33:28 +01:00
Faerbit
d524787cb7 Trying out deployment to Mega. 2014-11-25 21:30:57 +01:00
Faerbit
e5c30e464f Speeding up build on circle. 2014-11-25 21:21:13 +01:00
Faerbit
6b00de67f5 Fixing typo. 2014-11-25 21:11:05 +01:00
Faerbit
6a593eb319 Adding a few dependencies to circle.yml. 2014-11-25 21:10:18 +01:00
Faerbit
a5694e0e8c Adding circle.yml to test Circle CI. 2014-11-25 21:01:11 +01:00
Faerbit
2de9c38ce7 Changed how windows focus is handled. 2014-11-25 16:01:13 +01:00
Faerbit
7431d0d63e Changed fog functions a little bit more. Looks nice enough. 2014-11-25 13:54:00 +01:00
Steffen Fündgens
6b904894c6 skeleton runs now, only xml read/write missing 2014-11-25 13:51:25 +01:00
Faerbit
7736e7850f Removing global variables from physics, because they are not needed. 2014-11-25 13:38:28 +01:00
Faerbit
4161ae0ec4 Changed fog function from exp to linear. 2014-11-25 13:24:02 +01:00
Faerbit
b0ed3c467f Ignoring another error in bullet. 2014-11-24 20:51:17 +01:00
Faerbit
78de14907a More convenience. 2014-11-24 19:54:13 +01:00
Faerbit
2bf6eb667c Added support for ninja build system and fixed uploading to Mega. 2014-11-24 15:59:59 +01:00
Faerbit
8245e0782e Added package script. 2014-11-24 15:12:18 +01:00
Steffen Fündgens
7bf1d8eed4 converter now takes the Level to convert as input 2014-11-24 13:21:52 +01:00
Steffen Fündgens
9b5426a6af added tinyxml2 for xml conversion 2014-11-24 13:03:55 +01:00
Faerbit
823da599f3 Starting another travis try. 2014-11-24 02:29:40 +01:00
Faerbit
71cb8300bd Enabling cross compiling if supported by the current system. 2014-11-24 02:10:25 +01:00
Faerbit
1cc47fa4ab Changed build script a bit. 2014-11-24 01:53:29 +01:00
Faerbit
97aeb6c965 Changing vector of objects to vector of pointer of objects for clearer construnction. 2014-11-23 00:59:54 +01:00
Faerbit
ed44f71b8c Replacing skybox attribute with skydome. 2014-11-23 00:57:16 +01:00
Faerbit
3a9a04d4d6 Changed skybox to skydome. 2014-11-22 00:39:58 +01:00
Jasper
59796882e4 Merge branch 'master' of https://github.com/Faerbit/swp 2014-11-21 16:22:50 +01:00
Jasper
3d936df227 Put Box In Level 2014-11-21 16:22:36 +01:00
Steffen Fündgens
3be8d78e1a now ignoring files with ~ 2014-11-21 16:09:45 +01:00
Steffen Fündgens
0105a74b5a Now ignoreing files with ~. 2014-11-21 16:08:03 +01:00
Steffen Fündgens
c65a745603 Modifying CMakes files to get convert to compile. 2014-11-21 16:07:13 +01:00
Steffen Fündgens
86c11e339e created skeletal implementation of png to xml converter 2014-11-21 15:43:27 +01:00
Jasper
fa60d52676 Modified adders in physics to no longer accept float x,y,z but entity/object instead. 2014-11-21 12:56:30 +01:00
Jasper
3c0deb232f added box in physics 2014-11-21 12:50:11 +01:00
Jasper
263f59f000 Normalized body movement (still has float strength to change magnitude) 2014-11-21 12:31:29 +01:00
Faerbit
1006f1cbc9 Improved fog a little bit. 2014-11-21 02:46:02 +01:00
Faerbit
c47ed4646d Added skybox and refined fog a bit. Fog still needs a lot of work. 2014-11-21 02:38:03 +01:00
Faerbit
b74e56fe7d Fixing typo to allow cross compilation. 2014-11-20 23:25:52 +01:00
Faerbit
3a677c31da Removing travis.yml again because it doesn't work. 2014-11-20 21:19:07 +01:00
Faerbit
788110aaf1 Fixing sed command. 2014-11-20 21:16:51 +01:00
Faerbit
6f59b1fb59 Now using standard Makefiles instead of Ninja. 2014-11-20 21:15:02 +01:00
Faerbit
7bda59920b Fixing installation of ninja again. 2014-11-20 21:08:29 +01:00
Faerbit
4af197d74b Fixing installation of ninja. 2014-11-20 21:05:15 +01:00
Faerbit
15a540e3c9 Adding .travis.yml for CI. 2014-11-20 21:02:58 +01:00
Faerbit
eadc819f80 Removing useless files. 2014-11-20 20:42:40 +01:00
Faerbit
b12b917a44 Implemented simple fog. 2014-11-19 01:58:48 +01:00
Faerbit
faf548d3ee Now using built-in exp function. 2014-11-19 01:58:25 +01:00
Faerbit
7d0cf9fca2 Added getCameraPosition to Level because it is used very often. 2014-11-19 01:57:38 +01:00
Faerbit
49dfdff413 Changing a few lighting paramters for testing. 2014-11-19 00:59:48 +01:00
Faerbit
a8b6463674 Changing how the intensity is calculated. 2014-11-19 00:59:33 +01:00
Faerbit
9576a40af6 Moving far plane a bit further. 2014-11-19 00:59:02 +01:00
Faerbit
8968750015 Clamping diffuse color for more realistic lighting. 2014-11-19 00:46:51 +01:00
Faerbit
715301552a Removing angular(Velocity) from object class as it is not needed there. 2014-11-18 19:57:58 +01:00
Faerbit
2638b43b44 Resized large textures to one third of their size. 2014-11-18 19:39:44 +01:00
Steffen Fündgens
5a92765518 changed terrain normals to consider 8 vertices, looks the same 2014-11-18 13:09:55 +01:00
Faerbit
6a8182ab8d Reexported objects and enabled smooth shading. 2014-11-17 22:03:28 +01:00
Jasper
c54d6cf874 Merge branch 'master' of renault.informatik.rwth-aachen.de:/data/git-repository/students/swpp-ws-14-15/swpp-ws-14-15-c
Conflicts:
	terrain.cc
	terrain.hh
2014-11-17 18:59:00 +01:00
Jasper
95627d31ae Merge branch 'master' of https://github.com/Faerbit/swp 2014-11-17 18:54:44 +01:00
Jasper
10f51db60f fixed terrain offset 2014-11-17 18:54:19 +01:00
Fabian Klemp
8a9d026aa5 Removing useless stuff. 2014-11-17 18:40:54 +01:00
sfroitzheim
c403814cd6 Merge branch 'master' of https://github.com/Faerbit/swp 2014-11-17 18:31:48 +01:00
sfroitzheim
c58e4d01b1 Changing marble model. 2014-11-17 18:31:22 +01:00
Fabian Klemp
9611c9ef08 Changing sand texture to a seamless sand texture. 2014-11-17 18:18:57 +01:00
Fabian Klemp
5533d4e4ba Removing update of the light at the center of the marble. 2014-11-17 18:18:15 +01:00
Fabian Klemp
9fc515ec24 Removing light at the center of the marble. 2014-11-17 18:16:27 +01:00
Fabian Klemp
ca3928e232 Added directional lighting. 2014-11-17 17:51:15 +01:00
Fabian Klemp
39b1ee85b0 Added emtpy constructor. 2014-11-17 17:50:06 +01:00
Fabian Klemp
94b12ae614 Removed rotation paramter from Light constructor as it is not used. 2014-11-17 16:54:17 +01:00
Fabian Klemp
6f89c406f1 Merge branch 'master' of github.com:Faerbit/swp 2014-11-17 16:31:04 +01:00
Fabian Klemp
d11a2820d6 Changing a few spawning values. 2014-11-17 16:31:01 +01:00
Jasper
d4e38b7a41 Merge branch 'master' of https://github.com/Faerbit/swp 2014-11-17 16:29:10 +01:00
Jasper
dbce8c229f getting the sizes juuuuuuuust right 2014-11-17 16:28:31 +01:00
Fabian Klemp
c22ae2c244 Merge branch 'master' of github.com:Faerbit/swp 2014-11-17 16:16:13 +01:00
Fabian Klemp
3086f98ecd Added alpha shading. 2014-11-17 16:15:56 +01:00
Jasper
bcb594c4cf ich bin dumb 2014-11-17 16:14:01 +01:00
Jasper
429223a08e merged level.cc 2014-11-17 16:11:39 +01:00
Jasper
abe9513aa3 further improving physics and interaction 2014-11-17 16:07:40 +01:00
sfroitzheim
8f64f75b67 Merge branch 'master' of https://github.com/Faerbit/swp 2014-11-17 15:44:31 +01:00
Fabian Klemp
29f24d6f05 Adding column and block ruins. 2014-11-17 15:29:38 +01:00
Fabian Klemp
f6b2bd776a Added light in the middle of the marble. 2014-11-17 15:19:36 +01:00
Fabian Klemp
6f7486b3f8 Fixed normals. 2014-11-17 15:19:19 +01:00
Fabian Klemp
4dc7897f8c Removed middle Ring. 2014-11-17 15:04:59 +01:00
Fabian Klemp
48691338ba Basic Marble Model with Textures added. 2014-11-17 14:38:35 +01:00
Fabian Klemp
0b7f8e95d3 Adding torch. 2014-11-17 14:23:23 +01:00
Jasper
a77ed38625 Merge branch 'master' of https://github.com/Faerbit/swp 2014-11-17 13:36:35 +01:00
Steffen Fündgens
0c4184477b Merge branch 'master' of github.com:Faerbit/swp 2014-11-17 13:36:09 +01:00
Steffen Fündgens
29f4cf6279 Reorganizing file structure. 2014-11-17 13:36:05 +01:00
Jasper
288d509316 Changed rollForward to accept vector going from camera to bball 2014-11-17 13:21:27 +01:00
sfroitzheim
5c776e56f0 basic marble model with (imperfect) texture 2014-11-14 15:12:13 +01:00
Steffen Fündgens
5d2acc0e53 Fixed a bug in loading the heightmap and added comments 2014-11-04 12:08:47 +01:00
Steffen Fündgens
925eb62831 implemented loading of the heightmap from a png to unsigned int** 2014-11-03 17:19:22 +01:00
141 changed files with 26416 additions and 3809213 deletions

3
.gitignore vendored
View File

@ -3,3 +3,6 @@ build
Makefile
CMakeLists.txt.user
*.cbp
*~
*.zip

Binary file not shown.

Binary file not shown.

BIN
Blenderfiles/skydome.blend Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,7 @@
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
add_subdirectory(converter)
# project/binary name:
PROJECT(MarbleRaceGroupC)
@ -55,19 +57,17 @@ set(dir ${CMAKE_CURRENT_SOURCE_DIR}/binaries)
set(EXECUTABLE_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE)
# source and header files
FILE(GLOB_RECURSE SOURCE_FILES_SHARED "../shared/*.cc")
FILE(GLOB_RECURSE SOURCE_FILES "${CMAKE_SOURCE_DIR}/*.cc")
FILE(GLOB SOURCE_FILES "${CMAKE_SOURCE_DIR}/*.cc")
SET(SOURCE_FILES ${SOURCE_FILES} ${SOURCE_FILES_SHARED})
FILE(GLOB_RECURSE HEADER_FILES_SHARED "../shared/*.hh")
FILE(GLOB_RECURSE HEADER_FILES "${CMAKE_SOURCE_DIR}/*.hh")
FILE(GLOB HEADER_FILES "${CMAKE_SOURCE_DIR}/*.hh")
SET(HEADER_FILES ${HEADER_FILES} ${HEADER_FILES_SHARED})
# shader files
FILE(GLOB_RECURSE SHADER_FILES "${CMAKE_SOURCE_DIR}/Shader/*.*")
# Readme
FILE(GLOB_RECURSE README_FILES "${CMAKE_SOURCE_DIR}/../README.TXT")
FILE(GLOB_RECURSE README_FILES "${CMAKE_SOURCE_DIR}/../Readme.md")
#
#
###############################################################################
@ -118,12 +118,19 @@ FILE(GLOB_RECURSE HEADER_FILES_BULLET ${CMAKE_SOURCE_DIR}/extern/bullet/src/*.h)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/extern/bullet/src)
SET(HEADER_FILES ${HEADER_FILES} ${HEADER_FILES_BULLET})
SET (LIBRARIES ${LIBRARIES} ${CMAKE_SOURCE_DIR}/extern/bullet/build/src/BulletDynamics/libBulletDynamics.a)
SET (LIBRARIES ${LIBRARIES} ${CMAKE_SOURCE_DIR}/extern/bullet/build/src/BulletCollision/libBulletCollision.a)
SET (LIBRARIES ${LIBRARIES} ${CMAKE_SOURCE_DIR}/extern/bullet/build/src/LinearMath/libLinearMath.a)
SET (LIBRARIES ${LIBRARIES} ${CMAKE_SOURCE_DIR}/extern/bullet/build/src/BulletSoftBody/libBulletSoftBody.a)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
SET (LIBRARIES ${LIBRARIES} ${CMAKE_SOURCE_DIR}/extern/bullet/build/lib/libBulletDynamics.a)
SET (LIBRARIES ${LIBRARIES} ${CMAKE_SOURCE_DIR}/extern/bullet/build/lib/libBulletCollision.a)
SET (LIBRARIES ${LIBRARIES} ${CMAKE_SOURCE_DIR}/extern/bullet/build/lib/libLinearMath.a)
SET (LIBRARIES ${LIBRARIES} ${CMAKE_SOURCE_DIR}/extern/bullet/build/lib/libBulletSoftBody.a)
SET (LIBRARIES -static ${LIBRARIES} -static-libgcc -static-libstdc++)
else()
SET (LIBRARIES ${LIBRARIES} ${CMAKE_SOURCE_DIR}/extern/bullet/build/src/BulletDynamics/libBulletDynamics.a)
SET (LIBRARIES ${LIBRARIES} ${CMAKE_SOURCE_DIR}/extern/bullet/build/src/BulletCollision/libBulletCollision.a)
SET (LIBRARIES ${LIBRARIES} ${CMAKE_SOURCE_DIR}/extern/bullet/build/src/LinearMath/libLinearMath.a)
SET (LIBRARIES ${LIBRARIES} ${CMAKE_SOURCE_DIR}/extern/bullet/build/src/BulletSoftBody/libBulletSoftBody.a)
endif()
ADD_EXECUTABLE(${CMAKE_PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES} ${SHADER_FILES} ${README_FILES})
TARGET_LINK_LIBRARIES(${CMAKE_PROJECT_NAME} ${LIBRARIES})
ADD_EXECUTABLE(MarbleRaceGroupC ${SOURCE_FILES} ${HEADER_FILES} ${SHADER_FILES} ${README_FILES})
TARGET_LINK_LIBRARIES(MarbleRaceGroupC ${LIBRARIES})

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
from ubuntu:trusty
run apt-get update
run apt-get upgrade
run apt-get install -y build-essential
run apt-get install -y gcc-mingw-w64
run apt-get install -y cmake
run apt-get install -y ninja-build
run apt-get install -y xorg-dev
run apt-get install -y freeglut3-dev
run apt-get install -y zip

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
6
-1.0 -1.0 0.0 0.0 0.0 1.0 0.0 0.0
1.0 -1.0 0.0 0.0 0.0 1.0 1.0 0.0
1.0 1.0 0.0 0.0 0.0 1.0 1.0 1.0
-1.0 -1.0 0.0 0.0 0.0 1.0 0.0 0.0
1.0 1.0 0.0 0.0 0.0 1.0 1.0 1.0
-1.0 1.0 0.0 0.0 0.0 1.0 0.0 1.0

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 KiB

721
Levels/Geometry/Block.obj Normal file
View File

@ -0,0 +1,721 @@
# Blender v2.72 (sub 0) OBJ File: 'ruins_block.blend'
# www.blender.org
o Block_Cube
v 0.003582 -1.000000 1.000000
v 0.003582 -1.000000 -1.000000
v 0.003581 1.000000 1.000000
v 0.003582 1.000000 -1.000000
v 0.003582 -1.000000 1.000000
v 0.003582 -1.000000 -1.000000
v 0.003581 1.000000 1.000000
v 0.003582 1.000000 -1.000000
v 2.003582 -0.973911 -0.973911
v 1.977493 -1.000000 -1.000000
v 1.977493 -1.000000 -1.000000
v 2.003316 -0.977624 -0.975900
v 2.002525 -0.981261 -0.978115
v 2.001224 -0.984749 -0.980509
v 1.999440 -0.988016 -0.983034
v 1.997210 -0.990996 -0.985640
v 1.994578 -0.993628 -0.988272
v 1.991598 -0.995859 -0.990877
v 1.988331 -0.997642 -0.993402
v 1.984843 -0.998943 -0.995797
v 1.981206 -0.999735 -0.998011
v 1.981206 -0.998011 -0.999734
v 1.984843 -0.995797 -0.998943
v 1.988331 -0.993402 -0.997642
v 1.991598 -0.990877 -0.995858
v 1.994578 -0.988272 -0.993628
v 1.997210 -0.985640 -0.990996
v 1.999440 -0.983034 -0.988016
v 2.001224 -0.980509 -0.984749
v 2.002525 -0.978115 -0.981261
v 2.003316 -0.975900 -0.977624
v 1.977493 -1.000000 1.000000
v 2.003582 -0.973911 0.973911
v 1.977493 -1.000000 1.000000
v 1.981206 -0.999735 0.998011
v 1.984843 -0.998943 0.995797
v 1.988331 -0.997642 0.993402
v 1.991598 -0.995859 0.990877
v 1.994578 -0.993628 0.988272
v 1.997210 -0.990996 0.985640
v 1.999440 -0.988016 0.983034
v 2.001224 -0.984749 0.980509
v 2.002525 -0.981261 0.978115
v 2.003316 -0.977624 0.975900
v 2.003316 -0.975900 0.977624
v 2.002525 -0.978115 0.981261
v 2.001224 -0.980509 0.984749
v 1.999440 -0.983034 0.988016
v 1.997210 -0.985640 0.990996
v 1.994578 -0.988272 0.993628
v 1.991598 -0.990877 0.995859
v 1.988331 -0.993402 0.997642
v 1.984843 -0.995797 0.998943
v 1.981206 -0.998011 0.999735
v 2.003582 0.973911 -0.973911
v 1.977494 1.000000 -0.999999
v 1.977494 1.000000 -0.999999
v 2.003317 0.975900 -0.977623
v 2.002526 0.978115 -0.981261
v 2.001225 0.980509 -0.984748
v 1.999441 0.983034 -0.988015
v 1.997210 0.985640 -0.990995
v 1.994578 0.988272 -0.993627
v 1.991598 0.990877 -0.995858
v 1.988331 0.993402 -0.997642
v 1.984843 0.995797 -0.998943
v 1.981206 0.998011 -0.999734
v 1.981206 0.999735 -0.998010
v 1.984844 0.998943 -0.995796
v 1.988331 0.997642 -0.993402
v 1.991598 0.995859 -0.990876
v 1.994578 0.993628 -0.988271
v 1.997210 0.990996 -0.985639
v 1.999441 0.988016 -0.983034
v 2.001225 0.984749 -0.980508
v 2.002526 0.981261 -0.978114
v 2.003317 0.977624 -0.975900
v 1.977492 1.000000 1.000001
v 2.003581 0.973911 0.973912
v 1.977492 1.000000 1.000001
v 1.981205 0.998011 0.999735
v 1.984842 0.995797 0.998944
v 1.988330 0.993402 0.997643
v 1.991597 0.990877 0.995859
v 1.994577 0.988272 0.993628
v 1.997209 0.985640 0.990996
v 1.999439 0.983034 0.988017
v 2.001224 0.980509 0.984750
v 2.002524 0.978115 0.981262
v 2.003315 0.975900 0.977625
v 2.003315 0.977624 0.975901
v 2.002524 0.981261 0.978115
v 2.001224 0.984749 0.980510
v 1.999439 0.988016 0.983035
v 1.997209 0.990996 0.985640
v 1.994577 0.993628 0.988272
v 1.991597 0.995859 0.990878
v 1.988330 0.997642 0.993403
v 1.984842 0.998943 0.995797
v 1.981205 0.999735 0.998011
v -1.996123 -0.973911 0.973911
v -1.970034 -1.000000 0.999999
v -1.970034 -1.000000 0.999999
v -1.995857 -0.977624 0.975900
v -1.995066 -0.981262 0.978114
v -1.993765 -0.984749 0.980508
v -1.991981 -0.988016 0.983034
v -1.989750 -0.990996 0.985639
v -1.987118 -0.993628 0.988271
v -1.984138 -0.995859 0.990876
v -1.980871 -0.997643 0.993402
v -1.977384 -0.998944 0.995796
v -1.973747 -0.999735 0.998010
v -1.973747 -0.998011 0.999734
v -1.977384 -0.995797 0.998943
v -1.980871 -0.993403 0.997642
v -1.984138 -0.990877 0.995858
v -1.987118 -0.988272 0.993627
v -1.989750 -0.985640 0.990995
v -1.991981 -0.983035 0.988015
v -1.993765 -0.980509 0.984748
v -1.995066 -0.978115 0.981261
v -1.995857 -0.975901 0.977624
v -1.970033 -1.000000 -1.000001
v -1.996122 -0.973911 -0.973912
v -1.970033 -1.000000 -1.000001
v -1.973746 -0.999735 -0.998012
v -1.977383 -0.998944 -0.995798
v -1.980871 -0.997643 -0.993403
v -1.984138 -0.995859 -0.990878
v -1.987118 -0.993628 -0.988273
v -1.989750 -0.990996 -0.985640
v -1.991981 -0.988016 -0.983035
v -1.993765 -0.984749 -0.980510
v -1.995065 -0.981262 -0.978115
v -1.995857 -0.977624 -0.975901
v -1.995857 -0.975901 -0.977625
v -1.995065 -0.978115 -0.981262
v -1.993765 -0.980509 -0.984750
v -1.991981 -0.983035 -0.988017
v -1.989750 -0.985640 -0.990997
v -1.987118 -0.988272 -0.993629
v -1.984138 -0.990877 -0.995859
v -1.980871 -0.993403 -0.997643
v -1.977383 -0.995797 -0.998944
v -1.973746 -0.998011 -0.999735
v -1.996123 0.973911 0.973910
v -1.970034 1.000000 0.999999
v -1.970034 1.000000 0.999999
v -1.995857 0.975900 0.977623
v -1.995066 0.978114 0.981260
v -1.993766 0.980509 0.984748
v -1.991982 0.983034 0.988015
v -1.989751 0.985639 0.990995
v -1.987119 0.988271 0.993627
v -1.984139 0.990877 0.995858
v -1.980872 0.993402 0.997642
v -1.977384 0.995796 0.998942
v -1.973747 0.998011 0.999734
v -1.973747 0.999734 0.998010
v -1.977384 0.998943 0.995796
v -1.980872 0.997642 0.993402
v -1.984139 0.995858 0.990876
v -1.987119 0.993628 0.988271
v -1.989751 0.990996 0.985639
v -1.991982 0.988016 0.983034
v -1.993766 0.984749 0.980508
v -1.995066 0.981261 0.978114
v -1.995857 0.977624 0.975900
v -1.970034 1.000000 -1.000000
v -1.996123 0.973911 -0.973912
v -1.970034 1.000000 -1.000000
v -1.973747 0.998011 -0.999735
v -1.977384 0.995796 -0.998944
v -1.980871 0.993402 -0.997643
v -1.984138 0.990877 -0.995859
v -1.987118 0.988271 -0.993628
v -1.989750 0.985639 -0.990996
v -1.991981 0.983034 -0.988016
v -1.993765 0.980509 -0.984749
v -1.995066 0.978114 -0.981262
v -1.995857 0.975900 -0.977625
v -1.995857 0.977624 -0.975901
v -1.995066 0.981261 -0.978115
v -1.993765 0.984749 -0.980509
v -1.991981 0.988016 -0.983035
v -1.989750 0.990996 -0.985640
v -1.987118 0.993628 -0.988272
v -1.984138 0.995858 -0.990877
v -1.980871 0.997642 -0.993403
v -1.977384 0.998943 -0.995797
v -1.973747 0.999734 -0.998011
vt 0.839733 0.000000
vt 0.848833 0.013044
vt -0.537296 -0.000000
vt -0.546397 0.013044
vt 0.151167 0.000000
vt 0.839733 0.013044
vt 0.839733 0.986956
vt 0.160267 0.986956
vt 0.160267 0.013044
vt 0.848833 0.000000
vt 0.160370 0.000000
vt 0.151270 0.013045
vt 1.537399 0.000000
vt 1.546500 0.013044
vt 0.974265 0.996942
vt -0.001961 0.996942
vt -0.001961 -0.003057
vt 0.974264 -0.003058
vt 0.848834 -0.013044
vt -0.546397 -0.013044
vt -0.537296 -1.000000
vt 0.839733 -1.000000
vt 0.947629 -0.000000
vt 0.003341 -0.000000
vt 0.003341 1.000000
vt 0.947629 1.000000
vt 0.839732 1.000000
vt -0.537296 1.000000
vt 0.151167 1.000000
vt 0.841028 0.000995
vt 0.841028 0.000133
vt 0.842297 0.002102
vt 0.842297 0.000528
vt 0.848011 0.003299
vt 0.846532 0.001179
vt 0.847367 0.000528
vt 0.848465 0.002102
vt 0.847389 0.004562
vt 0.845651 0.002071
vt 0.846610 0.005864
vt 0.844742 0.003186
vt 0.845692 0.007180
vt 0.843824 0.004502
vt 0.844653 0.008483
vt 0.842915 0.005992
vt 0.843513 0.009746
vt 0.842034 0.007626
vt 0.842297 0.010943
vt 0.841199 0.009369
vt 0.840427 0.011188
vt 0.841028 0.012050
vt 0.158972 0.012050
vt 0.159573 0.011188
vt 0.157703 0.010943
vt 0.158801 0.009369
vt 0.156487 0.009746
vt 0.157966 0.007626
vt 0.155347 0.008483
vt 0.157085 0.005992
vt 0.154308 0.007180
vt 0.156176 0.004502
vt 0.153389 0.005864
vt 0.155258 0.003186
vt 0.152611 0.004562
vt 0.154349 0.002071
vt 0.151989 0.003299
vt 0.153468 0.001179
vt 0.151535 0.002102
vt 0.152633 0.000528
vt 0.841028 0.999867
vt 0.841028 0.999005
vt 0.842297 0.999472
vt 0.842297 0.997898
vt 0.846532 0.998821
vt 0.848011 0.996701
vt 0.848464 0.997898
vt 0.847367 0.999472
vt 0.845651 0.997929
vt 0.847388 0.995438
vt 0.844742 0.996814
vt 0.846610 0.994136
vt 0.843824 0.995498
vt 0.845692 0.992820
vt 0.842915 0.994008
vt 0.844653 0.991517
vt 0.842034 0.992374
vt 0.843513 0.990254
vt 0.841199 0.990631
vt 0.842296 0.989057
vt 0.841028 0.987950
vt 0.840426 0.988812
vt 0.159573 0.988812
vt 0.158972 0.987950
vt 0.158801 0.990631
vt 0.157703 0.989057
vt 0.157966 0.992374
vt 0.156487 0.990254
vt 0.157085 0.994008
vt 0.155347 0.991517
vt 0.156176 0.995498
vt 0.154307 0.992820
vt 0.155258 0.996814
vt 0.153389 0.994136
vt 0.154349 0.997929
vt 0.152611 0.995438
vt 0.153468 0.998821
vt 0.151989 0.996701
vt 0.152633 0.999472
vt 0.151535 0.997898
vt 0.841028 1.000132
vt 0.841028 1.000994
vt 0.159075 0.000133
vt 0.159075 0.000995
vt 0.157807 0.000529
vt 0.157807 0.002102
vt 0.159075 0.999006
vt 0.157807 0.997899
vt 0.157807 0.999472
vt 0.159075 0.999868
vt 0.159075 -0.000994
vt 0.159075 -0.000132
vt 0.160370 1.000000
vt 0.846610 0.992820
vt 0.846610 0.007180
vt 0.845692 0.005864
vt 0.845692 0.994136
vt 0.844653 0.004562
vt 0.844653 0.995438
vt 0.843513 0.003299
vt 0.843513 0.996701
vt 0.153493 0.007180
vt 0.153493 0.992820
vt 0.154411 0.994136
vt 0.154411 0.005864
vt 0.155450 0.995439
vt 0.155450 0.004562
vt 0.156590 0.996702
vt 0.156590 0.003299
vt 0.160370 2.000000
vt 0.159075 1.999005
vt 0.159075 1.000994
vt 0.927508 0.000000
vt 0.003734 0.000000
vt 0.003734 1.000000
vt 0.927508 1.000000
vn 0.000000 0.240400 -0.970700
vn 1.000000 0.000000 0.000000
vn 0.000000 -0.707100 0.707100
vn -0.000000 1.000000 0.000000
vn -1.000000 -0.000000 -0.000000
vn 0.000000 0.911700 0.410900
vn 0.000000 -0.244600 -0.969600
vn -0.000000 -0.000000 1.000000
vn -0.000000 -0.239800 0.970800
vn 0.000000 0.000000 -1.000000
vn -0.000000 0.239200 0.971000
vn 0.000000 0.702500 -0.711700
vn 0.000000 -0.911800 -0.410700
vn 0.394600 -0.649700 -0.649700
vn 0.504500 -0.610500 -0.610500
vn 0.599600 -0.565900 -0.565900
vn 0.682100 -0.517100 -0.517100
vn 0.753900 -0.464500 -0.464600
vn 0.816500 -0.408300 -0.408200
vn 0.870700 -0.347700 -0.347800
vn 0.916800 -0.282400 -0.282400
vn 0.954400 -0.211000 -0.211100
vn 0.982200 -0.132800 -0.132800
vn 0.997800 -0.046400 -0.046400
vn 0.997800 -0.046400 0.046400
vn 0.982200 -0.132800 0.132800
vn 0.954400 -0.211100 0.211100
vn 0.916800 -0.282400 0.282400
vn 0.870700 -0.347700 0.347800
vn 0.816500 -0.408200 0.408200
vn 0.753900 -0.464600 0.464600
vn 0.682100 -0.517100 0.517100
vn 0.599600 -0.565900 0.565900
vn 0.504500 -0.610500 0.610500
vn 0.394600 -0.649800 0.649700
vn 0.394600 0.649800 -0.649700
vn 0.504500 0.610500 -0.610500
vn 0.599600 0.565900 -0.565900
vn 0.682100 0.517100 -0.517100
vn 0.753900 0.464500 -0.464600
vn 0.816500 0.408300 -0.408200
vn 0.870700 0.347800 -0.347800
vn 0.916800 0.282400 -0.282400
vn 0.954400 0.211000 -0.211100
vn 0.982200 0.132800 -0.132800
vn 0.997800 0.046400 -0.046400
vn 0.997800 0.046500 0.046500
vn 0.982200 0.132800 0.132800
vn 0.954400 0.211100 0.211100
vn 0.916800 0.282400 0.282400
vn 0.870700 0.347800 0.347800
vn 0.816500 0.408200 0.408300
vn 0.753900 0.464600 0.464500
vn 0.682100 0.517100 0.517100
vn 0.599600 0.565900 0.565900
vn 0.504500 0.610600 0.610500
vn 0.394500 0.649800 0.649700
vn -0.394600 -0.649700 0.649800
vn -0.504500 -0.610500 0.610500
vn -0.599600 -0.565900 0.565900
vn -0.682100 -0.517100 0.517100
vn -0.753900 -0.464500 0.464500
vn -0.816500 -0.408300 0.408300
vn -0.870700 -0.347700 0.347800
vn -0.916800 -0.282400 0.282400
vn -0.954400 -0.211000 0.211100
vn -0.982200 -0.132800 0.132800
vn -0.997800 -0.046500 0.046500
vn -0.997800 -0.046400 -0.046500
vn -0.982200 -0.132800 -0.132800
vn -0.954400 -0.211100 -0.211100
vn -0.916800 -0.282400 -0.282400
vn -0.870700 -0.347800 -0.347800
vn -0.816500 -0.408300 -0.408300
vn -0.753900 -0.464500 -0.464500
vn -0.682100 -0.517100 -0.517100
vn -0.599600 -0.565900 -0.565900
vn -0.504500 -0.610500 -0.610500
vn -0.394600 -0.649700 -0.649700
vn -0.394600 0.649700 0.649800
vn -0.504500 0.610500 0.610600
vn -0.599600 0.565900 0.565900
vn -0.682100 0.517100 0.517100
vn -0.753900 0.464500 0.464500
vn -0.816500 0.408300 0.408300
vn -0.870700 0.347800 0.347800
vn -0.916800 0.282400 0.282400
vn -0.954400 0.211100 0.211100
vn -0.982200 0.132800 0.132800
vn -0.997800 0.046500 0.046500
vn -0.997800 0.046400 -0.046500
vn -0.982200 0.132700 -0.132800
vn -0.954400 0.211100 -0.211100
vn -0.916800 0.282400 -0.282400
vn -0.870700 0.347800 -0.347800
vn -0.816500 0.408200 -0.408300
vn -0.753900 0.464500 -0.464500
vn -0.682100 0.517100 -0.517100
vn -0.599600 0.565900 -0.565900
vn -0.504500 0.610500 -0.610500
vn -0.394600 0.649700 -0.649800
vn 0.997500 -0.071200 0.000000
vn 0.977100 -0.212700 0.000000
vn 0.937000 -0.349500 0.000000
vn 0.877700 -0.479300 0.000000
vn 0.800500 -0.599300 0.000000
vn 0.707100 -0.707100 0.000000
vn 0.599300 -0.800500 0.000000
vn 0.479300 -0.877700 0.000000
vn 0.349500 -0.937000 -0.000000
vn 0.212600 -0.977100 -0.000000
vn 0.071300 -0.997500 0.000000
vn 0.071400 0.000000 -0.997500
vn 0.212600 0.000000 -0.977100
vn 0.349500 0.000000 -0.937000
vn 0.479300 0.000000 -0.877700
vn 0.599300 0.000000 -0.800600
vn 0.707100 0.000000 -0.707100
vn 0.800500 -0.000000 -0.599300
vn 0.877700 -0.000000 -0.479300
vn 0.936900 -0.000000 -0.349500
vn 0.977100 -0.000000 -0.212600
vn 0.997500 -0.000000 -0.071300
vn 0.997500 0.000000 0.071300
vn 0.977100 0.000000 0.212600
vn 0.936900 0.000000 0.349500
vn 0.877700 0.000000 0.479300
vn 0.800500 0.000000 0.599300
vn 0.707100 0.000000 0.707100
vn 0.599300 0.000000 0.800600
vn 0.479300 -0.000000 0.877700
vn 0.349500 -0.000000 0.936900
vn 0.212600 -0.000000 0.977100
vn 0.071300 -0.000000 0.997500
vn 0.071300 0.997500 0.000000
vn 0.212600 0.977100 0.000000
vn 0.349500 0.936900 0.000000
vn 0.479200 0.877700 0.000000
vn 0.599300 0.800500 0.000000
vn 0.707100 0.707100 0.000000
vn 0.800500 0.599300 0.000000
vn 0.877700 0.479300 0.000000
vn 0.937000 0.349500 0.000000
vn 0.977100 0.212600 0.000000
vn 0.997500 0.071300 0.000000
vn -0.997400 -0.071400 -0.000000
vn -0.977200 -0.212500 -0.000000
vn -0.937000 -0.349500 -0.000000
vn -0.877700 -0.479300 -0.000000
vn -0.800500 -0.599300 -0.000000
vn -0.707100 -0.707100 -0.000000
vn -0.599300 -0.800500 -0.000000
vn -0.479200 -0.877700 -0.000000
vn -0.349500 -0.936900 -0.000000
vn -0.212600 -0.977100 -0.000000
vn -0.071300 -0.997500 -0.000000
vn -0.071300 0.000000 0.997500
vn -0.212600 0.000000 0.977100
vn -0.349500 0.000000 0.936900
vn -0.479200 -0.000000 0.877700
vn -0.599300 -0.000000 0.800500
vn -0.707100 -0.000000 0.707100
vn -0.800500 -0.000000 0.599300
vn -0.877700 -0.000000 0.479300
vn -0.936900 -0.000000 0.349500
vn -0.977200 -0.000000 0.212500
vn -0.997500 -0.000000 0.071400
vn -0.997500 -0.000000 -0.071400
vn -0.977200 -0.000000 -0.212500
vn -0.937000 -0.000000 -0.349500
vn -0.877700 -0.000000 -0.479300
vn -0.800500 -0.000000 -0.599300
vn -0.707100 -0.000000 -0.707100
vn -0.599300 0.000000 -0.800500
vn -0.479200 0.000000 -0.877700
vn -0.349500 0.000000 -0.936900
vn -0.212600 0.000000 -0.977100
vn -0.071300 0.000000 -0.997500
vn -0.071300 0.997500 -0.000000
vn -0.212600 0.977100 -0.000000
vn -0.349500 0.936900 -0.000000
vn -0.479200 0.877700 -0.000000
vn -0.599300 0.800500 -0.000000
vn -0.707100 0.707100 -0.000000
vn -0.800500 0.599300 -0.000000
vn -0.877700 0.479300 -0.000000
vn -0.936900 0.349500 -0.000000
vn -0.977200 0.212500 -0.000000
vn -0.997400 0.071400 -0.000000
vn 0.000000 -1.000000 0.000000
s off
f 10/1/1 9/2/1 11/1/1 126/3/1 125/4/1 124/3/1 6/5/1 2/5/1
f 9/6/2 55/7/2 79/8/2 33/9/2
f 1/10/3 5/10/3 102/11/3 101/12/3 103/11/3 34/13/3 33/14/3 32/13/3
f 57/15/4 172/16/4 149/17/4 80/18/4
f 101/9/5 147/8/5 171/7/5 125/6/5
f 3/10/6 7/10/6 148/11/6 147/12/6 149/11/6 80/13/6 79/14/6 78/13/6
f 56/1/7 55/19/7 57/1/7 172/3/7 171/20/7 170/3/7 8/5/7 4/5/7
f 78/1/8 80/1/8 149/3/8 148/3/8 103/21/8 34/22/8
f 2/5/9 6/5/9 124/3/9 126/3/9 11/1/9 10/1/9
f 11/23/10 126/24/10 170/25/10 172/25/10 57/26/10 56/26/10
f 4/5/11 8/5/11 170/3/11 172/3/11 57/1/11 56/1/11
f 32/1/12 34/1/12 103/3/12 102/3/12 5/5/12 1/5/12
f 78/27/13 80/27/13 149/28/13 148/28/13 7/29/13 3/29/13
f 22/30/14 21/31/14 10/1/14 11/1/14
f 23/32/15 20/33/15 21/31/15 22/30/15
f 24/34/16 19/35/16 20/36/16 23/37/16
f 25/38/17 18/39/17 19/35/17 24/34/17
f 26/40/18 17/41/18 18/39/18 25/38/18
f 27/42/19 16/43/19 17/41/19 26/40/19
f 28/44/20 15/45/20 16/43/20 27/42/20
f 29/46/21 14/47/21 15/45/21 28/44/21
f 30/48/22 13/49/22 14/47/22 29/46/22
f 12/50/23 13/49/23 30/48/23 31/51/23
f 9/6/24 12/50/24 31/51/24
f 45/52/25 44/53/25 33/9/25
f 46/54/26 43/55/26 44/53/26 45/52/26
f 47/56/27 42/57/27 43/55/27 46/54/27
f 48/58/28 41/59/28 42/57/28 47/56/28
f 49/60/29 40/61/29 41/59/29 48/58/29
f 50/62/30 39/63/30 40/61/30 49/60/30
f 51/64/31 38/65/31 39/63/31 50/62/31
f 52/66/32 37/67/32 38/65/32 51/64/32
f 53/68/33 36/69/33 37/67/33 52/66/33
f 35/30/34 36/32/34 53/33/34 54/31/34
f 32/1/35 35/30/35 54/31/35 34/1/35
f 68/70/36 67/71/36 56/27/36 57/27/36
f 69/72/37 66/73/37 67/71/37 68/70/37
f 70/74/38 65/75/38 66/76/38 69/77/38
f 71/78/39 64/79/39 65/75/39 70/74/39
f 72/80/40 63/81/40 64/79/40 71/78/40
f 73/82/41 62/83/41 63/81/41 72/80/41
f 74/84/42 61/85/42 62/83/42 73/82/42
f 75/86/43 60/87/43 61/85/43 74/84/43
f 76/88/44 59/89/44 60/87/44 75/86/44
f 58/90/45 59/89/45 76/88/45 77/91/45
f 55/7/46 58/90/46 77/91/46
f 91/92/47 90/93/47 79/8/47
f 92/94/48 89/95/48 90/93/48 91/92/48
f 93/96/49 88/97/49 89/95/49 92/94/49
f 94/98/50 87/99/50 88/97/50 93/96/50
f 95/100/51 86/101/51 87/99/51 94/98/51
f 96/102/52 85/103/52 86/101/52 95/100/52
f 97/104/53 84/105/53 85/103/53 96/102/53
f 98/106/54 83/107/54 84/105/54 97/104/54
f 99/108/55 82/109/55 83/107/55 98/106/55
f 81/71/56 82/73/56 99/72/56 100/70/56
f 78/27/57 81/110/57 100/111/57 80/27/57
f 114/112/58 113/113/58 102/11/58 103/11/58
f 115/114/59 112/115/59 113/113/59 114/112/59
f 116/66/60 111/67/60 112/69/60 115/68/60
f 117/64/61 110/65/61 111/67/61 116/66/61
f 118/62/62 109/63/62 110/65/62 117/64/62
f 119/60/63 108/61/63 109/63/63 118/62/63
f 120/58/64 107/59/64 108/61/64 119/60/64
f 121/56/65 106/57/65 107/59/65 120/58/65
f 122/54/66 105/55/66 106/57/66 121/56/66
f 104/53/67 105/55/67 122/54/67 123/52/67
f 101/9/68 104/53/68 123/52/68
f 137/51/69 136/50/69 125/6/69
f 138/48/70 135/49/70 136/50/70 137/51/70
f 139/46/71 134/47/71 135/49/71 138/48/71
f 140/44/72 133/45/72 134/47/72 139/46/72
f 141/42/73 132/43/73 133/45/73 140/44/73
f 142/40/74 131/41/74 132/43/74 141/42/74
f 143/38/75 130/39/75 131/41/75 142/40/75
f 144/34/76 129/35/76 130/39/76 143/38/76
f 145/37/77 128/36/77 129/35/77 144/34/77
f 127/116/78 128/117/78 145/118/78 146/119/78
f 124/11/79 127/120/79 146/121/79 126/11/79
f 160/119/80 159/116/80 148/122/80 149/122/80
f 161/118/81 158/117/81 159/116/81 160/119/81
f 162/106/82 157/107/82 158/109/82 161/108/82
f 163/104/83 156/105/83 157/107/83 162/106/83
f 164/102/84 155/103/84 156/105/84 163/104/84
f 165/100/85 154/101/85 155/103/85 164/102/85
f 166/98/86 153/99/86 154/101/86 165/100/86
f 167/96/87 152/97/87 153/99/87 166/98/87
f 168/94/88 151/95/88 152/97/88 167/96/88
f 150/93/89 151/95/89 168/94/89 169/92/89
f 147/8/90 150/93/90 169/92/90
f 183/91/91 182/90/91 171/7/91
f 184/88/92 181/89/92 182/90/92 183/91/92
f 185/86/93 180/87/93 181/89/93 184/88/93
f 186/84/94 179/85/94 180/87/94 185/86/94
f 187/82/95 178/83/95 179/85/95 186/84/95
f 188/80/96 177/81/96 178/83/96 187/82/96
f 189/78/97 176/79/97 177/81/97 188/80/97
f 190/74/98 175/75/98 176/79/98 189/78/98
f 191/77/99 174/76/99 175/75/99 190/74/99
f 173/116/100 174/117/100 191/118/100 192/119/100
f 170/11/101 173/121/101 192/120/101 172/11/101
f 9/6/102 33/9/102 44/53/102 12/50/102
f 12/50/103 44/53/103 43/55/103 13/49/103
f 13/49/104 43/55/104 42/57/104 14/47/104
f 14/47/105 42/57/105 41/59/105 15/45/105
f 15/45/106 41/59/106 40/61/106 16/43/106
f 16/123/107 40/124/107 39/125/107 17/126/107
f 17/126/108 39/125/108 38/127/108 18/128/108
f 18/128/109 38/127/109 37/129/109 19/130/109
f 19/130/110 37/129/110 36/32/110 20/73/110
f 20/73/111 36/32/111 35/30/111 21/71/111
f 21/71/112 35/30/112 32/1/112 10/27/112
f 11/1/113 56/27/113 67/71/113 22/30/113
f 22/30/114 67/71/114 66/73/114 23/32/114
f 23/32/115 66/73/115 65/130/115 24/129/115
f 24/129/116 65/130/116 64/128/116 25/127/116
f 25/127/117 64/128/117 63/126/117 26/125/117
f 26/125/118 63/126/118 62/123/118 27/124/118
f 27/42/119 62/83/119 61/85/119 28/44/119
f 28/44/120 61/85/120 60/87/120 29/46/120
f 29/46/121 60/87/121 59/89/121 30/48/121
f 30/48/122 59/89/122 58/90/122 31/51/122
f 31/51/123 58/90/123 55/7/123 9/6/123
f 33/9/124 79/8/124 90/93/124 45/52/124
f 45/52/125 90/93/125 89/95/125 46/54/125
f 46/54/126 89/95/126 88/97/126 47/56/126
f 47/56/127 88/97/127 87/99/127 48/58/127
f 48/58/128 87/99/128 86/101/128 49/60/128
f 49/124/129 86/123/129 85/126/129 50/125/129
f 50/125/130 85/126/130 84/128/130 51/127/130
f 51/127/131 84/128/131 83/130/131 52/129/131
f 52/129/132 83/130/132 82/73/132 53/32/132
f 53/32/133 82/73/133 81/71/133 54/30/133
f 54/30/134 81/71/134 78/27/134 34/1/134
f 57/27/135 80/1/135 100/30/135 68/71/135
f 68/71/136 100/30/136 99/32/136 69/73/136
f 69/73/137 99/32/137 98/129/137 70/130/137
f 70/130/138 98/129/138 97/127/138 71/128/138
f 71/128/139 97/127/139 96/125/139 72/126/139
f 72/126/140 96/125/140 95/124/140 73/123/140
f 73/82/141 95/100/141 94/98/141 74/84/141
f 74/84/142 94/98/142 93/96/142 75/86/142
f 75/86/143 93/96/143 92/94/143 76/88/143
f 76/88/144 92/94/144 91/92/144 77/91/144
f 77/91/145 91/92/145 79/8/145 55/7/145
f 101/9/146 125/6/146 136/50/146 104/53/146
f 104/53/147 136/50/147 135/49/147 105/55/147
f 105/55/148 135/49/148 134/47/148 106/57/148
f 106/57/149 134/47/149 133/45/149 107/59/149
f 107/59/150 133/45/150 132/43/150 108/61/150
f 108/131/151 132/132/151 131/133/151 109/134/151
f 109/134/152 131/133/152 130/135/152 110/136/152
f 110/136/153 130/135/153 129/137/153 111/138/153
f 111/138/154 129/137/154 128/117/154 112/115/154
f 112/115/155 128/117/155 127/116/155 113/113/155
f 113/113/156 127/116/156 124/122/156 102/11/156
f 103/122/157 148/139/157 159/140/157 114/141/157
f 114/113/158 159/116/158 158/117/158 115/115/158
f 115/115/159 158/117/159 157/137/159 116/138/159
f 116/138/160 157/137/160 156/135/160 117/136/160
f 117/136/161 156/135/161 155/133/161 118/134/161
f 118/134/162 155/133/162 154/132/162 119/131/162
f 119/60/163 154/101/163 153/99/163 120/58/163
f 120/58/164 153/99/164 152/97/164 121/56/164
f 121/56/165 152/97/165 151/95/165 122/54/165
f 122/54/166 151/95/166 150/93/166 123/52/166
f 123/52/167 150/93/167 147/8/167 101/9/167
f 125/6/168 171/7/168 182/90/168 137/51/168
f 137/51/169 182/90/169 181/89/169 138/48/169
f 138/48/170 181/89/170 180/87/170 139/46/170
f 139/46/171 180/87/171 179/85/171 140/44/171
f 140/44/172 179/85/172 178/83/172 141/42/172
f 141/131/173 178/132/173 177/133/173 142/134/173
f 142/134/174 177/133/174 176/135/174 143/136/174
f 143/136/175 176/135/175 175/137/175 144/138/175
f 144/138/176 175/137/176 174/117/176 145/115/176
f 145/115/177 174/117/177 173/116/177 146/113/177
f 146/113/178 173/116/178 170/122/178 126/11/178
f 149/11/179 172/122/179 192/116/179 160/113/179
f 160/113/180 192/116/180 191/117/180 161/115/180
f 161/115/181 191/117/181 190/137/181 162/138/181
f 162/138/182 190/137/182 189/135/182 163/136/182
f 163/136/183 189/135/183 188/133/183 164/134/183
f 164/134/184 188/133/184 187/132/184 165/131/184
f 165/100/185 187/82/185 186/84/185 166/98/185
f 166/98/186 186/84/186 185/86/186 167/96/186
f 167/96/187 185/86/187 184/88/187 168/94/187
f 168/94/188 184/88/188 183/91/188 169/92/188
f 169/92/189 183/91/189 171/7/189 147/8/189
f 32/142/190 34/142/190 103/143/190 102/143/190 124/144/190 126/144/190 11/145/190 10/145/190

936
Levels/Geometry/Column.obj Normal file
View File

@ -0,0 +1,936 @@
# Blender v2.72 (sub 0) OBJ File: 'ruins_column.blend'
# www.blender.org
o Cube
v 0.366457 0.983043 -0.928802
v 0.376163 1.000000 -0.908138
v 0.397638 0.983043 -0.915886
v 0.397638 -0.983043 -0.915886
v 0.376163 -1.000000 -0.908138
v 0.366457 -0.983043 -0.928802
v 0.178215 0.983043 -0.982447
v 0.191766 1.000000 -0.964074
v 0.211317 0.983043 -0.975863
v 0.211317 -0.983043 -0.975863
v 0.191766 -1.000000 -0.964074
v 0.178215 -0.983043 -0.982447
v 0.016875 0.983043 -0.998338
v -0.016875 0.983043 -0.998338
v -0.000000 1.000000 -0.982961
v -0.000000 -1.000000 -0.982961
v -0.016875 -0.983043 -0.998338
v 0.016875 -0.983043 -0.998338
v 0.568678 -0.983043 -0.820712
v 0.546104 -1.000000 -0.817302
v 0.540616 -0.983043 -0.839463
v 0.540616 0.983043 -0.839463
v 0.546104 1.000000 -0.817302
v 0.568678 0.983043 -0.820712
v 0.717864 -0.983043 -0.693999
v 0.695058 -1.000000 -0.695058
v 0.693999 -0.983043 -0.717864
v 0.693999 0.983043 -0.717864
v 0.695058 1.000000 -0.695058
v 0.717864 0.983043 -0.693999
v 0.839463 -0.983043 -0.540616
v 0.817302 -1.000000 -0.546104
v 0.820712 -0.983043 -0.568678
v 0.820712 0.983043 -0.568678
v 0.817302 1.000000 -0.546104
v 0.839463 0.983043 -0.540616
v 0.928802 -0.983043 -0.366457
v 0.908138 -1.000000 -0.376163
v 0.915886 -0.983043 -0.397638
v 0.915886 0.983043 -0.397638
v 0.908138 1.000000 -0.376163
v 0.928802 0.983043 -0.366457
v 0.982447 -0.983043 -0.178215
v 0.964074 -1.000000 -0.191766
v 0.975863 -0.983043 -0.211317
v 0.975863 0.983043 -0.211317
v 0.964074 1.000000 -0.191766
v 0.982447 0.983043 -0.178215
v 0.998338 -0.983043 0.016875
v 0.982961 -1.000000 -0.000000
v 0.998338 -0.983043 -0.016875
v 0.998338 0.983043 -0.016875
v 0.982961 1.000000 -0.000000
v 0.998338 0.983043 0.016875
v 0.975863 -0.983043 0.211317
v 0.964074 -1.000000 0.191766
v 0.982447 -0.983043 0.178215
v 0.982447 0.983043 0.178215
v 0.964074 1.000000 0.191766
v 0.975863 0.983043 0.211317
v 0.915886 -0.983043 0.397638
v 0.908138 -1.000000 0.376163
v 0.928802 -0.983043 0.366457
v 0.928802 0.983043 0.366457
v 0.908138 1.000000 0.376163
v 0.915886 0.983043 0.397638
v 0.820712 -0.983043 0.568678
v 0.817302 -1.000000 0.546104
v 0.839463 -0.983043 0.540616
v 0.839463 0.983043 0.540616
v 0.817302 1.000000 0.546104
v 0.820712 0.983043 0.568678
v 0.693999 -0.983043 0.717864
v 0.695058 -1.000000 0.695058
v 0.717864 -0.983043 0.693999
v 0.717864 0.983043 0.693999
v 0.695058 1.000000 0.695058
v 0.693999 0.983043 0.717864
v 0.540616 -0.983043 0.839463
v 0.546104 -1.000000 0.817302
v 0.568678 -0.983043 0.820712
v 0.568678 0.983043 0.820712
v 0.546104 1.000000 0.817302
v 0.540616 0.983043 0.839463
v 0.366457 -0.983043 0.928802
v 0.376163 -1.000000 0.908138
v 0.397638 -0.983043 0.915886
v 0.397638 0.983043 0.915886
v 0.376163 1.000000 0.908138
v 0.366457 0.983043 0.928802
v 0.178215 -0.983043 0.982447
v 0.191766 -1.000000 0.964074
v 0.211317 -0.983043 0.975863
v 0.211317 0.983043 0.975863
v 0.191766 1.000000 0.964074
v 0.178215 0.983043 0.982447
v -0.016876 -0.983043 0.998338
v -0.000000 -1.000000 0.982961
v 0.016875 -0.983043 0.998338
v 0.016875 0.983043 0.998338
v -0.000000 1.000000 0.982961
v -0.016876 0.983043 0.998338
v -0.211317 -0.983043 0.975863
v -0.191767 -1.000000 0.964074
v -0.178216 -0.983043 0.982447
v -0.178216 0.983043 0.982447
v -0.191767 1.000000 0.964074
v -0.211317 0.983043 0.975863
v -0.397638 -0.983043 0.915886
v -0.376163 -1.000000 0.908137
v -0.366457 -0.983043 0.928802
v -0.366457 0.983043 0.928802
v -0.376163 1.000000 0.908137
v -0.397638 0.983043 0.915886
v -0.568679 -0.983043 0.820712
v -0.546104 -1.000000 0.817302
v -0.540616 -0.983043 0.839463
v -0.540616 0.983043 0.839463
v -0.546104 1.000000 0.817302
v -0.568679 0.983043 0.820712
v -0.717865 -0.983043 0.693999
v -0.695059 -1.000000 0.695058
v -0.693999 -0.983043 0.717864
v -0.693999 0.983043 0.717864
v -0.695059 1.000000 0.695058
v -0.717865 0.983043 0.693999
v -0.839463 -0.983043 0.540615
v -0.817303 -1.000000 0.546103
v -0.820713 -0.983043 0.568677
v -0.820713 0.983043 0.568677
v -0.817303 1.000000 0.546103
v -0.839463 0.983043 0.540615
v -0.928802 -0.983043 0.366456
v -0.908138 -1.000000 0.376162
v -0.915886 -0.983043 0.397637
v -0.915886 0.983043 0.397637
v -0.908138 1.000000 0.376162
v -0.928802 0.983043 0.366456
v -0.982448 -0.983043 0.178214
v -0.964074 -1.000000 0.191765
v -0.975863 -0.983043 0.211316
v -0.975863 0.983043 0.211316
v -0.964074 1.000000 0.191765
v -0.982448 0.983043 0.178214
v -0.998338 -0.983043 -0.016876
v -0.982961 -1.000000 -0.000001
v -0.998338 -0.983043 0.016874
v -0.998338 0.983043 0.016874
v -0.982961 1.000000 -0.000001
v -0.998338 0.983043 -0.016876
v -0.975863 -0.983043 -0.211318
v -0.964074 -1.000000 -0.191767
v -0.982447 -0.983043 -0.178216
v -0.982447 0.983043 -0.178216
v -0.964074 1.000000 -0.191767
v -0.975863 0.983043 -0.211318
v -0.915886 -0.983043 -0.397639
v -0.908137 -1.000000 -0.376164
v -0.928801 -0.983043 -0.366458
v -0.928801 0.983043 -0.366458
v -0.908137 1.000000 -0.376164
v -0.915886 0.983043 -0.397639
v -0.820712 -0.983043 -0.568679
v -0.817302 -1.000000 -0.546105
v -0.839462 -0.983043 -0.540617
v -0.839462 0.983043 -0.540617
v -0.817302 1.000000 -0.546105
v -0.820712 0.983043 -0.568679
v -0.693998 -0.983043 -0.717865
v -0.695058 -1.000000 -0.695059
v -0.717863 -0.983043 -0.694000
v -0.717863 0.983043 -0.694000
v -0.695058 1.000000 -0.695059
v -0.693998 0.983043 -0.717865
v -0.540614 -0.983043 -0.839464
v -0.546103 -1.000000 -0.817303
v -0.568677 -0.983043 -0.820713
v -0.568677 0.983043 -0.820713
v -0.546103 1.000000 -0.817303
v -0.540614 0.983043 -0.839464
v -0.366455 -0.983043 -0.928802
v -0.376162 -1.000000 -0.908138
v -0.397637 -0.983043 -0.915887
v -0.397637 0.983043 -0.915887
v -0.376162 1.000000 -0.908138
v -0.366455 0.983043 -0.928802
v -0.178214 -0.983043 -0.982448
v -0.191765 -1.000000 -0.964074
v -0.211316 -0.983043 -0.975863
v -0.211316 0.983043 -0.975863
v -0.191765 1.000000 -0.964074
v -0.178214 0.983043 -0.982448
vt 0.302972 0.503043
vt 0.302972 0.995751
vt 0.279010 0.995751
vt 0.279010 0.503043
vt 0.403686 0.503043
vt 0.403686 0.995751
vt 0.374867 0.995751
vt 0.374867 0.503043
vt 0.355657 0.225252
vt 0.362339 0.177890
vt 0.375448 0.133276
vt 0.394479 0.093125
vt 0.418700 0.058979
vt 0.447181 0.032150
vt 0.478828 0.013670
vt 0.512424 0.004250
vt 0.546679 0.004249
vt 0.580275 0.013670
vt 0.611922 0.032150
vt 0.640403 0.058978
vt 0.664625 0.093124
vt 0.683655 0.133276
vt 0.696764 0.177890
vt 0.703447 0.225252
vt 0.703447 0.273541
vt 0.696764 0.320903
vt 0.683656 0.365517
vt 0.664625 0.405669
vt 0.640404 0.439815
vt 0.611922 0.466643
vt 0.580275 0.485123
vt 0.546679 0.494544
vt 0.512425 0.494544
vt 0.478829 0.485123
vt 0.447182 0.466643
vt 0.418700 0.439815
vt 0.394479 0.405669
vt 0.375448 0.365517
vt 0.362339 0.320903
vt 0.355657 0.273542
vt 0.744031 0.503043
vt 0.744031 0.995751
vt 0.718615 0.995751
vt 0.718615 0.503043
vt 0.713072 0.503043
vt 0.713072 0.995751
vt 0.685493 0.995751
vt 0.685493 0.503043
vt 0.679609 0.503043
vt 0.679609 0.995751
vt 0.650928 0.995751
vt 0.650928 0.503043
vt 0.644929 0.503043
vt 0.644929 0.995751
vt 0.616248 0.995751
vt 0.616248 0.503043
vt 0.610364 0.503043
vt 0.610364 0.995751
vt 0.582785 0.995751
vt 0.582785 0.503043
vt 0.577242 0.503043
vt 0.577242 0.995751
vt 0.551826 0.995751
vt 0.551826 0.503043
vt 0.546837 0.503043
vt 0.546837 0.995751
vt 0.524560 0.995751
vt 0.524560 0.503043
vt 0.995012 0.503043
vt 0.995012 0.995750
vt 0.969595 0.995750
vt 0.969595 0.503043
vt 0.964052 0.503043
vt 0.964052 0.995751
vt 0.936474 0.995751
vt 0.936474 0.503043
vt 0.930589 0.503043
vt 0.930589 0.995750
vt 0.901909 0.995751
vt 0.901909 0.503043
vt 0.895909 0.503043
vt 0.895909 0.995750
vt 0.867228 0.995750
vt 0.867228 0.503043
vt 0.861344 0.503043
vt 0.861344 0.995750
vt 0.833765 0.995750
vt 0.833766 0.503043
vt 0.828223 0.503043
vt 0.828223 0.995751
vt 0.802806 0.995751
vt 0.802806 0.503043
vt 0.797818 0.503043
vt 0.797818 0.995750
vt 0.775540 0.995751
vt 0.775540 0.503043
vt 0.000000 0.995750
vt 0.000000 0.503043
vt 0.020378 0.503043
vt 0.020378 0.995750
vt 0.025016 0.995750
vt 0.025016 0.503043
vt 0.048979 0.503043
vt 0.048979 0.995750
vt 0.054270 0.995750
vt 0.054270 0.503043
vt 0.080896 0.503043
vt 0.080896 0.995750
vt 0.086637 0.995750
vt 0.086637 0.503043
vt 0.114903 0.503043
vt 0.114903 0.995750
vt 0.120873 0.995750
vt 0.120873 0.503043
vt 0.149693 0.503043
vt 0.149693 0.995751
vt 0.155663 0.995751
vt 0.155664 0.503043
vt 0.183929 0.503043
vt 0.183929 0.995751
vt 0.189670 0.995750
vt 0.189670 0.503043
vt 0.216296 0.503043
vt 0.216296 0.995750
vt 0.221587 0.995751
vt 0.221587 0.503043
vt 0.245550 0.503043
vt 0.245550 0.995751
vt 0.250188 0.995750
vt 0.250188 0.503043
vt 0.270566 0.503043
vt 0.270566 0.995750
vt 0.504181 0.995751
vt 0.504181 0.503043
vt 0.499543 0.503043
vt 0.499543 0.995751
vt 0.475581 0.995751
vt 0.475581 0.503043
vt 0.470290 0.503043
vt 0.470290 0.995751
vt 0.443664 0.995751
vt 0.443664 0.503043
vt 0.437923 0.503043
vt 0.437923 0.995751
vt 0.409657 0.995751
vt 0.409657 0.503043
vt 0.771297 0.503043
vt 0.771297 0.995751
vt 0.749020 0.995751
vt 0.749020 0.503043
vt 0.368896 0.503043
vt 0.368896 0.995751
vt 0.340631 0.995751
vt 0.340631 0.503043
vt 0.334889 0.503043
vt 0.334889 0.995751
vt 0.308264 0.995751
vt 0.308264 0.503043
vt 0.286588 0.445477
vt 0.287173 0.439815
vt 0.291226 0.440111
vt 0.374451 0.127730
vt 0.371623 0.135189
vt 0.338553 1.000000
vt 0.338553 0.498793
vt 0.372150 1.000000
vt 0.372150 0.498793
vt 0.394269 0.087411
vt 0.390463 0.093949
vt 0.311604 0.411383
vt 0.311394 0.405669
vt 0.315410 0.404845
vt 0.419285 0.053317
vt 0.414647 0.058683
vt 0.331421 0.371064
vt 0.330425 0.365518
vt 0.334250 0.363605
vt 0.714797 0.498793
vt 0.714797 1.000000
vt 0.682018 0.498793
vt 0.682018 1.000000
vt 0.647928 0.498793
vt 0.647928 1.000000
vt 0.613839 0.498793
vt 0.613839 1.000000
vt 0.581060 0.498793
vt 0.581060 1.000000
vt 0.615856 0.030745
vt 0.610565 0.026758
vt 0.315410 0.093949
vt 0.311394 0.093125
vt 0.311604 0.087411
vt 0.644456 0.058682
vt 0.639818 0.053317
vt 0.291226 0.058683
vt 0.287173 0.058979
vt 0.286588 0.053317
vt 0.965778 0.498793
vt 0.965778 1.000000
vt 0.932998 0.498793
vt 0.932998 1.000000
vt 0.898909 0.498793
vt 0.898909 1.000000
vt 0.864819 0.498793
vt 0.864819 1.000000
vt 0.832040 0.498793
vt 0.832040 1.000000
vt 0.698509 0.326069
vt 0.700251 0.317975
vt 0.095308 0.026758
vt 0.093951 0.032150
vt 0.090017 0.030745
vt 0.684652 0.371063
vt 0.687480 0.363604
vt 0.066055 0.053317
vt 0.065470 0.058978
vt 0.061417 0.058682
vt 0.664835 0.411382
vt 0.668641 0.404844
vt 0.041038 0.087411
vt 0.041248 0.093124
vt 0.037232 0.093949
vt 0.639819 0.445476
vt 0.644456 0.440111
vt 0.021221 0.127730
vt 0.022218 0.133276
vt 0.018393 0.135189
vt 0.084560 1.000000
vt 0.084560 0.498793
vt 0.118156 1.000000
vt 0.118156 0.498793
vt 0.152410 1.000000
vt 0.152410 0.498793
vt 0.186006 1.000000
vt 0.186006 0.498793
vt 0.475164 0.487583
vt 0.480906 0.490038
vt 0.018393 0.363604
vt 0.022217 0.365517
vt 0.021221 0.371063
vt 0.443248 0.468048
vt 0.448539 0.472035
vt 0.037232 0.404844
vt 0.041248 0.405669
vt 0.041038 0.411382
vt 0.414647 0.440111
vt 0.419285 0.445477
vt 0.061417 0.440111
vt 0.065470 0.439815
vt 0.066054 0.445477
vt 0.390463 0.404844
vt 0.394269 0.411383
vt 0.090017 0.468048
vt 0.093951 0.466643
vt 0.095308 0.472035
vt 0.371623 0.363604
vt 0.374451 0.371064
vt 0.121934 0.487583
vt 0.125598 0.485123
vt 0.127675 0.490038
vt 0.440000 0.498793
vt 0.440000 1.000000
vt 0.406404 0.498793
vt 0.406404 1.000000
vt 0.262625 0.468048
vt 0.258691 0.466643
vt 0.360595 0.172725
vt 0.257334 0.472035
vt 0.230708 0.487583
vt 0.227044 0.485123
vt 0.353231 0.220666
vt 0.358853 0.180818
vt 0.274372 0.995751
vt 0.274372 0.503043
vt 0.443247 0.030745
vt 0.345278 0.326069
vt 0.343533 0.320904
vt 0.448539 0.026758
vt 0.475164 0.011210
vt 0.352642 0.278128
vt 0.347020 0.317975
vt 0.350216 0.273542
vt 0.480905 0.008755
vt 0.509171 0.000829
vt 0.353231 0.229083
vt 0.353231 0.269711
vt 0.350216 0.225252
vt 0.515142 0.000000
vt 0.543961 0.000000
vt 0.347020 0.180818
vt 0.352642 0.220666
vt 0.343534 0.177890
vt 0.549932 0.000829
vt 0.578198 0.008755
vt 0.334250 0.135189
vt 0.345279 0.172725
vt 0.330425 0.133276
vt 0.583939 0.011210
vt 0.331422 0.127730
vt 1.000000 0.503043
vt 1.000000 0.995751
vt 0.664835 0.087410
vt 0.262626 0.030745
vt 0.258692 0.032150
vt 0.668641 0.093949
vt 0.684652 0.127729
vt 0.230709 0.011210
vt 0.257335 0.026758
vt 0.227045 0.013670
vt 0.687480 0.135189
vt 0.698509 0.172724
vt 0.196702 0.000829
vt 0.224968 0.008755
vt 0.193449 0.004249
vt 0.700251 0.180818
vt 0.705873 0.220665
vt 0.161912 0.000000
vt 0.190731 0.000000
vt 0.159194 0.004249
vt 0.706461 0.229082
vt 0.706461 0.269710
vt 0.127675 0.008755
vt 0.155941 0.000829
vt 0.125598 0.013670
vt 0.705873 0.278128
vt 0.121934 0.011210
vt 0.615856 0.468048
vt 0.007364 0.172724
vt 0.009109 0.177890
vt 0.610565 0.472035
vt 0.583939 0.487583
vt 0.000000 0.220665
vt 0.005622 0.180818
vt 0.002426 0.225252
vt 0.578198 0.490038
vt 0.549932 0.497964
vt 0.543962 0.498793
vt 0.515142 0.498793
vt 0.005622 0.317975
vt 0.000000 0.278128
vt 0.002426 0.273541
vt 0.009109 0.320903
vt 0.509171 0.497964
vt 0.007364 0.326069
vt 0.360595 0.326069
vt 0.155941 0.497964
vt 0.159194 0.494544
vt 0.358853 0.317975
vt 0.353231 0.278128
vt 0.190731 0.498793
vt 0.161912 0.498793
vt 0.193448 0.494544
vn 0.471400 0.000000 -0.881900
vn -0.098000 0.000000 -0.995200
vn 0.000000 -1.000000 0.000000
vn 0.773000 0.000000 -0.634400
vn 0.881900 0.000000 -0.471400
vn 0.956900 0.000000 -0.290300
vn 0.995200 0.000000 -0.098000
vn 0.995200 0.000000 0.098000
vn 0.956900 0.000000 0.290300
vn 0.881900 0.000000 0.471400
vn 0.773000 0.000000 0.634400
vn 0.634400 0.000000 0.773000
vn 0.471400 0.000000 0.881900
vn 0.290300 0.000000 0.956900
vn 0.098000 0.000000 0.995200
vn -0.098000 0.000000 0.995200
vn -0.290300 0.000000 0.956900
vn -0.471400 0.000000 0.881900
vn -0.634400 0.000000 0.773000
vn -0.773000 0.000000 0.634400
vn -0.881900 0.000000 0.471400
vn -0.956900 -0.000000 0.290300
vn -0.995200 0.000000 0.098000
vn -0.995200 0.000000 -0.098000
vn -0.956900 0.000000 -0.290300
vn -0.881900 0.000000 -0.471400
vn -0.773000 0.000000 -0.634400
vn -0.634400 0.000000 -0.773000
vn -0.471400 0.000000 -0.881900
vn -0.290300 0.000000 -0.956900
vn 0.634400 0.000000 -0.773000
vn 0.098000 0.000000 -0.995200
vn 0.290300 0.000000 -0.956900
vn 0.283500 0.671800 -0.684400
vn 0.283500 -0.671800 -0.684400
vn 0.144500 0.671800 -0.726500
vn 0.144500 -0.671800 -0.726500
vn 0.000000 0.671800 -0.740800
vn 0.000000 -0.671800 -0.740800
vn 0.411500 -0.671800 -0.615900
vn 0.411500 0.671700 -0.615900
vn 0.523800 -0.671800 -0.523800
vn 0.523800 0.671800 -0.523800
vn 0.615900 -0.671700 -0.411600
vn 0.615900 0.671700 -0.411600
vn 0.684400 -0.671800 -0.283500
vn 0.684400 0.671800 -0.283500
vn 0.726500 -0.671800 -0.144500
vn 0.726500 0.671800 -0.144500
vn 0.740800 -0.671800 0.000000
vn 0.740800 0.671800 0.000000
vn 0.726500 -0.671800 0.144500
vn 0.726500 0.671800 0.144500
vn 0.684400 -0.671800 0.283500
vn 0.684400 0.671800 0.283500
vn 0.615900 -0.671700 0.411600
vn 0.615900 0.671700 0.411600
vn 0.523800 -0.671700 0.523800
vn 0.523800 0.671800 0.523800
vn 0.411600 -0.671700 0.615900
vn 0.411600 0.671700 0.615900
vn 0.283500 -0.671700 0.684400
vn 0.283500 0.671800 0.684400
vn 0.144500 -0.671800 0.726500
vn 0.144500 0.671800 0.726500
vn 0.000000 -0.671700 0.740800
vn 0.000000 0.671800 0.740800
vn -0.144500 -0.671800 0.726500
vn -0.144500 0.671800 0.726500
vn -0.283500 -0.671800 0.684400
vn -0.283500 0.671700 0.684400
vn -0.411600 -0.671700 0.615900
vn -0.411600 0.671700 0.615900
vn -0.523800 -0.671800 0.523800
vn -0.523800 0.671700 0.523800
vn -0.615900 -0.671700 0.411600
vn -0.615900 0.671700 0.411600
vn -0.684400 -0.671800 0.283500
vn -0.684400 0.671800 0.283500
vn -0.726500 -0.671800 0.144500
vn -0.726500 0.671800 0.144500
vn -0.740800 -0.671800 0.000000
vn -0.740800 0.671800 0.000000
vn -0.726500 -0.671800 -0.144500
vn -0.726500 0.671800 -0.144500
vn -0.684400 -0.671800 -0.283500
vn -0.684400 0.671800 -0.283500
vn -0.615900 -0.671700 -0.411600
vn -0.615900 0.671700 -0.411600
vn -0.523800 -0.671800 -0.523800
vn -0.523800 0.671800 -0.523800
vn -0.411600 -0.671700 -0.615900
vn -0.411600 0.671700 -0.615900
vn -0.283500 -0.671800 -0.684400
vn -0.283500 0.671800 -0.684400
vn -0.144500 -0.671800 -0.726500
vn -0.144500 0.671800 -0.726500
vn 0.205300 0.707100 -0.676700
vn 0.205300 -0.707100 -0.676700
vn 0.195100 0.000000 -0.980800
vn 0.000000 0.000000 -1.000000
vn 0.069300 0.707100 -0.703700
vn 0.069300 -0.707100 -0.703700
vn 0.382700 0.000000 -0.923900
vn 0.333300 -0.707100 -0.623600
vn 0.333300 0.707100 -0.623600
vn 0.555600 0.000000 -0.831500
vn 0.448600 -0.707100 -0.546600
vn 0.448600 0.707100 -0.546600
vn 0.707100 0.000000 -0.707100
vn 0.546600 -0.707100 -0.448600
vn 0.546600 0.707100 -0.448600
vn 0.831500 0.000000 -0.555600
vn 0.623600 -0.707100 -0.333300
vn 0.623600 0.707100 -0.333300
vn 0.923900 0.000000 -0.382700
vn 0.676700 -0.707100 -0.205300
vn 0.676700 0.707100 -0.205300
vn 0.980800 0.000000 -0.195100
vn 0.703700 -0.707100 -0.069300
vn 0.703700 0.707100 -0.069300
vn 1.000000 -0.000000 0.000000
vn 0.703700 -0.707100 0.069300
vn 0.703700 0.707100 0.069300
vn 0.980800 0.000000 0.195100
vn 0.676700 -0.707100 0.205300
vn 0.676700 0.707100 0.205300
vn 0.923900 0.000000 0.382700
vn 0.623600 -0.707100 0.333300
vn 0.623600 0.707100 0.333300
vn 0.831500 0.000000 0.555600
vn 0.546600 -0.707100 0.448600
vn 0.546600 0.707100 0.448600
vn 0.707100 0.000000 0.707100
vn 0.448600 -0.707100 0.546600
vn 0.448600 0.707100 0.546600
vn 0.555600 0.000000 0.831500
vn 0.333300 -0.707100 0.623600
vn 0.333300 0.707100 0.623600
vn 0.382700 0.000000 0.923900
vn 0.205300 -0.707100 0.676700
vn 0.205300 0.707100 0.676700
vn 0.195100 0.000000 0.980800
vn 0.069300 -0.707100 0.703700
vn 0.069300 0.707100 0.703700
vn 0.000000 0.000000 1.000000
vn -0.069300 -0.707100 0.703700
vn -0.069300 0.707100 0.703700
vn -0.195100 0.000000 0.980800
vn -0.205300 -0.707100 0.676700
vn -0.205300 0.707100 0.676700
vn -0.382700 0.000000 0.923900
vn -0.333300 -0.707100 0.623600
vn -0.333300 0.707100 0.623600
vn -0.555600 0.000000 0.831500
vn -0.448600 -0.707100 0.546600
vn -0.448600 0.707100 0.546600
vn -0.707100 0.000000 0.707100
vn -0.546600 -0.707100 0.448600
vn -0.546600 0.707100 0.448600
vn -0.831500 0.000000 0.555600
vn -0.623600 -0.707100 0.333300
vn -0.623600 0.707100 0.333300
vn -0.923900 0.000000 0.382700
vn -0.676700 -0.707100 0.205300
vn -0.676700 0.707100 0.205300
vn -0.980800 0.000000 0.195100
vn -0.703700 -0.707100 0.069300
vn -0.703700 0.707100 0.069300
vn -1.000000 0.000000 0.000000
vn -0.703700 -0.707100 -0.069300
vn -0.703700 0.707100 -0.069300
vn -0.980800 0.000000 -0.195100
vn -0.676700 -0.707100 -0.205300
vn -0.676700 0.707100 -0.205300
vn -0.923900 0.000000 -0.382700
vn -0.623600 -0.707100 -0.333300
vn -0.623600 0.707100 -0.333300
vn -0.831500 0.000000 -0.555600
vn -0.546600 -0.707100 -0.448600
vn -0.546600 0.707100 -0.448600
vn -0.707100 0.000000 -0.707100
vn -0.448600 -0.707100 -0.546600
vn -0.448600 0.707100 -0.546600
vn -0.555600 0.000000 -0.831500
vn -0.333300 -0.707100 -0.623600
vn -0.333300 0.707100 -0.623600
vn -0.382700 0.000000 -0.923900
vn -0.205300 -0.707100 -0.676700
vn -0.205300 0.707100 -0.676700
vn -0.195100 0.000000 -0.980800
vn -0.069300 -0.707100 -0.703700
vn -0.069300 0.707100 -0.703700
vn 0.000000 1.000000 -0.000000
s off
f 4/1/1 3/2/1 22/3/1 21/4/1
f 187/5/2 192/6/2 14/7/2 17/8/2
f 16/9/3 11/10/3 5/11/3 20/12/3 26/13/3 32/14/3 38/15/3 44/16/3 50/17/3 56/18/3 62/19/3 68/20/3 74/21/3 80/22/3 86/23/3 92/24/3 98/25/3 104/26/3 110/27/3 116/28/3 122/29/3 128/30/3 134/31/3 140/32/3 146/33/3 152/34/3 158/35/3 164/36/3 170/37/3 176/38/3 182/39/3 188/40/3
f 25/41/4 30/42/4 34/43/4 33/44/4
f 31/45/5 36/46/5 40/47/5 39/48/5
f 37/49/6 42/50/6 46/51/6 45/52/6
f 43/53/7 48/54/7 52/55/7 51/56/7
f 49/57/8 54/58/8 58/59/8 57/60/8
f 55/61/9 60/62/9 64/63/9 63/64/9
f 61/65/10 66/66/10 70/67/10 69/68/10
f 67/69/11 72/70/11 76/71/11 75/72/11
f 73/73/12 78/74/12 82/75/12 81/76/12
f 79/77/13 84/78/13 88/79/13 87/80/13
f 85/81/14 90/82/14 94/83/14 93/84/14
f 91/85/15 96/86/15 100/87/15 99/88/15
f 97/89/16 102/90/16 106/91/16 105/92/16
f 103/93/17 108/94/17 112/95/17 111/96/17
f 109/97/18 114/98/18 118/99/18 117/100/18
f 115/101/19 120/102/19 124/103/19 123/104/19
f 121/105/20 126/106/20 130/107/20 129/108/20
f 127/109/21 132/110/21 136/111/21 135/112/21
f 133/113/22 138/114/22 142/115/22 141/116/22
f 139/117/23 144/118/23 148/119/23 147/120/23
f 145/121/24 150/122/24 154/123/24 153/124/24
f 151/125/25 156/126/25 160/127/25 159/128/25
f 157/129/26 162/130/26 166/131/26 165/132/26
f 163/68/27 168/67/27 172/133/27 171/134/27
f 169/135/28 174/136/28 178/137/28 177/138/28
f 175/139/29 180/140/29 184/141/29 183/142/29
f 181/143/30 186/144/30 190/145/30 189/146/30
f 19/147/31 24/148/31 28/149/31 27/150/31
f 18/151/32 13/152/32 7/153/32 12/154/32
f 10/155/33 9/156/33 1/157/33 6/158/33
f 1/159/34 2/160/34 3/161/34
f 4/162/35 5/11/35 6/163/35
f 7/153/36 8/164/36 9/156/36
f 10/155/37 11/165/37 12/154/37
f 13/152/38 14/7/38 15/166/38
f 16/167/39 17/8/39 18/151/39
f 19/168/40 20/12/40 21/169/40
f 22/170/41 23/171/41 24/172/41
f 25/173/42 26/13/42 27/174/42
f 28/175/43 29/176/43 30/177/43
f 31/45/44 32/178/44 33/44/44
f 34/43/45 35/179/45 36/46/45
f 37/49/46 38/180/46 39/48/46
f 40/47/47 41/181/47 42/50/47
f 43/53/48 44/182/48 45/52/48
f 46/51/49 47/183/49 48/54/49
f 49/57/50 50/184/50 51/56/50
f 52/55/51 53/185/51 54/58/51
f 55/61/52 56/186/52 57/60/52
f 58/59/53 59/187/53 60/62/53
f 61/188/54 62/19/54 63/189/54
f 64/190/55 65/191/55 66/192/55
f 67/193/56 68/20/56 69/194/56
f 70/195/57 71/196/57 72/197/57
f 73/73/58 74/198/58 75/72/58
f 76/71/59 77/199/59 78/74/59
f 79/77/60 80/200/60 81/76/60
f 82/75/61 83/201/61 84/78/61
f 85/81/62 86/202/62 87/80/62
f 88/79/63 89/203/63 90/82/63
f 91/85/64 92/204/64 93/84/64
f 94/83/65 95/205/65 96/86/65
f 97/89/66 98/206/66 99/88/66
f 100/87/67 101/207/67 102/90/67
f 103/208/68 104/26/68 105/209/68
f 106/210/69 107/211/69 108/212/69
f 109/213/70 110/27/70 111/214/70
f 112/215/71 113/216/71 114/217/71
f 115/218/72 116/28/72 117/219/72
f 118/220/73 119/221/73 120/222/73
f 121/223/74 122/29/74 123/224/74
f 124/225/75 125/226/75 126/227/75
f 127/109/76 128/228/76 129/108/76
f 130/107/77 131/229/77 132/110/77
f 133/113/78 134/230/78 135/112/78
f 136/111/79 137/231/79 138/114/79
f 139/117/80 140/232/80 141/116/80
f 142/115/81 143/233/81 144/118/81
f 145/121/82 146/234/82 147/120/82
f 148/119/83 149/235/83 150/122/83
f 151/236/84 152/34/84 153/237/84
f 154/238/85 155/239/85 156/240/85
f 157/241/86 158/35/86 159/242/86
f 160/243/87 161/244/87 162/245/87
f 163/246/88 164/36/88 165/247/88
f 166/248/89 167/249/89 168/250/89
f 169/251/90 170/37/90 171/252/90
f 172/253/91 173/254/91 174/255/91
f 175/256/92 176/38/92 177/257/92
f 178/258/93 179/259/93 180/260/93
f 181/143/94 182/261/94 183/142/94
f 184/141/95 185/262/95 186/144/95
f 187/5/96 188/263/96 189/146/96
f 190/145/97 191/264/97 192/6/97
f 1/159/98 9/265/98 8/266/98 2/160/98
f 10/267/99 6/163/99 5/11/99 11/10/99
f 9/156/100 10/155/100 12/154/100 7/153/100
f 17/8/101 14/7/101 13/152/101 18/151/101
f 7/268/102 13/269/102 15/270/102 8/266/102
f 18/271/103 12/272/103 11/10/103 16/9/103
f 3/2/104 4/1/104 6/158/104 1/157/104
f 4/162/105 21/169/105 20/12/105 5/11/105
f 22/170/106 3/161/106 2/160/106 23/171/106
f 24/273/107 19/274/107 21/4/107 22/3/107
f 19/168/108 27/174/108 26/13/108 20/12/108
f 28/175/109 24/172/109 23/171/109 29/176/109
f 30/42/110 25/41/110 27/150/110 28/149/110
f 25/173/111 33/275/111 32/14/111 26/13/111
f 34/276/112 30/177/112 29/176/112 35/277/112
f 36/46/113 31/45/113 33/44/113 34/43/113
f 31/278/114 39/279/114 38/15/114 32/14/114
f 40/280/115 36/281/115 35/277/115 41/282/115
f 42/50/116 37/49/116 39/48/116 40/47/116
f 37/283/117 45/284/117 44/16/117 38/15/117
f 46/285/118 42/286/118 41/282/118 47/287/118
f 48/54/119 43/53/119 45/52/119 46/51/119
f 43/288/120 51/289/120 50/17/120 44/16/120
f 52/290/121 48/291/121 47/287/121 53/292/121
f 54/58/122 49/57/122 51/56/122 52/55/122
f 49/293/123 57/294/123 56/18/123 50/17/123
f 58/295/124 54/296/124 53/292/124 59/297/124
f 60/62/125 55/61/125 57/60/125 58/59/125
f 55/298/126 63/189/126 62/19/126 56/18/126
f 64/190/127 60/299/127 59/297/127 65/191/127
f 66/66/128 61/65/128 63/64/128 64/63/128
f 61/188/129 69/194/129 68/20/129 62/19/129
f 70/195/130 66/192/130 65/191/130 71/196/130
f 72/70/131 67/69/131 69/300/131 70/301/131
f 67/193/132 75/302/132 74/21/132 68/20/132
f 76/303/133 72/197/133 71/196/133 77/304/133
f 78/74/134 73/73/134 75/72/134 76/71/134
f 73/305/135 81/306/135 80/22/135 74/21/135
f 82/307/136 78/308/136 77/304/136 83/309/136
f 84/78/137 79/77/137 81/76/137 82/75/137
f 79/310/138 87/311/138 86/23/138 80/22/138
f 88/312/139 84/313/139 83/309/139 89/314/139
f 90/82/140 85/81/140 87/80/140 88/79/140
f 85/315/141 93/316/141 92/24/141 86/23/141
f 94/317/142 90/318/142 89/314/142 95/319/142
f 96/86/143 91/85/143 93/84/143 94/83/143
f 91/320/144 99/321/144 98/25/144 92/24/144
f 100/322/145 96/323/145 95/319/145 101/324/145
f 102/90/146 97/89/146 99/88/146 100/87/146
f 97/325/147 105/209/147 104/26/147 98/25/147
f 106/210/148 102/326/148 101/324/148 107/211/148
f 108/94/149 103/93/149 105/92/149 106/91/149
f 103/208/150 111/214/150 110/27/150 104/26/150
f 112/215/151 108/212/151 107/211/151 113/216/151
f 114/148/152 109/147/152 111/96/152 112/95/152
f 109/213/153 117/219/153 116/28/153 110/27/153
f 118/220/154 114/217/154 113/216/154 119/221/154
f 120/102/155 115/101/155 117/100/155 118/99/155
f 115/218/156 123/224/156 122/29/156 116/28/156
f 124/225/157 120/222/157 119/221/157 125/226/157
f 126/106/158 121/105/158 123/104/158 124/103/158
f 121/223/159 129/327/159 128/30/159 122/29/159
f 130/328/160 126/227/160 125/226/160 131/329/160
f 132/110/161 127/109/161 129/108/161 130/107/161
f 127/330/162 135/331/162 134/31/162 128/30/162
f 136/332/163 132/333/163 131/329/163 137/334/163
f 138/114/164 133/113/164 135/112/164 136/111/164
f 133/335/165 141/336/165 140/32/165 134/31/165
f 142/115/166 138/114/166 137/231/166 143/233/166
f 144/118/167 139/117/167 141/116/167 142/115/167
f 139/337/168 147/338/168 146/33/168 140/32/168
f 148/339/169 144/340/169 143/341/169 149/342/169
f 150/122/170 145/121/170 147/120/170 148/119/170
f 145/343/171 153/237/171 152/34/171 146/33/171
f 154/238/172 150/344/172 149/342/172 155/239/172
f 156/126/173 151/125/173 153/124/173 154/123/173
f 151/236/174 159/242/174 158/35/174 152/34/174
f 160/243/175 156/240/175 155/239/175 161/244/175
f 162/130/176 157/129/176 159/128/176 160/127/176
f 157/241/177 165/247/177 164/36/177 158/35/177
f 166/248/178 162/245/178 161/244/178 167/249/178
f 168/274/179 163/273/179 165/132/179 166/131/179
f 163/246/180 171/252/180 170/37/180 164/36/180
f 172/253/181 168/250/181 167/249/181 173/254/181
f 174/136/182 169/135/182 171/134/182 172/133/182
f 169/251/183 177/257/183 176/38/183 170/37/183
f 178/258/184 174/255/184 173/254/184 179/259/184
f 180/140/185 175/139/185 177/138/185 178/137/185
f 175/256/186 183/345/186 182/39/186 176/38/186
f 184/346/187 180/260/187 179/259/187 185/347/187
f 186/144/188 181/143/188 183/142/188 184/141/188
f 181/348/189 189/349/189 188/40/189 182/39/189
f 190/350/190 186/351/190 185/347/190 191/352/190
f 192/6/191 187/5/191 189/146/191 190/145/191
f 187/5/192 17/8/192 16/167/192 188/263/192
f 14/7/193 192/6/193 191/264/193 15/166/193
f 2/160/194 8/266/194 15/270/194 191/352/194 185/347/194 179/259/194 173/254/194 167/249/194 161/244/194 155/239/194 149/342/194 143/341/194 137/334/194 131/329/194 125/226/194 119/221/194 113/216/194 107/211/194 101/324/194 95/319/194 89/314/194 83/309/194 77/304/194 71/196/194 65/191/194 59/297/194 53/292/194 47/287/194 41/282/194 35/277/194 29/176/194 23/171/194

File diff suppressed because it is too large Load Diff

1031
Levels/Geometry/skydome.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,240 @@
# Blender v2.72 (sub 0) OBJ File: 'switch_inner.blend'
# www.blender.org
mtllib switch_inner.mtl
o switch_Cube
v 0.952094 -0.488588 -1.000000
v 1.000000 -0.488588 -0.952094
v 0.952094 -0.513173 -0.952094
v 0.976015 -0.488588 -0.993600
v 0.952094 -0.500864 -0.993600
v 0.975003 -0.500345 -0.987383
v 0.993600 -0.500864 -0.952093
v 0.993600 -0.488588 -0.976015
v 0.987383 -0.500345 -0.975003
v 0.952094 -0.509888 -0.976015
v 0.976015 -0.509888 -0.952093
v 0.975003 -0.506698 -0.975003
v 0.952094 -0.513173 0.952094
v 1.000000 -0.488588 0.952094
v 0.952094 -0.488588 1.000000
v 0.976015 -0.509888 0.952094
v 0.952094 -0.509888 0.976015
v 0.975003 -0.506698 0.975003
v 0.993600 -0.488588 0.976015
v 0.993600 -0.500864 0.952094
v 0.987383 -0.500345 0.975003
v 0.952094 -0.500864 0.993600
v 0.976015 -0.488588 0.993600
v 0.975003 -0.500345 0.987383
v -0.952094 -0.513173 0.952093
v -0.952094 -0.488588 1.000000
v -1.000000 -0.488588 0.952093
v -0.952094 -0.509888 0.976015
v -0.976016 -0.509888 0.952093
v -0.975003 -0.506698 0.975003
v -0.976016 -0.488588 0.993600
v -0.952094 -0.500864 0.993600
v -0.975003 -0.500345 0.987383
v -0.993600 -0.500864 0.952093
v -0.993600 -0.488588 0.976015
v -0.987383 -0.500345 0.975003
v -1.000000 -0.488588 -0.952094
v -0.952093 -0.488588 -1.000000
v -0.952093 -0.513173 -0.952094
v -0.993600 -0.488588 -0.976016
v -0.993600 -0.500864 -0.952094
v -0.987383 -0.500345 -0.975003
v -0.952093 -0.500864 -0.993600
v -0.976015 -0.488588 -0.993600
v -0.975003 -0.500345 -0.987383
v -0.976015 -0.509888 -0.952094
v -0.952093 -0.509888 -0.976016
v -0.975003 -0.506698 -0.975003
v 1.000000 0.488588 -0.952093
v 0.952094 0.488588 -0.999999
v 0.952094 0.513173 -0.952093
v 0.993600 0.488588 -0.976015
v 0.993600 0.500864 -0.952093
v 0.987383 0.500345 -0.975002
v 0.952094 0.500864 -0.993599
v 0.976016 0.488588 -0.993599
v 0.975003 0.500345 -0.987382
v 0.976016 0.509888 -0.952093
v 0.952094 0.509888 -0.976015
v 0.975003 0.506698 -0.975002
v 0.952093 0.513173 0.952094
v 0.952093 0.488588 1.000001
v 0.999999 0.488588 0.952094
v 0.952093 0.509888 0.976016
v 0.976015 0.509888 0.952094
v 0.975002 0.506698 0.975004
v 0.976015 0.488588 0.993601
v 0.952093 0.500864 0.993601
v 0.975002 0.500345 0.987384
v 0.993599 0.500864 0.952094
v 0.993599 0.488588 0.976016
v 0.987382 0.500345 0.975004
v -0.952094 0.513173 0.952093
v -1.000000 0.488588 0.952093
v -0.952094 0.488588 1.000000
v -0.976016 0.509888 0.952093
v -0.952094 0.509888 0.976015
v -0.975003 0.506698 0.975003
v -0.993600 0.488588 0.976015
v -0.993600 0.500864 0.952093
v -0.987383 0.500345 0.975003
v -0.952094 0.500864 0.993600
v -0.976016 0.488588 0.993600
v -0.975003 0.500345 0.987383
v -0.952094 0.488588 -1.000000
v -1.000000 0.488588 -0.952094
v -0.952094 0.513173 -0.952094
v -0.976015 0.488588 -0.993600
v -0.952093 0.500864 -0.993600
v -0.975003 0.500345 -0.987383
v -0.993600 0.500864 -0.952094
v -0.993600 0.488588 -0.976015
v -0.987383 0.500345 -0.975003
v -0.952093 0.509888 -0.976015
v -0.976015 0.509888 -0.952094
v -0.975003 0.506698 -0.975003
vt 0.856329 0.657341
vt 0.856328 0.374264
vt 0.426513 0.374264
vt 0.426513 0.657341
vt 0.853302 0.976215
vt 0.654950 0.976215
vt 0.654950 0.693138
vt 0.853302 0.693138
vt 0.861728 0.374264
vt 0.861500 0.370859
vt 0.856328 0.370708
vt 0.865697 0.374264
vt 0.864294 0.370859
vt 0.865697 0.657341
vt 0.861728 0.657341
vt 0.861500 0.660747
vt 0.864294 0.660747
vt 0.856328 0.660897
vt 0.856328 0.663512
vt 0.861500 0.662587
vt 0.421113 0.374264
vt 0.421342 0.370859
vt 0.426513 0.370708
vt 0.856328 0.368094
vt 0.861500 0.369018
vt 0.426513 0.368094
vt 0.421342 0.369018
vt 0.417144 0.374264
vt 0.418547 0.370859
vt 0.426513 0.663512
vt 0.426513 0.660897
vt 0.421342 0.660747
vt 0.421342 0.662587
vt 0.421113 0.657341
vt 0.417144 0.657341
vt 0.418547 0.660747
vt 0.851966 0.978445
vt 0.851966 0.695368
vt 0.659461 0.695368
vt 0.659461 0.978445
usemtl Material
s 1
f 50/1 1/2 38/3 85/4
f 15/2 62/1 75/4 26/3
f 27/3 74/4 86/1 37/2
f 51/5 87/6 73/7 61/8
f 2/2 49/1 63/4 14/3
f 1/2 4/9 6/10 5/11
f 4/9 8/12 9/13 6/10
f 2/2 7/11 9/10 8/9
f 7/14 11/15 12/16 9/17
f 3/1 10/18 12/16 11/15
f 10/18 5/19 6/20 12/16
f 6/20 9/17 12/16
f 13/2 16/9 18/10 17/11
f 16/9 20/12 21/13 18/10
f 14/3 19/21 21/22 20/23
f 19/12 23/9 24/10 21/13
f 15/2 22/11 24/10 23/9
f 22/24 17/11 18/10 24/25
f 18/10 21/13 24/25
f 25/3 28/23 30/22 29/21
f 28/23 32/26 33/27 30/22
f 26/3 31/21 33/22 32/23
f 31/21 35/28 36/29 33/22
f 27/3 34/23 36/22 35/21
f 34/28 29/21 30/22 36/29
f 30/22 33/27 36/29
f 37/2 40/9 42/10 41/11
f 40/28 44/21 45/22 42/29
f 38/3 43/23 45/22 44/21
f 43/30 47/31 48/32 45/33
f 39/4 46/34 48/32 47/31
f 46/34 41/35 42/36 48/32
f 42/36 45/33 48/32
f 49/1 52/15 54/16 53/18
f 52/14 56/15 57/16 54/17
f 50/1 55/18 57/16 56/15
f 55/19 59/18 60/16 57/20
f 51/1 58/15 60/16 59/18
f 58/15 53/14 54/17 60/16
f 54/17 57/20 60/16
f 61/2 64/11 66/10 65/9
f 64/11 68/24 69/25 66/10
f 62/1 67/15 69/16 68/18
f 67/15 71/14 72/17 69/16
f 63/4 70/31 72/32 71/34
f 70/12 65/9 66/10 72/13
f 66/10 69/25 72/13
f 73/3 76/21 78/22 77/23
f 76/21 80/28 81/29 78/22
f 74/4 79/34 81/32 80/31
f 79/35 83/34 84/32 81/36
f 75/4 82/31 84/32 83/34
f 82/26 77/23 78/22 84/27
f 78/22 81/29 84/27
f 85/4 88/34 90/32 89/31
f 88/34 92/35 93/36 90/32
f 86/1 91/18 93/16 92/15
f 91/35 95/34 96/32 93/36
f 87/4 94/31 96/32 95/34
f 94/31 89/30 90/33 96/32
f 90/33 93/36 96/32
f 2/2 14/3 20/23 7/11
f 7/14 20/12 16/9 11/15
f 11/15 16/9 13/2 3/1
f 3/1 39/4 47/31 10/18
f 10/18 47/31 43/30 5/19
f 5/11 43/23 38/3 1/2
f 1/2 50/1 56/15 4/9
f 4/9 56/15 52/14 8/12
f 8/9 52/15 49/1 2/2
f 15/2 26/3 32/23 22/11
f 22/24 32/26 28/23 17/11
f 17/11 28/23 25/3 13/2
f 14/3 63/4 71/34 19/21
f 19/12 71/14 67/15 23/9
f 23/9 67/15 62/1 15/2
f 27/3 37/2 41/11 34/23
f 34/28 41/35 46/34 29/21
f 29/21 46/34 39/4 25/3
f 26/3 75/4 83/34 31/21
f 31/21 83/34 79/35 35/28
f 35/21 79/34 74/4 27/3
f 37/2 86/1 92/15 40/9
f 40/28 92/35 88/34 44/21
f 44/21 88/34 85/4 38/3
f 51/1 61/2 65/9 58/15
f 58/15 65/9 70/12 53/14
f 53/18 70/31 63/4 49/1
f 50/1 85/4 89/31 55/18
f 55/19 89/30 94/31 59/18
f 59/18 94/31 87/4 51/1
f 61/2 73/3 77/23 64/11
f 64/11 77/23 82/26 68/24
f 68/18 82/31 75/4 62/1
f 73/3 87/4 95/34 76/21
f 76/21 95/34 91/35 80/28
f 80/31 91/18 86/1 74/4
f 3/37 13/38 25/39 39/40

View File

@ -0,0 +1,72 @@
# Blender v2.72 (sub 0) OBJ File: 'switch_outer.blend'
# www.blender.org
o switch_Cube
v 1.270169 -1.270169 -1.270169
v 1.270169 -1.270169 1.270169
v -1.270169 -1.270169 1.270169
v -1.270169 -1.270169 -1.270170
v 1.270170 1.270169 -1.270169
v 1.270168 1.270169 1.270170
v -1.270170 1.270169 1.270169
v -1.270169 1.270169 -1.270169
v 0.985712 1.270169 -0.998137
v 0.985712 1.270169 0.965003
v -0.940154 1.270169 0.973287
v -0.940154 1.270170 -0.998137
v 0.985712 -1.271890 -0.998137
v 0.985712 -1.271890 0.965003
v -0.940154 -1.271890 0.973287
v -0.940154 -1.271890 -0.998137
vt 0.000000 0.000000
vt 0.397419 0.000000
vt 0.397419 0.499661
vt 0.000000 0.499661
vt 0.666667 0.333333
vt 0.333333 0.333333
vt 0.333333 0.000000
vt 0.666667 0.000000
vt 0.000000 0.333333
vt 0.331641 0.335716
vt -0.001692 0.335716
vt -0.001692 0.002383
vt 0.331641 0.002383
vt 0.663333 0.003127
vt 0.996667 0.003127
vt 0.996667 0.336460
vt 0.663333 0.336460
vt 0.333333 0.666667
vt 0.000000 0.666667
vt 0.035695 0.629341
vt 0.293291 0.629341
vt 0.294378 0.376637
vt 0.035695 0.376637
vt 1.000000 1.000000
vt 0.698711 1.000000
vt 0.698711 0.500000
vt 1.000000 0.500000
vt 0.705835 0.500000
vt 0.397419 0.500000
vt 0.705835 0.000000
vt 0.397419 1.000000
vt 0.307120 0.499661
vt 0.307120 0.999661
vt 0.000000 0.999661
vn 0.000000 -1.000000 0.000000
vn 1.000000 0.000000 0.000000
vn -0.000000 -0.000000 1.000000
vn -1.000000 -0.000000 -0.000000
vn 0.000000 0.000000 -1.000000
vn 0.000000 1.000000 0.000000
vn -0.004300 0.000000 -1.000000
s off
f 1/1/1 2/2/1 3/3/1 4/4/1
f 1/5/2 5/6/2 6/7/2 2/8/2
f 2/9/3 6/1/3 7/7/3 3/6/3
f 3/10/4 7/11/4 8/12/4 4/13/4
f 5/14/5 1/15/5 4/16/5 8/17/5
f 6/18/6 5/19/6 9/20/6 10/21/6 11/22/6 7/6/6
f 5/19/6 8/9/6 7/6/6 11/22/6 12/23/6 9/20/6
f 9/24/3 12/25/3 16/26/3 13/27/3
f 12/28/2 11/29/2 15/2/2 16/30/2
f 11/29/7 10/26/7 14/25/7 15/31/7
f 10/4/4 9/32/4 13/33/4 14/34/4

266
Levels/Geometry/torch.obj Normal file
View File

@ -0,0 +1,266 @@
# Blender v2.71 (sub 0) OBJ File: 'torch.blend'
# www.blender.org
o Cylinder
v 0.000000 -1.000000 -0.087051
v -0.000000 1.000000 -0.191513
v 0.016983 -1.000000 -0.085379
v 0.037362 1.000000 -0.187833
v 0.033313 -1.000000 -0.080425
v 0.073289 1.000000 -0.176935
v 0.048363 -1.000000 -0.072380
v 0.106399 1.000000 -0.159237
v 0.061555 -1.000000 -0.061555
v 0.135420 1.000000 -0.135420
v 0.072380 -1.000000 -0.048363
v 0.159237 1.000000 -0.106399
v 0.080425 -1.000000 -0.033313
v 0.176935 1.000000 -0.073289
v 0.085379 -1.000000 -0.016983
v 0.187833 1.000000 -0.037362
v 0.087051 -1.000000 -0.000000
v 0.191513 1.000000 0.000000
v 0.085379 -1.000000 0.016983
v 0.187833 1.000000 0.037362
v 0.080425 -1.000000 0.033313
v 0.176935 1.000000 0.073289
v 0.072380 -1.000000 0.048363
v 0.159237 1.000000 0.106399
v 0.061555 -1.000000 0.061555
v 0.135420 1.000000 0.135420
v 0.048363 -1.000000 0.072380
v 0.106399 1.000000 0.159237
v 0.033313 -1.000000 0.080425
v 0.073289 1.000000 0.176935
v 0.016983 -1.000000 0.085379
v 0.037362 1.000000 0.187833
v -0.000000 -1.000000 0.087051
v -0.000000 1.000000 0.191513
v -0.016983 -1.000000 0.085379
v -0.037362 1.000000 0.187833
v -0.033313 -1.000000 0.080425
v -0.073289 1.000000 0.176935
v -0.048363 -1.000000 0.072380
v -0.106399 1.000000 0.159237
v -0.061555 -1.000000 0.061555
v -0.135420 1.000000 0.135420
v -0.072381 -1.000000 0.048363
v -0.159237 1.000000 0.106399
v -0.080425 -1.000000 0.033313
v -0.176935 1.000000 0.073289
v -0.085379 -1.000000 0.016983
v -0.187833 1.000000 0.037362
v -0.087051 -1.000000 -0.000000
v -0.191513 1.000000 -0.000000
v -0.085379 -1.000000 -0.016983
v -0.187833 1.000000 -0.037362
v -0.080425 -1.000000 -0.033313
v -0.176935 1.000000 -0.073289
v -0.072380 -1.000000 -0.048363
v -0.159237 1.000000 -0.106399
v -0.061554 -1.000000 -0.061555
v -0.135420 1.000000 -0.135420
v -0.048363 -1.000000 -0.072381
v -0.106399 1.000000 -0.159237
v -0.033313 -1.000000 -0.080425
v -0.073289 1.000000 -0.176935
v -0.016983 -1.000000 -0.085379
v -0.037362 1.000000 -0.187833
vt 0.173159 0.324353
vt 0.355490 0.133897
vt 0.388961 0.169345
vt 0.188374 0.340465
vt 0.418692 0.207984
vt 0.201889 0.358028
vt 0.444379 0.249421
vt 0.213565 0.376862
vt 0.465761 0.293235
vt 0.223285 0.396777
vt 0.482621 0.338980
vt 0.230950 0.417570
vt 0.494787 0.386190
vt 0.236481 0.439028
vt 0.502136 0.434385
vt 0.239822 0.460935
vt 0.504593 0.483075
vt 0.240940 0.483066
vt 0.502132 0.531764
vt 0.239822 0.505197
vt 0.494779 0.579957
vt 0.236481 0.527103
vt 0.482609 0.627165
vt 0.230950 0.548561
vt 0.465746 0.672906
vt 0.223286 0.569353
vt 0.444361 0.716715
vt 0.213567 0.589266
vt 0.418672 0.758148
vt 0.201891 0.608099
vt 0.388940 0.796782
vt 0.188377 0.625660
vt 0.355468 0.832224
vt 0.173163 0.641770
vt 0.318596 0.864115
vt 0.156403 0.656266
vt 0.278700 0.892129
vt 0.138269 0.669000
vt 0.236185 0.915982
vt 0.118944 0.679843
vt 0.191483 0.935431
vt 0.098625 0.688683
vt 0.145050 0.950278
vt 0.077519 0.695432
vt 0.097357 0.960373
vt 0.055840 0.700021
vt 0.048890 0.965612
vt 0.033810 0.702402
vt 0.000142 0.965943
vt 0.011651 0.702553
vt 0.011637 0.263556
vt 0.000142 0.000142
vt 0.048895 0.000476
vt 0.033797 0.263708
vt 0.097366 0.005719
vt 0.055829 0.266091
vt 0.145063 0.015817
vt 0.077509 0.270681
vt 0.191499 0.030670
vt 0.098617 0.277432
vt 0.236203 0.050124
vt 0.118937 0.286274
vt 0.278720 0.073982
vt 0.138263 0.297119
vt 0.635136 0.466957
vt 0.594601 0.439872
vt 0.560128 0.405399
vt 0.533043 0.364864
vt 0.514387 0.319824
vt 0.504876 0.272009
vt 0.504876 0.223258
vt 0.514387 0.175443
vt 0.533044 0.130402
vt 0.560129 0.089866
vt 0.594602 0.055394
vt 0.635137 0.028309
vt 0.680177 0.009653
vt 0.727992 0.000142
vt 0.776744 0.000142
vt 0.824559 0.009653
vt 0.869599 0.028309
vt 0.910135 0.055395
vt 0.944607 0.089867
vt 0.971691 0.130402
vt 0.990347 0.175442
vt 0.999858 0.223257
vt 0.999858 0.272009
vt 0.990347 0.319823
vt 0.971691 0.364863
vt 0.944606 0.405398
vt 0.910133 0.439871
vt 0.869598 0.466956
vt 0.824557 0.485613
vt 0.776743 0.495124
vt 0.727992 0.495124
vt 0.680177 0.485613
vt 0.156399 0.309855
vt 0.318618 0.102002
vt 0.545660 0.520522
vt 0.564085 0.508211
vt 0.584558 0.499731
vt 0.606292 0.495408
vt 0.628452 0.495407
vt 0.650186 0.499730
vt 0.670659 0.508211
vt 0.689084 0.520522
vt 0.704753 0.536191
vt 0.717065 0.554616
vt 0.725545 0.575089
vt 0.729868 0.596823
vt 0.729868 0.618983
vt 0.725545 0.640717
vt 0.717065 0.661190
vt 0.704754 0.679615
vt 0.689084 0.695284
vt 0.670659 0.707596
vt 0.650185 0.716076
vt 0.628452 0.720399
vt 0.606292 0.720399
vt 0.584558 0.716076
vt 0.564085 0.707595
vt 0.545660 0.695284
vt 0.529990 0.679615
vt 0.517679 0.661190
vt 0.509199 0.640717
vt 0.504876 0.618983
vt 0.504876 0.596824
vt 0.509199 0.575090
vt 0.517679 0.554617
vt 0.529991 0.536192
vn 0.097900 -0.051900 -0.993800
vn 0.289900 -0.051900 -0.955700
vn 0.470800 -0.051900 -0.880700
vn 0.633500 -0.051900 -0.772000
vn 0.772000 -0.051900 -0.633500
vn 0.880700 -0.051900 -0.470800
vn 0.955700 -0.051900 -0.289900
vn 0.993800 -0.051900 -0.097900
vn 0.993800 -0.051900 0.097900
vn 0.955700 -0.051900 0.289900
vn 0.880700 -0.051900 0.470800
vn 0.772000 -0.051900 0.633500
vn 0.633500 -0.051900 0.772000
vn 0.470800 -0.051900 0.880700
vn 0.289900 -0.051900 0.955700
vn 0.097900 -0.051900 0.993800
vn -0.097900 -0.051900 0.993800
vn -0.289900 -0.051900 0.955600
vn -0.470800 -0.051900 0.880700
vn -0.633500 -0.051900 0.772000
vn -0.772000 -0.051900 0.633500
vn -0.880700 -0.051900 0.470800
vn -0.955700 -0.051900 0.289900
vn -0.993800 -0.051900 0.097900
vn -0.993800 -0.051900 -0.097900
vn -0.955600 -0.051900 -0.289900
vn -0.880700 -0.051900 -0.470800
vn -0.772000 -0.051900 -0.633500
vn -0.633500 -0.051900 -0.772000
vn -0.470800 -0.051900 -0.880700
vn 0.000000 1.000000 0.000000
vn -0.097900 -0.051900 -0.993800
vn -0.289900 -0.051900 -0.955700
vn 0.000000 -1.000000 0.000000
s off
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/4/2 4/3/2 6/5/2 5/6/2
f 5/6/3 6/5/3 8/7/3 7/8/3
f 7/8/4 8/7/4 10/9/4 9/10/4
f 9/10/5 10/9/5 12/11/5 11/12/5
f 11/12/6 12/11/6 14/13/6 13/14/6
f 13/14/7 14/13/7 16/15/7 15/16/7
f 15/16/8 16/15/8 18/17/8 17/18/8
f 17/18/9 18/17/9 20/19/9 19/20/9
f 19/20/10 20/19/10 22/21/10 21/22/10
f 21/22/11 22/21/11 24/23/11 23/24/11
f 23/24/12 24/23/12 26/25/12 25/26/12
f 25/26/13 26/25/13 28/27/13 27/28/13
f 27/28/14 28/27/14 30/29/14 29/30/14
f 29/30/15 30/29/15 32/31/15 31/32/15
f 31/32/16 32/31/16 34/33/16 33/34/16
f 33/34/17 34/33/17 36/35/17 35/36/17
f 35/36/18 36/35/18 38/37/18 37/38/18
f 37/38/19 38/37/19 40/39/19 39/40/19
f 39/40/20 40/39/20 42/41/20 41/42/20
f 41/42/21 42/41/21 44/43/21 43/44/21
f 43/44/22 44/43/22 46/45/22 45/46/22
f 45/46/23 46/45/23 48/47/23 47/48/23
f 47/48/24 48/47/24 50/49/24 49/50/24
f 49/51/25 50/52/25 52/53/25 51/54/25
f 51/54/26 52/53/26 54/55/26 53/56/26
f 53/56/27 54/55/27 56/57/27 55/58/27
f 55/58/28 56/57/28 58/59/28 57/60/28
f 57/60/29 58/59/29 60/61/29 59/62/29
f 59/62/30 60/61/30 62/63/30 61/64/30
f 4/65/31 2/66/31 64/67/31 62/68/31 60/69/31 58/70/31 56/71/31 54/72/31 52/73/31 50/74/31 48/75/31 46/76/31 44/77/31 42/78/31 40/79/31 38/80/31 36/81/31 34/82/31 32/83/31 30/84/31 28/85/31 26/86/31 24/87/31 22/88/31 20/89/31 18/90/31 16/91/31 14/92/31 12/93/31 10/94/31 8/95/31 6/96/31
f 63/97/32 64/98/32 2/2/32 1/1/32
f 61/64/33 62/63/33 64/98/33 63/97/33
f 1/99/34 3/100/34 5/101/34 7/102/34 9/103/34 11/104/34 13/105/34 15/106/34 17/107/34 19/108/34 21/109/34 23/110/34 25/111/34 27/112/34 29/113/34 31/114/34 33/115/34 35/116/34 37/117/34 39/118/34 41/119/34 43/120/34 45/121/34 47/122/34 49/123/34 51/124/34 53/125/34 55/126/34 57/127/34 59/128/34 61/129/34 63/130/34

View File

@ -0,0 +1,68 @@
<composition>
<typeID>20</typeID>
<object>
<filePath>../Levels/Geometry/MarbleSmooth.obj</filePath>
<xOffset>0.0</xOffset>
<yOffset>0.0</yOffset>
<zOffset>0.0</zOffset>
<scale>1.0</scale>
</object>
</composition>
<composition>
<typeID>40</typeID>
<object>
<filePath>../Levels/Geometry/Block.obj</filePath>
<xOffset>0.0</xOffset>
<yOffset>1.0</yOffset>
<zOffset>2.0</zOffset>
<scale>1.0</scale>
</object>
</composition>
<composition>
<typeID>60</typeID>
<object>
<filePath>../Levels/Geometry/Column.obj</filePath>
<xOffset>0.0</xOffset>
<yOffset>0.0</yOffset>
<zOffset>0.0</zOffset>
<scale>1.0</scale>
</object>
</composition>
<composition>
<typeID>80</typeID>
<object>
<filePath>../Levels/Geometry/torch.obj</filePath>
<xOffset>0.0</xOffset>
<yOffset>0.0</yOffset>
<zOffset>0.0</zOffset>
<scale>1.0</scale>
</object>
</composition>
<composition>
<typeID>100</typeID>
<object>
<filePath>../Levels/Geometry/Column.obj</filePath>
<xOffset>0.0</xOffset>
<yOffset>0.0</yOffset>
<zOffset>0.0</zOffset>
<scale>1.0</scale>
</object>
<object>
<filePath>../Levels/Geometry/Column.obj</filePath>
<xOffset>2.0</xOffset>
<yOffset>0.0</yOffset>
<zOffset>0.0</zOffset>
<scale>1.0</scale>
</object>
<object>
<filePath>../Levels/Geometry/Block.obj</filePath>
<xOffset>1.0</xOffset>
<yOffset>3.0</yOffset>
<zOffset>0.0</zOffset>
<scale>1.0</scale>
</object>
</composition>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

BIN
Levels/Textures/skydome.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -14,30 +14,50 @@ uniform float specularFactor;
uniform vec3 camera;
uniform float shininess;
uniform int lightCount;
uniform vec3 directionalLightVector;
uniform vec3 directionalColor;
uniform float directionalIntensity;
uniform vec3 lightSources[128];
uniform vec3 lightColors[128];
uniform float lightIntensities[128];
uniform float fogEnd;
uniform vec4 fogColor;
uniform vec3 cameraCenter;
void main()
{
vec3 ambientColor = ambientFactor * ambientColor;
vec3 diffuseColor = vec3(0.0, 0.0, 0.0);
vec3 specularColor = vec3(0.0, 0.0, 0.0);
if(length(directionalLightVector)>0.0f) {
vec3 directionalVector = normalize(directionalLightVector);
diffuseColor += clamp(dot(normalize(vNormal), directionalVector)
*diffuseFactor*directionalIntensity*directionalColor, 0.0, 1.0);
vec3 cameraVector = normalize(camera - vec3(fragPosition));
specularColor += clamp(pow((dot((cameraVector+directionalVector),normalize(vNormal))/(length(cameraVector+directionalVector)*length(normalize(vNormal)))),shininess), 0.0, 1.0)
*specularFactor*directionalIntensity*directionalColor;
}
for(int i = 0; i<lightCount; i++) {
float distance = distance(lightSources[i], vec3(fragPosition));
// only take lights into account with meaningful contribution
if (distance > 0.001f) {
vec3 lightVector = normalize(lightSources[i]-vec3(fragPosition));
float intensity = (lightIntensities[i])/(distance);
diffuseColor += dot(normalize(vNormal), lightVector)
*diffuseFactor*intensity*lightColors[i];
float intensity = clamp(exp(-(1/lightIntensities[i])*distance), 0.0, 1.0);
diffuseColor += clamp(dot(normalize(vNormal), lightVector)
*diffuseFactor*intensity*lightColors[i], 0.0, 1.0);
vec3 cameraVector = normalize(camera - vec3(fragPosition));
specularColor += clamp(pow((dot((cameraVector+lightVector),normalize(vNormal))/(length(cameraVector+lightVector)*length(normalize(vNormal)))),shininess), 0.0, 1.0)
*specularFactor*intensity*lightColors[i];
}
}
vec3 finalColor = specularColor + diffuseColor + ambientColor;
vec3 texture = texture(uTexture, vTexCoord).rgb;
oColor = vec4(finalColor*texture, 1.0 );
vec3 finalColor = specularColor + diffuseColor + ambientColor;
float distanceCameraCenter = distance(cameraCenter, vec3(fragPosition));
float fogFactor = clamp((1.0 - (fogEnd-distanceCameraCenter)/30.0), 0.0, 1.0);
fogFactor *= clamp((1.0-((fragPosition.y-8.0)/30.0)), 0.0, 1.0);
vec4 texture = texture(uTexture, vTexCoord).rgba;
oColor = vec4(finalColor, 1.0f)*texture;
oColor = mix(oColor, fogColor, fogFactor);
}

69
application.cc Normal file
View File

@ -0,0 +1,69 @@
#include "application.hh"
Application::Application() {
graphics = Graphics(glm::uvec2(1024, 786), 0.1f, 150.0f);
}
void Application::init()
{
// Don't change this!
ignoredMouseUpdates = 0;
cameraLock = true;
// set Skybox size
level.setSkydomeSize((graphics.getFarPlane()/2.0f)-10.0f);
// define where shaders and textures can be found:
ACGL::Base::Settings::the()->setResourcePath("../");
ACGL::Base::Settings::the()->setShaderPath("Shader/");
ACGL::Base::Settings::the()->setTexturePath("Levels/Textures/");
ACGL::Base::Settings::the()->setGeometryPath("Levels/Geometry/");
graphics.init();
// load Level
level.load();
// just in case: check for errors
openGLCriticalError();
}
Graphics* Application::getGraphics() {
return &graphics;
}
Level* Application::getLevel() {
return &level;
}
void Application::setFocused(bool focused) {
this->focused = focused;
}
bool Application::isFocused() {
return focused;
}
void Application::setCameraLock(bool locked) {
// Prevent camera jumping huge distances
if (!locked) {
ignoreNextMouseUpdate();
}
cameraLock = locked;
}
void Application::ignoreNextMouseUpdate() {
ignoredMouseUpdates++;
}
void Application::ignoredOneMouseUpdate() {
ignoredMouseUpdates--;
}
int Application::getIgnoredMouseUpdates() {
return ignoredMouseUpdates;
}
bool Application::isLocked() {
return cameraLock;
}

29
application.hh Normal file
View File

@ -0,0 +1,29 @@
#ifndef APPLICATION_HH_INCLUDED
#define APPLICATION_HH_INCLUDED
#include "physics.hh"
#include "graphics.hh"
#include "level.hh"
class Application {
public:
Application();
Graphics* getGraphics();
Level* getLevel();
void init();
void setFocused(bool focused);
bool isFocused();
void setCameraLock(bool locked);
bool isLocked();
void ignoreNextMouseUpdate();
int getIgnoredMouseUpdates();
void ignoredOneMouseUpdate();
private:
int ignoredMouseUpdates;
bool focused;
bool cameraLock;
Graphics graphics;
Level level;
};
#endif

View File

@ -8,6 +8,13 @@ then
exit
fi
cmake="cmake"
if [[ $1 == "windows" ]]
then
cmake="cmake -DCMAKE_SYSTEM_NAME='Windows' -DCMAKE_FIND_ROOT_PATH='/usr/bin:/usr/x86_64-w64-mingw32' -DCMAKE_CXX_COMPILER='x86_64-w64-mingw32-g++' -DCMAKE_C_COMPILER='x86_64-w64-mingw32-gcc'"
fi
currentDir=$(pwd)
threads=$(($(nproc)+1))
@ -16,8 +23,14 @@ threads=$(($(nproc)+1))
cd extern/bullet/
mkdir -p build
cd build
cmake ..
make -j$threads
if hash ninja 2>/dev/null
then
$cmake -DBUILD_DEMOS=0 -DBUILD_EXTRAS=0 -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=0 -GNinja ..
ninja
else
$cmake -DBUILD_DEMOS=0 -DBUILD_EXTRAS=0 -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=0 ..
make -j$threads
fi
cd $currentDir
@ -25,5 +38,11 @@ cd $currentDir
mkdir -p build
cd build
cmake ..
make -j$threads
if hash ninja 2>/dev/null
then
$cmake -DGLFW_BUILD_EXAMPLES=0 -DGLFW_BUILD_TESTS=0 -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=0 -GNinja ..
ninja
else
$cmake -DGLFW_BUILD_EXAMPLES=0 -DGLFW_BUILD_TESTS=0 -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=0 ..
make -j$threads
fi

31
circle.yml Normal file
View File

@ -0,0 +1,31 @@
general:
branches:
only:
- master
machine:
services:
- docker
dependencies:
override:
# Set up dropbox_uploader
- curl "https://raw.githubusercontent.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh" -o dropbox_uploader.sh
- chmod +x dropbox_uploader.sh
- echo $db_uploader > ~/.dropbox_uploader
database:
override:
test:
override:
- docker run -v ~/swp:/swp/swp -w=/swp/swp -u=$(id -u) faerbit/swp ./package.sh linux
- docker run -v ~/swp:/swp/swp -w=/swp/swp -u=$(id -u) faerbit/swp ./package.sh windows
- cp MarbleGame_Windows.zip MarbleGame_Linux.zip $CIRCLE_ARTIFACTS
deployment:
master:
branch: master
commands:
- ./dropbox_uploader.sh -p upload MarbleGame_Windows.zip /
- ./dropbox_uploader.sh -p upload MarbleGame_Linux.zip /

44
converter/CMakeLists.txt Normal file
View File

@ -0,0 +1,44 @@
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
PROJECT(Converter)
###############################################################################
#
# Compiler settings, can be simpler if only one compiler should be used.
#
#Enable c++11
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
#on clang we need to find out the version to set stdlib if needed
# if clang version is less than 3.3 ( XCode 5.0) you need to set the stdlib
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
MESSAGE("Clangversion ${CLANG_VERSION_STRING}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
# enable warnings
IF(MSVC)
# for msvc also set multiple processors
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /W3")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP /W3")
ELSE(MSVC)
ADD_DEFINITIONS(-Wall)
ENDIF(MSVC)
ADD_DEFINITIONS(-DNO_SPACE_NAVIGATOR_SUPPORT)
#
#
###############################################################################
FILE(GLOB_RECURSE SOURCE_FILES_CONV "${CMAKE_SOURCE_DIR}/converter/*.cc")
SET(SOURCE_FILES_CONV ${SOURCE_FILES_CONV})
FILE(GLOB_RECURSE HEADER_FILES_CONV "${CMAKE_SOURCE_DIR}/converter/*.hh")
SET(HEADER_FILES_CONV ${HEADER_FILES})
ADD_EXECUTABLE(converter ${SOURCE_FILES_CONV} ${HEADER_FILES_CONV})

139
converter/converter.cc Normal file
View File

@ -0,0 +1,139 @@
#include "converter.hh"
#include <fstream>
#include <string>
using namespace tinyxml2;
Converter::Converter(std::string level){
xmlFile = "../Levels/ObjectSetups/Level" + level + ".xml";
//Load Compositions
const char* charCompositions = "../Levels/ObjectSetups/Compositions.xml";
compositions->LoadFile(charCompositions);
if (compositions->ErrorID()!=0){
printf("Could not open Compositions!!!\n");
}
//Create a backup of the current Level xml file
std::string backup = "../Levels/ObjectSetups/BackupLevel" + level + ".xml";
std::ifstream src(xmlFile, std::ios::binary);
std::ofstream dst(backup, std::ios::binary);
dst << src.rdbuf();
//Load the Level xml file
const char* charXmlFile = xmlFile.c_str();
doc->LoadFile(charXmlFile);
nextID.push_back(1);
nextID.push_back(1);
if (doc->ErrorID()!=0){
printf("Could not open xml, creating new xml.\n");
}else{
XMLElement* thisComposition = doc->FirstChildElement("composition");
int idGreen, idBlue;
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement()){
thisComposition->QueryIntAttribute("idGreen", &idGreen);
thisComposition->QueryIntAttribute("idBlue", &idBlue);
if(idGreen > nextID[0] || (idGreen == nextID[0] && idBlue > nextID[1])){
nextID[0] = idGreen;
nextID[1] = idBlue;
}
}
}
}
Converter::Converter(){
}
Converter::~Converter(){
}
std::vector<unsigned int> Converter::newComposition(unsigned int type, float posX, float posZ){
XMLElement* newComposition = doc->NewElement("composition");
doc->InsertFirstChild(newComposition);
XMLElement* typeID = doc->NewElement("typeID");
XMLElement* idBlue = doc->NewElement("idBlue");
XMLElement* idGreen = doc->NewElement("idGreen");
XMLElement* zPos = doc->NewElement("zPos");
XMLElement* yOffset = doc->NewElement("yOffset");
XMLElement* xPos = doc->NewElement("xPos");
XMLElement* zRot = doc->NewElement("zRot");
XMLElement* yRot = doc->NewElement("yRot");
XMLElement* xRot = doc->NewElement("xRot");
XMLElement* scale = doc->NewElement("scale");
typeID->SetText(std::to_string(type).c_str());
idBlue->SetText(std::to_string(nextID[1]).c_str());
idGreen->SetText(std::to_string(nextID[0]).c_str());
zPos->SetText(std::to_string(posZ).c_str());
yOffset->SetText("0.0");
xPos->SetText(std::to_string(posX).c_str());
zRot->SetText("0.0");
yRot->SetText("0.0");
xRot->SetText("0.0");
scale->SetText("1.0");
newComposition->InsertFirstChild(typeID);
newComposition->InsertFirstChild(idBlue);
newComposition->InsertFirstChild(idGreen);
newComposition->InsertFirstChild(zPos);
newComposition->InsertFirstChild(yOffset);
newComposition->InsertFirstChild(xPos);
newComposition->InsertFirstChild(zRot);
newComposition->InsertFirstChild(yRot);
newComposition->InsertFirstChild(xRot);
newComposition->InsertFirstChild(scale);
std::vector<unsigned int> ret = nextID;
nextID[1] += 1;
if (nextID[1] == 255){
nextID[1] = 0;
nextID[0] +=1;
}
return ret;
}
void Converter::updateComposition(unsigned int idG, unsigned int idB, float posX, float posZ){
XMLElement* thisComposition = doc->FirstChildElement("composition");
int idGreen, idBlue;
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement()){
thisComposition->QueryIntAttribute("idGreen", &idGreen);
thisComposition->QueryIntAttribute("idBlue", &idBlue);
if(idGreen == idG && idBlue == idB){
thisComposition->FirstChildElement("xPos")->SetText(std::to_string(posX).c_str());
thisComposition->FirstChildElement("zPos")->SetText(std::to_string(posZ).c_str());
}
}
}
void Converter::deleteComposition(unsigned int idG, unsigned int idB){
XMLElement* thisComposition = doc->FirstChildElement("composition");
int idGreen, idBlue;
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement()){
thisComposition->QueryIntAttribute("idGreen", &idGreen);
thisComposition->QueryIntAttribute("idBlue", &idBlue);
if(idGreen == idG && idBlue == idB){
doc->DeleteChild(thisComposition);
}
}
}
void Converter::save(){
const char* charXmlFile = xmlFile.c_str();
doc->SaveFile(charXmlFile);
}
std::vector<unsigned int> Converter::getNextID(){
return nextID;
}
/* finding a typeID in compositions:
XMLElement* thisComposition = compositions->FirstChildElement("composition");
for(; thisComposition; thisComposition=thisComposition->NextSiblingElement()){
int thisType;
thisComposition->QueryIntAttribute("typeID", &thisType);
if(thisType == type){
...
}
}
*/

27
converter/converter.hh Normal file
View File

@ -0,0 +1,27 @@
#ifndef CONVERTER_INCLUDED
#define CONVERTER_INCLUDED
#include <vector>
#include <string>
#include "tinyxml2.hh"
using namespace tinyxml2;
class Converter {
public:
Converter(std::string level);
Converter();
~Converter();
void updateComposition(unsigned int idG, unsigned int idB, float posX, float posZ);
std::vector<unsigned int> newComposition(unsigned int type, float posX, float posZ);
void deleteComposition(unsigned int idG, unsigned int idB);
void save();
std::vector<unsigned int> getNextID();
private:
std::vector<unsigned int> nextID;
std::string xmlFile;
XMLDocument* doc = new XMLDocument();
XMLDocument* compositions = new XMLDocument();
};
#endif

6096
converter/lodepng.cc Normal file

File diff suppressed because it is too large Load Diff

1702
converter/lodepng.hh Normal file

File diff suppressed because it is too large Load Diff

67
converter/main.cc Normal file
View File

@ -0,0 +1,67 @@
#include "lodepng.hh"
#include <string>
#include "converter.hh"
#include <vector>
#include <iostream>
int main( int argc, char *argv[] ){
if (argc <= 1){
std::cout << "Converter needs the level (1,2,...) as input." << std::endl;
}
std::string levelString = argv[1];
Converter conv = Converter(levelString);
bool idFound[256][256];
for (int i=0; i<256; i++){
for (int j=0; j<256; j++){
idFound[i][j] = false;
}
}
//read the setup png
std::string filePath = "../Levels/ObjectSetups/Level" + levelString + ".png";
std::vector<unsigned char> image; //the raw pixels
unsigned int width, height;
unsigned error = lodepng::decode(image, width, height, filePath);
if (error) {
std::cout << "decoder error " << error << ": " << lodepng_error_text(error) << std::endl;
}
//iterate over all pixels of the image
for(unsigned int rowNum = 0; rowNum < height; rowNum++){
for(unsigned int columnNum = 0; columnNum < width; columnNum++){
unsigned int pixel = (rowNum*width+columnNum)*4;
//if there is a composition here, adjust the xml and image
if(image[pixel]!=0){
if(image[pixel+1]==0 && image[pixel+2]==0){
std::vector<unsigned int> temp;
temp = conv.newComposition(image[pixel], 0.5+rowNum-0.5*height, 0.5+columnNum-0.5*width);
idFound[temp[0]][temp[1]] = true;
image[pixel+1] = temp[0];
image[pixel+2] = temp[1];
}else{
conv.updateComposition(image[pixel+1], image[pixel+2], 0.5+rowNum-0.5*height, 0.5+columnNum-0.5*width);
idFound[image[pixel+1]][image[pixel+2]] = true;
}
}
}
}
//write ids back to the setup png
error = lodepng::encode(filePath, image, width, height);
if(error) {
std::cout << "encoder error " << error << ": "<< lodepng_error_text(error) << std::endl;
}
//delete compositions that were not in the png anymore
for (int i=1; i<=conv.getNextID()[1]; i++){
for (int j=1; j<256; j++){
if (! idFound[i][j]){
conv.deleteComposition(i,j);
}
}
}
//save the xml
conv.save();
}

2258
converter/tinyxml2.cc Executable file

File diff suppressed because it is too large Load Diff

2091
converter/tinyxml2.hh Executable file

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
#ifdef _WIN32
#include "MemoryMappedFile.hh"
#include <Windows.h>
#include <windows.h>
class MemoryMappedFileWinImpl
{

View File

@ -13,6 +13,8 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast"
#include "btCompoundShape.h"
#include "btCollisionShape.h"
#include "BulletCollision/BroadphaseCollision/btDbvt.h"

View File

@ -21,7 +21,7 @@ cmake_uninstall.cmake
docs/Doxyfile
docs/html
docs/warnings.txt
src/config.h
src/glfw_config.h
src/glfw3.pc
src/glfwConfig.cmake
src/glfwConfigVersion.cmake

View File

@ -4,15 +4,16 @@ cmake_minimum_required(VERSION 2.8)
set(GLFW_VERSION_MAJOR "3")
set(GLFW_VERSION_MINOR "0")
set(GLFW_VERSION_PATCH "2")
set(GLFW_VERSION_PATCH "4")
set(GLFW_VERSION_EXTRA "")
set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}")
set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA}")
set(LIB_SUFFIX "" CACHE STRING "Takes an empty string or 64. Directory where lib will be installed: lib or lib64")
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF)
option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF)
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON)
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
option(GLFW_INSTALL "Generate installation target" ON)
option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
@ -73,11 +74,13 @@ endif()
find_package(Threads REQUIRED)
set(DOXYGEN_SKIP_DOT TRUE)
find_package(Doxygen)
if (GLFW_BUILD_DOCS)
set(DOXYGEN_SKIP_DOT TRUE)
find_package(Doxygen)
if (GLFW_DOCUMENT_INTERNALS)
if (GLFW_DOCUMENT_INTERNALS)
set(GLFW_INTERNAL_DOCS "${GLFW_SOURCE_DIR}/src/internal.h ${GLFW_SOURCE_DIR}/docs/internal.dox")
endif()
endif()
#--------------------------------------------------------------------
@ -163,6 +166,13 @@ if (_GLFW_WIN32)
if (GLFW_USE_OPTIMUS_HPG)
set(_GLFW_USE_OPTIMUS_HPG 1)
endif()
# HACK: When building on MinGW, WINVER and UNICODE need to be defined before
# the inclusion of stddef.h (by glfw3.h), which is itself included before
# win32_platform.h. We define them here until a saner solution can be found
# NOTE: MinGW-w64 and Visual C++ do /not/ need this hack.
add_definitions(-DUNICODE)
add_definitions(-DWINVER=0x0501)
endif()
#--------------------------------------------------------------------
@ -204,7 +214,13 @@ if (_GLFW_X11)
endif()
list(APPEND glfw_INCLUDE_DIRS ${X11_Xinput_INCLUDE_PATH})
if (X11_Xinput_LIB)
list(APPEND glfw_LIBRARIES ${X11_Xinput_LIB})
else()
# Backwards compatibility (bug in CMake 2.8.7)
list(APPEND glfw_LIBRARIES Xi)
endif()
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xi")
# Check for Xf86VidMode (fallback gamma control)
@ -269,23 +285,15 @@ if (_GLFW_GLX)
# Check for dlopen support as a fallback
find_library(DL_LIBRARY dl)
mark_as_advanced(DL_LIBRARY)
if (DL_LIBRARY)
set(CMAKE_REQUIRED_LIBRARIES ${DL_LIBRARY})
else()
set(CMAKE_REQUIRED_LIBRARIES "")
endif()
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS})
check_function_exists(dlopen _GLFW_HAS_DLOPEN)
if (NOT _GLFW_HAS_DLOPEN)
message(FATAL_ERROR "No entry point retrieval mechanism found")
endif()
if (DL_LIBRARY)
list(APPEND glfw_LIBRARIES ${DL_LIBRARY})
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -ldl")
if (CMAKE_DL_LIBS)
list(APPEND glfw_LIBRARIES ${CMAKE_DL_LIBS})
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -l${CMAKE_DL_LIBS}")
endif()
endif()
@ -343,13 +351,15 @@ if (_GLFW_COCOA AND _GLFW_NSGL)
find_library(COCOA_FRAMEWORK Cocoa)
find_library(IOKIT_FRAMEWORK IOKit)
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation)
find_library(CORE_VIDEO_FRAMEWORK CoreVideo)
list(APPEND glfw_LIBRARIES ${COCOA_FRAMEWORK}
${OPENGL_gl_LIBRARY}
${IOKIT_FRAMEWORK}
${CORE_FOUNDATION_FRAMEWORK})
${CORE_FOUNDATION_FRAMEWORK}
${CORE_VIDEO_FRAMEWORK})
set(GLFW_PKG_DEPS "")
set(GLFW_PKG_LIBS "-framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation")
set(GLFW_PKG_LIBS "-framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework CoreVideo")
endif()
#--------------------------------------------------------------------
@ -373,8 +383,8 @@ endif()
configure_file(${GLFW_SOURCE_DIR}/docs/Doxyfile.in
${GLFW_BINARY_DIR}/docs/Doxyfile @ONLY)
configure_file(${GLFW_SOURCE_DIR}/src/config.h.in
${GLFW_BINARY_DIR}/src/config.h @ONLY)
configure_file(${GLFW_SOURCE_DIR}/src/glfw_config.h.in
${GLFW_BINARY_DIR}/src/glfw_config.h @ONLY)
configure_file(${GLFW_SOURCE_DIR}/src/glfwConfig.cmake.in
${GLFW_BINARY_DIR}/src/glfwConfig.cmake @ONLY)
@ -392,17 +402,17 @@ endif()
#--------------------------------------------------------------------
add_subdirectory(src)
#if (GLFW_BUILD_EXAMPLES)
# add_subdirectory(examples)
#endif()
if (GLFW_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
#if (GLFW_BUILD_TESTS)
# add_subdirectory(tests)
#endif()
if (GLFW_BUILD_TESTS)
add_subdirectory(tests)
endif()
#if (DOXYGEN_FOUND)
# add_subdirectory(docs)
#endif()
if (DOXYGEN_FOUND AND GLFW_BUILD_DOCS)
add_subdirectory(docs)
endif()
#--------------------------------------------------------------------
# Install files other than the library

277
extern/glfw/README.md vendored
View File

@ -6,9 +6,9 @@ GLFW is a free, Open Source, portable library for OpenGL and OpenGL ES
application development. It provides a simple, platform-independent API for
creating windows and contexts, reading input, handling events, etc.
Version 3.0.2 adds support for OpenGL 4 on and precise scrolling deltas on OS
X and fixes for a number of bugs that together affect all supported platforms.
As this is a patch release, there are no API changes.
Version 3.0.4 adds better support for custom build environments and fixes for
a large number of bugs that together affect all supported platforms. As this is
a patch release, there are no API changes.
If you are new to GLFW, you may find the
[introductory tutorial](http://www.glfw.org/docs/latest/quick.html) for GLFW
@ -19,221 +19,69 @@ the GLFW 3 API.
## Compiling GLFW
### Dependencies
To compile GLFW and the accompanying example programs, you will need **CMake**,
which will generate the project files or makefiles for your particular
development environment. If you are on a Unix-like system such as Linux or
FreeBSD or have a package system like Fink, MacPorts, Cygwin or Homebrew, you
can simply install its CMake package. If not, you can get installers for
Windows and OS X from the [CMake website](http://www.cmake.org/).
Additional dependencies are listed below.
#### Visual C++ on Windows
The Microsoft Platform SDK that is installed along with Visual C++ contains all
the necessary headers, link libraries and tools except for CMake.
#### MinGW or MinGW-w64 on Windows
These packages contain all the necessary headers, link libraries and tools
except for CMake.
#### MinGW or MinGW-w64 cross-compilation
Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages. For
example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages
for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives
like Ubuntu have the `mingw-w64` package for both.
GLFW has CMake toolchain files in the `CMake/` directory that allow for easy
cross-compilation of Windows binaries. To use these files you need to add a
special parameter when generating the project files or makefiles:
cmake -DCMAKE_TOOLCHAIN_FILE=<toolchain-file> .
The exact toolchain file to use depends on the prefix used by the MinGW or
MinGW-w64 binaries on your system. You can usually see this in the /usr
directory. For example, both the Debian/Ubuntu and Cygwin MinGW-w64 packages
have `/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct
invocation would be:
cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake .
For more details see the article
[CMake Cross Compiling](http://www.paraview.org/Wiki/CMake_Cross_Compiling) on
the CMake wiki.
#### Xcode on OS X
Xcode contains all necessary tools except for CMake. The necessary headers and
libraries are included in the core OS frameworks. Xcode can be downloaded from
the Mac App Store.
#### Unix-like systems with X11
To compile GLFW for X11, you need to have the X11 and OpenGL header packages
installed, as well as the basic development tools like GCC and make. For
example, on Ubuntu and other distributions based on Debian GNU/Linux, you need
to install the `xorg-dev` and `libglu1-mesa-dev` packages. The former pulls in
all X.org header packages and the latter pulls in the Mesa OpenGL and GLU
packages. Note that using header files and libraries from Mesa during
compilation *will not* tie your binaries to the Mesa implementation of OpenGL.
### Generating with CMake
Once you have all necessary dependencies, it is time to generate the project
files or makefiles for your development environment. CMake needs to know two
paths for this: the path to the source directory and the target path for the
generated files and compiled binaries. If these are the same, it is called an
in-tree build, otherwise it is called an out-of-tree build.
One of several advantages of out-of-tree builds is that you can generate files
and compile for different development environments using a single source tree.
#### Using CMake from the command-line
To make an in-tree build, enter the root directory of the GLFW source tree and
run CMake. The current directory is used as target path, while the path
provided as an argument is used to find the source tree.
cd <glfw-root-dir>
cmake .
To make an out-of-tree build, make another directory, enter it and run CMake
with the (relative or absolute) path to the root of the source tree as an
argument.
cd <glfw-root-dir>
mkdir build
cd build
cmake ..
#### Using the CMake GUI
If you are using the GUI version, choose the root of the GLFW source tree as
source location and the same directory or another, empty directory as the
destination for binaries. Choose *Configure*, change any options you wish to,
*Configure* again to let the changes take effect and then *Generate*.
### CMake options
The CMake files for GLFW provide a number of options, although not all are
available on all supported platforms. Some of these are de facto standards
among CMake users and so have no `GLFW_` prefix.
If you are using the GUI version of CMake, these are listed and can be changed
from there. If you are using the command-line version, use the `ccmake` tool.
Some package systems like Ubuntu and other distributions based on Debian
GNU/Linux have this tool in a separate `cmake-curses-gui` package.
#### Shared options
`BUILD_SHARED_LIBS` determines whether GLFW is built as a static
library or as a DLL / shared library / dynamic library.
`LIB_SUFFIX` affects where the GLFW shared /dynamic library is
installed. If it is empty, it is installed to `$PREFIX/lib`. If it is set to
`64`, it is installed to `$PREFIX/lib64`.
`GLFW_BUILD_EXAMPLES` determines whether the GLFW examples are built
along with the library.
`GLFW_BUILD_TESTS` determines whether the GLFW test programs are
built along with the library.
#### OS X specific options
`GLFW_USE_CHDIR` determines whether `glfwInit` changes the current
directory of bundled applications to the `Contents/Resources` directory.
`GLFW_USE_MENUBAR` determines whether the first call to
`glfwCreateWindow` sets up a minimal menu bar.
`GLFW_BUILD_UNIVERSAL` determines whether to build Universal Binaries.
#### Windows specific options
`USE_MSVC_RUNTIME_LIBRARY_DLL` determines whether to use the DLL version or the
static library version of the Visual C++ runtime library.
`GLFW_USE_DWM_SWAP_INTERVAL` determines whether the swap interval is set even
when DWM compositing is enabled. This can lead to severe jitter and is not
usually recommended.
`GLFW_USE_OPTIMUS_HPG` determines whether to export the `NvOptimusEnablement`
symbol, which forces the use of the high-performance GPU on nVidia Optimus
systems.
#### EGL specific options
`GLFW_USE_EGL` determines whether to use EGL instead of the platform-specific
context creation API. Note that EGL is not yet provided on all supported
platforms.
`GLFW_CLIENT_LIBRARY` determines which client API library to use. If set to
`opengl` the OpenGL library is used, if set to `glesv1` for the OpenGL ES 1.x
library is used, or if set to `glesv2` the OpenGL ES 2.0 library is used. The
selected library and its header files must be present on the system for this to
work.
## Installing GLFW
A rudimentary installation target is provided for all supported platforms via
CMake.
See the [Compiling GLFW](http://www.glfw.org/docs/latest/compile.html) guide in
the GLFW documentation.
## Using GLFW
See the [GLFW documentation](http://www.glfw.org/docs/latest/).
See the
[Building programs that use GLFW](http://www.glfw.org/docs/latest/build.html)
guide in the GLFW documentation.
## Changelog
- Allowed character callback to be triggered regardless of modifier keys
- Bugfix: The `-Wall` flag was not used with Clang and other GCC compatibles
- Bugfix: The default for `GLFW_ALPHA_BITS` was set to zero
- Bugfix: `glfwInit` would segfault if monitor enumeration failed and no error
callback was set
- [Win32] Added `_GLFW_USE_DWM_SWAP_INTERVAL` for forcing the swap interval
to be set even when DWM compositing is enabled
- [Win32] Added support for forcing the use of the high-performance GPU
on nVidia Optimus systems
- [Win32] Bugfix: The clipboard string was not freed on terminate
- [Win32] Bugfix: Entry points for OpenGL 1.0 and 1.1 functions were not
returned by `glfwGetProcAddress`
- [Win32] Bugfix: The `user32` and `dwmapi` module handles were not freed on
library termination
- [Cocoa] Added support for precise scrolling deltas on OS X 10.7 and later
- [Cocoa] Enabled explicit creation of OpenGL 3.x and 4.x contexts as supported
by OS X 10.9
- [Cocoa] Bugfix: The clipboard string was not freed on terminate
- [Cocoa] Bugfix: Selectors were used that are not declared by the 10.6 SDK
- [Cocoa] Bugfix: The position set by `glfwSetWindowPos` was incorrect
- [X11] Bugfix: Override-redirect windows were resized to the desired instead
of the actual resolution of the selected video mode
- [X11] Bugfix: Screensaver override for full screen windows had a possible
race condition
- [X11] Bugfix: The reported window position did not account for the size of
the window frame on some WMs
- [X11] Bugfix: The original video mode of a monitor was overwritten by calls
to `glfwSetWindowSize`
- [X11] Bugfix: Key release events for `GLFW_KEY_KP_5` were discarded.
- Added the `GLFW_BUILD_DOCS` CMake option for controlling whether the
documentation is built
- Added the `_GLFW_USE_CONFIG_H` configuration macro for controlling whether to
include the configuration header
- Moved version number macro to `internal.h` for easier manual compilation
- Renamed configuration header to `glfw_config.h` to avoid conflicts
- Bugfix: The `glfw3.pc` file did not respect the `LIB_SUFFIX` CMake option
- Bugfix: The `joysticks` test would segfault if a controller had no axes
- [Win32] Allowed swap interval to be explicitly set to zero on DWM systems
- [Win32] Bugfix: Removed joystick axis value negation left over from GLFW 2
- [Win32] Bugfix: Restoring windows using the Win+D hot key did not trigger the
focus callback
- [Win32] Bugfix: The disabled cursor mode clip rectangle was updated for
unfocused windows
- [Win32] Bugfix: Cursor was not properly re-centered over odd-sized windows
- [Win32] Bugfix: Negative window positions were reported incorrectly
- [Win32] Bugfix: The iconify callback was not triggered when switching away
from a full screen window using Alt+Tab
- [Win32] Bugfix: Resizing a window with `glfwSetWindowSize` gave it focus
- [Cocoa] Added dependency on CoreVideo framework for refresh rate retrieval
- [Cocoa] Enabled Lion full screen for resizable windowed mode windows
- [Cocoa] Moved to Cocoa API for application transformation and activation
- [Cocoa] Bugfix: The `GLFW_KEY_GRAVE_ACCENT` key was reported as
`GLFW_KEY_WORLD_1` and vice versa
- [Cocoa] Bugfix: The `GLFW_KEY_F13` key was reported as
`GLFW_KEY_PRINT_SCREEN`
- [Cocoa] Bugfix: Implicit conversion from `NSUInteger` to int caused warnings
with Xcode 5
- [Cocoa] Bugfix: Use of undeclared selectors with `@selector` caused warnings
with Xcode 5
- [Cocoa] Bugfix: The cursor remained visible if moved onto client area after
having been set to hidden outside it
- [Cocoa] Bugfix: The refresh rate was zero for all modes of certain monitors
- [Cocoa] Bugfix: The `install_name` field of the dynamic library was not set
- [Cocoa] Bugfix: Full screen windows were never reported as having focus
- [Cocoa] Bugfix: A superfluous I/O flag test prevented video modes from being
listed for Thunderbolt monitor
- [Cocoa] Bugfix: Retrieving the name of some external displays caused segfault
- [Cocoa] Bugfix: The 10.9 SDK defines `GLintptrARB` and `GLsizeiptrARB`
differently from the Khronos `glext.h`
- [Cocoa] Bugfix: Creating hidden windows would steal application focus
- [Cocoa] Bugfix: Controllers were reported as having zero buttons and axes
- [Cocoa] Bugfix: Removed joystick axis value negation left over from GLFW 2
- [X11] Added setting of the `WM_CLASS` property to the initial window title
- [X11] Added support for `_NET_WM_BYPASS_COMPOSITOR`
- [X11] Bugfix: Removed joystick axis value negation left over from GLFW 2
- [X11] Bugfix: The position of hidden windows was ignored by Metacity
and Compiz
- [X11] Bugfix: The `pthread.h` header was not included by the GLX platform
header.
## Contact
@ -272,12 +120,14 @@ skills.
- Doug Binks
- blanco
- Lambert Clara
- Andrew Corrigan
- Noel Cower
- Jarrod Davis
- Olivier Delannoy
- Paul R. Deppe
- Jonathan Dummer
- Ralph Eastwood
- Michael Fogleman
- Gerald Franz
- GeO4d
- Marcus Geelnard
@ -302,13 +152,18 @@ skills.
- Marcel Metz
- Kenneth Miller
- Bruce Mitchener
- Jack Moffitt
- Jeff Molofee
- Jon Morton
- Pierre Moulon
- Julian Møller
- Kamil Nowakowski
- Ozzy
- Andri Pálsson
- Peoro
- Braden Pellett
- Arturo J. Pérez
- Pieroman
- Jorge Rodriguez
- Ed Ropple
- Riku Salminen
@ -316,6 +171,7 @@ skills.
- Matt Sealey
- SephiRok
- Steve Sexton
- Systemcluster
- Dmitri Shuralyov
- Daniel Skorupski
- Bradley Smith
@ -326,6 +182,7 @@ skills.
- TTK-Bandit
- Sergey Tikhomirov
- Samuli Tuomola
- urraka
- Jari Vetoniemi
- Simon Voordouw
- Torsten Walluhn

File diff suppressed because it is too large Load Diff

View File

@ -33,10 +33,10 @@ extern "C" {
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
**
** Khronos $Revision$ on $Date$
** Khronos $Revision: 23649 $ on $Date: 2013-10-23 00:21:49 -0700 (Wed, 23 Oct 2013) $
*/
#define GLX_GLXEXT_VERSION 20130710
#define GLX_GLXEXT_VERSION 20131008
/* Generated C header for:
* API: glx

View File

@ -33,7 +33,7 @@ extern "C" {
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
**
** Khronos $Revision$ on $Date$
** Khronos $Revision: 23649 $ on $Date: 2013-10-23 00:21:49 -0700 (Wed, 23 Oct 2013) $
*/
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
@ -41,7 +41,7 @@ extern "C" {
#include <windows.h>
#endif
#define WGL_WGLEXT_VERSION 20130710
#define WGL_WGLEXT_VERSION 20130916
/* Generated C header for:
* API: wgl
@ -645,6 +645,14 @@ BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarge
#endif
#endif /* WGL_NV_copy_image */
#ifndef WGL_NV_delay_before_swap
#define WGL_NV_delay_before_swap 1
typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglDelayBeforeSwapNV (HDC hDC, GLfloat seconds);
#endif
#endif /* WGL_NV_delay_before_swap */
#ifndef WGL_NV_float_buffer
#define WGL_NV_float_buffer 1
#define WGL_FLOAT_COMPONENTS_NV 0x20B0

View File

@ -659,6 +659,7 @@ INPUT = @GLFW_INTERNAL_DOCS@ \
@GLFW_SOURCE_DIR@/docs/news.dox \
@GLFW_SOURCE_DIR@/docs/quick.dox \
@GLFW_SOURCE_DIR@/docs/moving.dox \
@GLFW_SOURCE_DIR@/docs/compile.dox \
@GLFW_SOURCE_DIR@/docs/build.dox \
@GLFW_SOURCE_DIR@/docs/context.dox \
@GLFW_SOURCE_DIR@/docs/monitor.dox \
@ -899,13 +900,13 @@ HTML_FILE_EXTENSION = .html
# have to redo this when upgrading to a newer version of doxygen or when
# changing the value of configuration settings such as GENERATE_TREEVIEW!
HTML_HEADER =
HTML_HEADER = @GLFW_SOURCE_DIR@/docs/header.html
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
HTML_FOOTER =
HTML_FOOTER = @GLFW_SOURCE_DIR@/docs/footer.html
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
@ -924,7 +925,7 @@ HTML_STYLESHEET =
# robust against future updates. Doxygen will copy the style sheet file to
# the output directory.
HTML_EXTRA_STYLESHEET =
HTML_EXTRA_STYLESHEET = @GLFW_SOURCE_DIR@/docs/extra.css
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note

View File

@ -1,11 +1,13 @@
/*!
@page build Building programs using GLFW
@page build Building programs that use GLFW
@tableofcontents
This is about compiling and linking programs that use GLFW. For information on
how to *write* such programs, start with the [introductory tutorial](@ref quick).
how to write such programs, start with the [introductory tutorial](@ref quick).
For information on how to compile the GLFW library itself, see the @ref compile
guide.
@section build_include Including the GLFW header file
@ -48,7 +50,9 @@ header that the GLFW header includes and GLEW will work as expected.
@subsection build_macros GLFW header option macros
These macros may be defined before the inclusion of the GLFW header and affect
how that header behaves.
the behavior of the header. Note that GLFW does not provide any of the OpenGL
or OpenGL ES headers mentioned below. These are provided by your development
environment or your OpenGL or OpenGL ES SDK.
`GLFW_INCLUDE_GLCOREARB` makes the header include the modern `GL/glcorearb.h`
header (`OpenGL/gl3.h` on OS X) instead of the regular OpenGL header.
@ -81,8 +85,10 @@ The static version of the GLFW library is named `glfw3`. When using this
version, it is also necessary to link with some libraries that GLFW uses.
When linking a program under Windows that uses the static version of GLFW, you
must link with `opengl32`. If you are using GLU, you must also link with
`glu32`.
must link with `opengl32`. On some versions of MinGW, you must also explicitly
link with `gdi32`, while other versions of MinGW include it in the set of
default libraries along with other dependencies like `user32` and `kernel32`.
If you are using GLU, you must also link with `glu32`.
The link library for the GLFW DLL is named `glfw3dll`. When compiling a program
that uses the DLL version of GLFW, you need to define the `GLFW_DLL` macro
@ -158,7 +164,7 @@ If you are using the static library version of GLFW, use the
@subsection build_link_pkgconfig With pkg-config on OS X or other Unix
GLFW supports [pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config/),
and `glfw3.pc` file is generated when the GLFW library is built and installed
and the `glfw3.pc` file is generated when the GLFW library is built and installed
along with it.
A typical compile and link command-line when using the static may look like this:
@ -189,7 +195,7 @@ If you are using the dynamic library version of GLFW, simply add it to the
project dependencies.
If you are using the static library version of GLFW, add it and the Cocoa,
OpenGL and IOKit frameworks to the project as dependencies.
OpenGL, IOKit and CoreVideo frameworks to the project as dependencies.
@subsection build_link_osx With command-line on OS X
@ -198,7 +204,7 @@ If you do not wish to use pkg-config, you need to add the required frameworks
and libraries to your command-line using the `-l` and `-framework` switches,
i.e.:
cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit
cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo
Note that you do not add the `.framework` extension to a framework when adding
it from the command-line.

View File

@ -123,15 +123,15 @@ version 2.1.
Because of this, on OS X 10.7 and later, the `GLFW_CONTEXT_VERSION_MAJOR` and
`GLFW_CONTEXT_VERSION_MINOR` hints will cause @ref glfwCreateWindow to fail if
given version 3.0 or 3.1, the `GLFW_OPENGL_FORWARD_COMPAT` is required for
creating contexts for OpenGL 3.2 and later, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
is ignored and setting the `GLFW_OPENGL_PROFILE` hint to anything except
`GLFW_OPENGL_CORE_PROFILE` will cause @ref glfwCreateWindow to fail.
given version 3.0 or 3.1, the `GLFW_OPENGL_FORWARD_COMPAT` hint must be set to
non-zero and the `GLFW_OPENGL_PROFILE` hint must be set to
`GLFW_OPENGL_CORE_PROFILE` when creating OpenGL 3.2 and later contexts and the
`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored.
Also, on Mac OS X 10.6 and below, the `GLFW_CONTEXT_VERSION_MAJOR` and
`GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 2.1, the
`GLFW_OPENGL_DEBUG_CONTEXT` hint will have no effect, and setting the
`GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to a non-zero value
will cause @ref glfwCreateWindow to fail.
`GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 2.1,
setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to
a non-default value will cause @ref glfwCreateWindow to fail and the
`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored.
*/

261
extern/glfw/docs/compile.dox vendored Normal file
View File

@ -0,0 +1,261 @@
/*!
@page compile Compiling GLFW
@tableofcontents
This is about compiling the GLFW library itself. For information on how to
build programs that use GLFW, see the @ref build guide.
@section compile_deps Dependencies
To compile GLFW and the accompanying example programs, you will need **CMake**,
which will generate the project files or makefiles for your particular
development environment. If you are on a Unix-like system such as Linux or
FreeBSD or have a package system like Fink, MacPorts, Cygwin or Homebrew, you
can simply install its CMake package. If not, you can get installers for
Windows and OS X from the [CMake website](http://www.cmake.org/).
Additional dependencies are listed below.
If you wish to compile GLFW without CMake, see @ref compile_manual.
@subsection compile_deps_msvc Dependencies using Visual C++ on Windows
The Microsoft Platform SDK that is installed along with Visual C++ contains all
the necessary headers, link libraries and tools except for CMake.
@subsection compile_deps_mingw Dependencies with MinGW or MinGW-w64 on Windows
Both the MinGW and the MinGW-w64 packages contain all the necessary headers,
link libraries and tools except for CMake.
@subsection compile_deps_mingw_cross Dependencies using MinGW or MinGW-w64 cross-compilation
Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages. For
example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages
for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives
like Ubuntu have the `mingw-w64` package for both.
GLFW has CMake toolchain files in the `CMake/` directory that allow for easy
cross-compilation of Windows binaries. To use these files you need to add a
special parameter when generating the project files or makefiles:
cmake -DCMAKE_TOOLCHAIN_FILE=<toolchain-file> .
The exact toolchain file to use depends on the prefix used by the MinGW or
MinGW-w64 binaries on your system. You can usually see this in the /usr
directory. For example, both the Debian/Ubuntu and Cygwin MinGW-w64 packages
have `/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct
invocation would be:
cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake .
For more details see the article
[CMake Cross Compiling](http://www.paraview.org/Wiki/CMake_Cross_Compiling) on
the CMake wiki.
@subsection compile_deps_xcode Dependencies using Xcode on OS X
Xcode contains all necessary tools except for CMake. The necessary headers and
libraries are included in the core OS frameworks. Xcode can be downloaded from
the Mac App Store or from the ADC Member Center.
@subsection compile_deps_x11 Dependencies using Linux and X11
To compile GLFW for X11, you need to have the X11 and OpenGL header packages
installed, as well as the basic development tools like GCC and make. For
example, on Ubuntu and other distributions based on Debian GNU/Linux, you need
to install the `xorg-dev` and `libglu1-mesa-dev` packages. The former pulls in
all X.org header packages and the latter pulls in the Mesa OpenGL and GLU
packages. GLFW itself doesn't need or use GLU, but some of the examples do.
Note that using header files and libraries from Mesa during compilation *will
not* tie your binaries to the Mesa implementation of OpenGL.
@section compile_cmake Generating files with CMake
Once you have all necessary dependencies it is time to generate the project
files or makefiles for your development environment. CMake needs to know two
paths for this: the path to the *root* directory of the GLFW source tree (i.e.
*not* the `src` subdirectory) and the target path for the generated files and
compiled binaries. If these are the same, it is called an in-tree build,
otherwise it is called an out-of-tree build.
One of several advantages of out-of-tree builds is that you can generate files
and compile for different development environments using a single source tree.
@subsection compile_cmake_cli Generating files with the CMake command-line tool
To make an in-tree build, enter the *root* directory of the GLFW source tree
(i.e. *not* the `src` subdirectory) and run CMake. The current directory is
used as target path, while the path provided as an argument is used to find the
source tree.
cd <glfw-root-dir>
cmake .
To make an out-of-tree build, make another directory, enter it and run CMake
with the (relative or absolute) path to the root of the source tree as an
argument.
cd <glfw-root-dir>
mkdir build
cd build
cmake ..
@subsection compile_cmake_gui Generating files with the CMake GUI
If you are using the GUI version, choose the root of the GLFW source tree as
source location and the same directory or another, empty directory as the
destination for binaries. Choose *Configure*, change any options you wish to,
*Configure* again to let the changes take effect and then *Generate*.
@section compile_options CMake options
The CMake files for GLFW provide a number of options, although not all are
available on all supported platforms. Some of these are de facto standards
among CMake users and so have no `GLFW_` prefix.
If you are using the GUI version of CMake, these are listed and can be changed
from there. If you are using the command-line version, use the `ccmake` tool.
Some package systems like Ubuntu and other distributions based on Debian
GNU/Linux have this tool in a separate `cmake-curses-gui` package.
@subsection compile_options_shared Shared CMake options
`BUILD_SHARED_LIBS` determines whether GLFW is built as a static
library or as a DLL / shared library / dynamic library.
`LIB_SUFFIX` affects where the GLFW shared /dynamic library is installed. If it
is empty, it is installed to `${CMAKE_INSTALL_PREFIX}/lib`. If it is set to
`64`, it is installed to `${CMAKE_INSTALL_PREFIX}/lib64`.
`GLFW_CLIENT_LIBRARY` determines which client API library to use. If set to
`opengl` the OpenGL library is used, if set to `glesv1` for the OpenGL ES 1.x
library is used, or if set to `glesv2` the OpenGL ES 2.0 library is used. The
selected library and its header files must be present on the system for this to
work.
`GLFW_BUILD_EXAMPLES` determines whether the GLFW examples are built
along with the library.
`GLFW_BUILD_TESTS` determines whether the GLFW test programs are
built along with the library.
`GLFW_BUILD_DOCS` determines whether the GLFW documentation is built along with
the library.
@subsection compile_options_osx OS X specific CMake options
`GLFW_USE_CHDIR` determines whether `glfwInit` changes the current
directory of bundled applications to the `Contents/Resources` directory.
`GLFW_USE_MENUBAR` determines whether the first call to
`glfwCreateWindow` sets up a minimal menu bar.
`GLFW_BUILD_UNIVERSAL` determines whether to build Universal Binaries.
@subsection compile_options_win32 Windows specific CMake options
`USE_MSVC_RUNTIME_LIBRARY_DLL` determines whether to use the DLL version or the
static library version of the Visual C++ runtime library. If set to `ON`, the
DLL version of the Visual C++ library is used. It is recommended to set this to
`ON`, as this keeps the executable smaller and benefits from security and bug
fix updates of the Visual C++ runtime.
`GLFW_USE_DWM_SWAP_INTERVAL` determines whether the swap interval is set even
when DWM compositing is enabled. If this is `ON`, the swap interval is set even
if DWM is enabled. It is recommended to set this to `OFF`, as doing otherwise
can lead to severe jitter.
`GLFW_USE_OPTIMUS_HPG` determines whether to export the `NvOptimusEnablement`
symbol, which forces the use of the high-performance GPU on nVidia Optimus
systems.
@subsection compile_options_egl EGL specific CMake options
`GLFW_USE_EGL` determines whether to use EGL instead of the platform-specific
context creation API. Note that EGL is not yet provided on all supported
platforms.
@section compile_manual Compiling GLFW manually
If you wish to compile GLFW without its CMake build environment then you will
have to do at least some of the platform detection yourself. GLFW needs
a number of configuration macros to be defined in order to know what it's being
compiled for and has many optional, platform-specific ones for various features.
When building with CMake, the `glfw_config.h` configuration header is generated
based on the current platform and CMake options. The GLFW CMake environment
defines `_GLFW_USE_CONFIG_H`, which causes this header to be included by
`internal.h`. Without this macro, GLFW will expect the necessary configuration
macros to be defined on the command-line.
Three macros *must* be defined when compiling GLFW: one for selecting the window
creation API, one selecting the context creation API and one client library.
Exactly one of each kind must be defined for GLFW to compile and link.
The window creation API is used to create windows, handle input, monitors, gamma
ramps and clipboard. The options are:
- `_GLFW_COCOA` to use the Cocoa frameworks
- `_GLFW_WIN32` to use the Win32 API
- `_GLFW_X11` to use the X Window System
The context creation API is used to enumerate pixel formats / framebuffer
configurations and to create contexts. The options are:
- `_GLFW_NSGL` to use the Cocoa OpenGL framework
- `_GLFW_WGL` to use the Win32 WGL API
- `_GLFW_GLX` to use the X11 GLX API
- `_GLFW_EGL` to use the EGL API (experimental)
The client library is the one providing the OpenGL or OpenGL ES API, which is
used by GLFW to probe the created context. This is not the same thing as the
client API, as many desktop OpenGL client libraries now expose the OpenGL ES API
through extensions. The options are:
- `_GLFW_USE_OPENGL` for the desktop OpenGL (opengl32.dll, libGL.so or
OpenGL.framework)
- `_GLFW_USE_GLESV1` for OpenGL ES 1.x (experimental)
- `_GLFW_USE_GLESV2` for OpenGL ES 2.x (experimental)
Note that `_GLFW_USE_GLESV1` and `_GLFW_USE_GLESV2` may only be used with EGL,
as the other context creation APIs do not interface with OpenGL ES client
libraries.
If you are building GLFW as a shared library / dynamic library / DLL then you
must also define `_GLFW_BUILD_DLL`. Otherwise, you may not define it.
If you are using the X11 window creation API then you *must* also select an entry
point retrieval mechanism.
- `_GLFW_HAS_GLXGETPROCADDRESS` to use `glXGetProcAddress` (recommended)
- `_GLFW_HAS_GLXGETPROCADDRESSARB` to use `glXGetProcAddressARB` (legacy)
- `_GLFW_HAS_GLXGETPROCADDRESSEXT` to use `glXGetProcAddressEXT` (legacy)
- `_GLFW_HAS_DLOPEN` to do manual retrieval with `dlopen` (fallback)
If you are using the Cocoa window creation API, the following options are
available:
- `_GLFW_USE_CHDIR` to `chdir` to the `Resources` subdirectory of the
application bundle during @ref glfwInit (recommended)
- `_GLFW_USE_MENUBAR` to create and populate the menu bar when the first window
is created (recommended)
*/

View File

@ -24,6 +24,15 @@ what kind of context is created. See
[context related hints](@ref window_hints_ctx) in the window handling guide.
@section context_sharing Context object sharing
When creating a window and context with @ref glfwCreateWindow, you can specify
another window whose context the new one should share its objects with. OpenGL
object sharing is implemented by the operating system and graphics driver and is
described in the OpenGL documentation. On platforms where it is possible to
choose which types of objects are shared, GLFW requests that all are shared.
@section context_current Current context
Before you can use the OpenGL or OpenGL ES APIs, you need to have a current

312
extern/glfw/docs/extra.css vendored Normal file
View File

@ -0,0 +1,312 @@
html {
background-color:hsl(0,0%,95%);
}
.glfwheader {
font-size:16px;
height:64px;
max-width:920px;
margin:0em auto;
}
.glfwheader a#glfwhome {
line-height:64px;
padding-right:48px;
float:left;
color:hsl(0,0%,40%);
font-size:2.5em;
background-image:url("http://www.glfw.org/css/arrow.png");
background-position:right top;
background-repeat:no-repeat;
}
.glfwnavbar {
list-style-type:none;
margin-top:0px;
float:right;
}
.glfwnavbar li {
float:left;
}
.glfwnavbar a,.glfwnavbar a:visited {
line-height:64px;
margin-left:2em;
display:block;
color:hsl(0,0%,40%);
}
.glfwheader a#glfwhome,.glfwnavbar a,.glfwnavbar a:visited {
transition:all 0.35s ease 0s;
}
#titlearea,address.footer {
color:hsl(0,0%,40%);
background-color:hsl(0,0%,95%);
border-bottom:none;
}
address.footer {
text-align:center;
padding:2em;
}
div#top {
background-color:hsl(0,0%,40%);
}
div#navrow1,div#navrow2,div#navrow3,div#navrow4 {
background-color:hsl(0,0%,40%);
background-image:none;
max-width:920px;
margin:0em auto;
}
ul.tablist {
min-width:700px;
}
.tablist a,.tablist a:hover,.tablist li,.tablist li.current a {
background-image:none;
text-shadow:none;
}
.tablist a,.tablist a:visited {
color:hsl(0,0%,95%);
text-shadow:none;
}
.tablist li.current a {
background:linear-gradient(to bottom,hsl(34,100%,60%) 0%,hsl(24,100%,50%) 100%);
box-shadow:inset 0px 0px 32px hsl(24,100%,50%);
text-shadow:0px -1px 1px hsl(24,100%,35%);
color:hsl(0,0%,100%);
}
div.contents {
min-height:590px;
}
div.contents,div.header {
max-width:920px;
margin:0em auto;
padding:0em 2em 2em 2em;
background-color:hsl(0,0%,100%);
}
div.header {
background-image:none;
border-bottom:none;
}
table.doxtable th,dl.reflist dt,div.levels {
background:linear-gradient(to bottom,hsl(34,100%,60%) 0%,hsl(24,100%,50%) 100%);
box-shadow:inset 0px 0px 32px hsl(24,100%,50%);
text-shadow:0px -1px 1px hsl(24,100%,35%);
color:hsl(0,0%,100%);
}
dl.reflist dt a.el,div.levels span {
color:hsl(24,100%,50%);
padding:0.2em;
border-radius:4px;
background-color:hsl(24,100%,90%);
text-shadow:none;
}
div.memproto,div.qindex,div.ah {
background:linear-gradient(to bottom,hsl(34,0%,95%) 0%,hsl(24,0%,90%) 100%);
box-shadow:inset 0px 0px 32px hsl(24,0%,90%);
text-shadow:0px 1px 1px hsl(24,0%,100%);
color:hsl(0,0%,10%);
}
div.memproto a {
color:hsl(24,100%,50%);
}
div.memproto td.paramname {
text-shadow:0px 1px 1px hsl(24,0%,100%);
}
div.memproto,div.qindex,div.ah {
border:2px solid hsl(24,0%,90%);
border-radius:4px;
}
div.memdoc {
background:none;
box-shadow:none;
border:none;
}
td.paramname {
color:hsl(24,100%,25%);
}
dl.reflist dt {
border:2px solid hsl(24,100%,50%);
border-top-left-radius:4px;
border-top-right-radius:4px;
border-bottom:none;
}
dl.reflist dd {
border:2px solid hsl(24,100%,50%);
border-bottom-right-radius:4px;
border-bottom-left-radius:4px;
border-top:none;
background:none;
box-shadow:none;
}
table.doxtable {
border-collapse:inherit;
border-spacing:0px;
border:2px solid hsl(24,100%,50%);
border-radius:4px;
}
table.doxtable td,table.doxtable th {
border:none;
}
tr.even,.directory tr.even,table.doxtable tr:nth-child(even) {
background-color:hsl(0,0%,95%);
}
body {
color:hsl(0,0%,30%);
}
h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em {
color:hsl(0,0%,10%);
border-bottom:none;
}
a,a:hover,a:visited,a:visited:hover,a.el,a.el:visited,.glfwheader a#glfwhome:hover,.tablist a:hover {
color:hsl(24,100%,50%);
text-decoration:none;
}
.mdescLeft,.mdescRight,.memItemLeft,.memItemRight {
background-color:hsl(0,0%,95%);
}
div.directory {
border-collapse:inherit;
border-spacing:0px;
border:2px solid hsl(24,100%,50%);
border-radius:4px;
}
.directory .levels span {
color:hsl(24,100%,50%);
padding:0.1em 0.5em;
margin:auto 0.25em;
border-radius:2px;
background-color:hsl(24,100%,90%);
text-shadow:none;
}
td.memSeparator {
height:2px;
border:0px;
background:linear-gradient(to right,hsl(0,0%,95%) 0%,hsl(0,0%,85%) 50%,hsl(0,0%,95%) 100%);
}
dl.note,dl.pre,dl.post,dl.invariant {
background:linear-gradient(to bottom,hsl(103,80%,90%) 0%,hsl(103,80%,85%) 100%);
box-shadow:inset 0px 0px 32px hsl(103,40%,80%);
color:hsl(103,80%,10%);
border:2px solid hsl(103,40%,75%);
}
dl.warning,dl.attention {
background:linear-gradient(to bottom,hsl(34,80%,90%) 0%,hsl(34,80%,85%) 100%);
box-shadow:inset 0px 0px 32px hsl(34,40%,80%);
color:hsl(34,80%,10%);
border:2px solid hsl(34,40%,75%);
}
dl.deprecated,dl.bug {
background:linear-gradient(to bottom,hsl(333,80%,90%) 0%,hsl(333,80%,85%) 100%);
box-shadow:inset 0px 0px 32px hsl(333,40%,80%);
color:hsl(333,80%,10%);
border:2px solid hsl(333,40%,75%);
}
dl.todo,dl.test {
background:linear-gradient(to bottom,hsl(200,80%,90%) 0%,hsl(200,80%,85%) 100%);
box-shadow:inset 0px 0px 32px hsl(200,40%,80%);
color:hsl(200,80%,10%);
border:2px solid hsl(200,40%,75%);
}
dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test {
border-radius:4px;
padding:1em;
text-shadow:0px 1px 1px hsl(0,0%,100%);
}
div.toc {
background:linear-gradient(to bottom,hsl(34,0%,95%) 0%,hsl(24,0%,90%) 100%);
box-shadow:inset 0px 0px 32px hsl(24,0%,90%);
text-shadow:0px 1px 1px hsl(24,0%,100%);
color:hsl(0,0%,10%);
border:2px solid hsl(24,0%,90%);
border-radius:4px;
float:none;
width:auto;
}
div.toc h3 {
font-size:1.17em;
}
div.toc ul {
padding-left:1.5em;
}
div.toc li {
background:none;
font-size:1em;
padding-left:0em;
list-style-type:disc;
}
div.ah {
background-image:none;
}
div.fragment,pre.fragment {
background-color:hsl(0,0%,20%);
border-radius:4px;
border-width:0px;
padding:0.5em 2em;
overflow:auto;
border-left:4px solid hsl(0,0%,80%);
}
div.line,pre.fragment {
color:hsl(60,30%,96%);
}
a.code,a.code:visited,span.preprocessor,span.comment {
color:hsl(80,76%,53%);
}
span.keyword,span.keywordtype,span.keywordflow {
color:hsl(190,81%,67%);
}
span.stringliteral {
color:hsl(54,70%,68%);
}
code {
background-color:hsl(0,0%,95%);
padding:0.1em;
border-radius: 4px;
}

7
extern/glfw/docs/footer.html vendored Normal file
View File

@ -0,0 +1,7 @@
<address class="footer">
<p>
Last update on $date for $projectname $projectnumber
</p>
</address>
</body>
</html>

34
extern/glfw/docs/header.html vendored Normal file
View File

@ -0,0 +1,34 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen $doxygenversion"/>
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="$relpath^jquery.js"></script>
<script type="text/javascript" src="$relpath^dynsections.js"></script>
$treeview
$search
$mathjax
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
$extrastylesheet
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!--BEGIN TITLEAREA-->
<div id="titlearea">
<div class="glfwheader">
<a href="http://www.glfw.org/" id="glfwhome">GLFW</a>
<ul class="glfwnavbar">
<li><a href="http://www.glfw.org/documentation.html">Documentation</a></li>
<li><a href="http://www.glfw.org/download.html">Download</a></li>
<li><a href="http://www.glfw.org/media.html">Media</a></li>
<li><a href="http://www.glfw.org/community.html">Community</a></li>
</ul>
</div>
</div>
<!--END TITLEAREA-->
<!-- end header part -->

View File

@ -105,8 +105,8 @@ Examples: `clearScrollOffsets`
@section internals_config Configuration macros
GLFW uses a number of configuration macros to select at compile time which
interfaces and code paths to use. They are defined in the config.h header file,
which is generated from the `config.h.in` file by CMake.
interfaces and code paths to use. They are defined in the glfw_config.h header file,
which is generated from the `glfw_config.h.in` file by CMake.
Configuration macros the same style as tokens in the public interface, except
with a leading underscore.

View File

@ -11,7 +11,9 @@ existing applications and does not lay claim to the main loop.
This is the documentation for version 3.0, which has [many new features](@ref news).
There is a [quick tutorial](@ref quick) for people new to GLFW, which shows how
to write a small but complete program.
to write a small but complete program, and guides for
[compiling GLFW](@ref compile) and
[building programs that use GLFW](@ref build).
If you have used GLFW 2.x in the past, there is a
[transition guide](@ref moving) that explains what has changed and how to update

View File

@ -176,13 +176,24 @@ similar to that of GLFW 2.
@subsection moving_window_close Window closing
Window closing is now just an event like any other. GLFW 3 windows won't
disappear from underfoot even when no close callback is set; instead the
window's close flag is set. You can query this flag using @ref
glfwWindowShouldClose, or capture close events by setting a close callback. The
close flag can be modified from any point in your program using @ref
Window closing initiated by the user is now just an event like any other.
Unlike GLFW 2, windows and contexts created with GLFW 3 will not disappear from
underfoot. Each window now has a close flag, which is set when the user
attempts to close it. By default, nothing else happens and the window stays
open and visible. It is then up to you to either destroy the window, take some
other action or simply ignore the request. You can query the close flag at any
time with @ref glfwWindowShouldClose and set it at any time with @ref
glfwSetWindowShouldClose.
The close callback no longer returns a value. Instead, it is called after the
close flag has been set so it can override its value, if it chooses to, before
event processing completes. You may however not call @ref glfwDestroyWindow
from the close callback (or any other window related callback).
GLFW itself never clears the close flag, allowing you to set it for other
reasons for the window to close as well, for example the user choosing Quit from
the main menu.
@subsection moving_context Explicit context management

View File

@ -18,7 +18,7 @@ For more information on how to use CMake, see the
[CMake manual](http://cmake.org/cmake/help/documentation.html).
@subsection new_30_multiwnd Multi-window support
@subsection news_30_multiwnd Multi-window support
GLFW now supports the creation of multiple windows, each with their own OpenGL
or OpenGL ES context, and all window functions now take a window handle. Event
@ -79,7 +79,7 @@ through CMake options.
GLFW now supports high-DPI monitors on both Windows and OS X, giving windows full
resolution framebuffers where other UI elements are scaled up. To achieve this,
@ref glfwGetFramebufferSize and @ref glfwSetFramebufferSizeCallback have been
added. These work with pixels, while the rest of the GLFW API work with screen
added. These work with pixels, while the rest of the GLFW API works with screen
coordinates.

View File

@ -302,4 +302,7 @@ the screen, rendering a triangle and processing events until the user closes the
window. It can be found in the source distribution as `examples/simple.c`, and
is by default compiled along with all other examples when you build GLFW.
To learn more about how to compile and link programs that use GLFW, see
@ref build.
*/

View File

@ -62,6 +62,14 @@ Once this function is called, no more events will be delivered for that window
and its handle becomes invalid.
@section window_userptr Window user pointer
Each window has a user pointer that can be set with @ref
glfwSetWindowUserPointer and fetched with @ref glfwGetWindowUserPointer. This
can be used for any purpose you need and will not modified by GLFW throughout
the life-time of the window.
@section window_hints Window creation hints
There are a number of hints that can be set before the creation of a window and
@ -440,7 +448,9 @@ context is an OpenGL debug context, or `GL_FALSE` otherwise.
The `GLFW_OPENGL_PROFILE` attribute indicates the OpenGL profile used by the
context. This is `GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE`
if the context uses a known profile, or `GLFW_OPENGL_ANY_PROFILE` if the
OpenGL profile is unknown or the context is for another client API.
OpenGL profile is unknown or the context is for another client API. Note that
the returned profile may not match the profile bits of the context flags, as
GLFW will try other means of detecting the profile when no bits are set.
The `GLFW_CONTEXT_ROBUSTNESS` attribute indicates the robustness strategy
used by the context. This is `GLFW_LOSE_CONTEXT_ON_RESET` or
@ -477,8 +487,10 @@ zero can be useful for benchmarking purposes, when it is not desirable to
measure the time it takes to wait for the vertical retrace. However, a swap
interval of one lets you avoid tearing.
Note that not all OpenGL implementations properly implement this function, in
which case @ref glfwSwapInterval will have no effect. Some drivers also have
user settings that override requests by GLFW.
Note that this may not work on all machines, as some drivers have
user-controlled settings that override any swap interval the application
requests. It is also by default disabled on Windows Vista and later when using
DWM (Aero), as using it there sometimes leads to severe jitter. You can
forcibly enable it for machines using DWM using @ref compile_options_win32.
*/

60
extern/glfw/examples/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,60 @@
link_libraries(glfw ${OPENGL_glu_LIBRARY})
if (BUILD_SHARED_LIBS)
add_definitions(-DGLFW_DLL)
link_libraries(${OPENGL_gl_LIBRARY} ${MATH_LIBRARY})
else()
link_libraries(${glfw_LIBRARIES})
endif()
include_directories(${GLFW_SOURCE_DIR}/include
${GLFW_SOURCE_DIR}/deps)
if (NOT APPLE)
# HACK: This is NOTFOUND on OS X 10.8
include_directories(${OPENGL_INCLUDE_DIR})
endif()
set(GETOPT ${GLFW_SOURCE_DIR}/deps/getopt.h
${GLFW_SOURCE_DIR}/deps/getopt.c)
if (APPLE)
# Set fancy names for bundles
add_executable(Boing MACOSX_BUNDLE boing.c)
add_executable(Gears MACOSX_BUNDLE gears.c)
add_executable(Simple MACOSX_BUNDLE simple.c)
add_executable("Split View" MACOSX_BUNDLE splitview.c)
add_executable(Wave MACOSX_BUNDLE wave.c)
set_target_properties(Boing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Boing")
set_target_properties(Gears PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gears")
set_target_properties(Simple PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Simple")
set_target_properties("Split View" PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Split View")
set_target_properties(Wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave")
else()
# Set boring names for executables
add_executable(boing WIN32 boing.c)
add_executable(gears WIN32 gears.c)
add_executable(heightmap WIN32 heightmap.c ${GETOPT})
add_executable(simple WIN32 simple.c)
add_executable(splitview WIN32 splitview.c)
add_executable(wave WIN32 wave.c)
endif()
if (MSVC)
set(WINDOWS_BINARIES boing gears heightmap simple splitview wave)
# Tell MSVC to use main instead of WinMain for Windows subsystem executables
set_target_properties(${WINDOWS_BINARIES} PROPERTIES
LINK_FLAGS "/ENTRY:mainCRTStartup")
endif()
if (APPLE)
set(BUNDLE_BINARIES Boing Gears Simple "Split View" Wave)
set_target_properties(${BUNDLE_BINARIES} PROPERTIES
MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION_FULL})
endif()

628
extern/glfw/examples/boing.c vendored Normal file
View File

@ -0,0 +1,628 @@
/*****************************************************************************
* Title: GLBoing
* Desc: Tribute to Amiga Boing.
* Author: Jim Brooks <gfx@jimbrooks.org>
* Original Amiga authors were R.J. Mical and Dale Luck.
* GLFW conversion by Marcus Geelnard
* Notes: - 360' = 2*PI [radian]
*
* - Distances between objects are created by doing a relative
* Z translations.
*
* - Although OpenGL enticingly supports alpha-blending,
* the shadow of the original Boing didn't affect the color
* of the grid.
*
* - [Marcus] Changed timing scheme from interval driven to frame-
* time based animation steps (which results in much smoother
* movement)
*
* History of Amiga Boing:
*
* Boing was demonstrated on the prototype Amiga (codenamed "Lorraine") in
* 1985. According to legend, it was written ad-hoc in one night by
* R. J. Mical and Dale Luck. Because the bouncing ball animation was so fast
* and smooth, attendees did not believe the Amiga prototype was really doing
* the rendering. Suspecting a trick, they began looking around the booth for
* a hidden computer or VCR.
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
/*****************************************************************************
* Various declarations and macros
*****************************************************************************/
/* Prototypes */
void init( void );
void display( void );
void reshape( GLFWwindow* window, int w, int h );
void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods );
void DrawBoingBall( void );
void BounceBall( double dt );
void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi );
void DrawGrid( void );
#define RADIUS 70.f
#define STEP_LONGITUDE 22.5f /* 22.5 makes 8 bands like original Boing */
#define STEP_LATITUDE 22.5f
#define DIST_BALL (RADIUS * 2.f + RADIUS * 0.1f)
#define VIEW_SCENE_DIST (DIST_BALL * 3.f + 200.f)/* distance from viewer to middle of boing area */
#define GRID_SIZE (RADIUS * 4.5f) /* length (width) of grid */
#define BOUNCE_HEIGHT (RADIUS * 2.1f)
#define BOUNCE_WIDTH (RADIUS * 2.1f)
#define SHADOW_OFFSET_X -20.f
#define SHADOW_OFFSET_Y 10.f
#define SHADOW_OFFSET_Z 0.f
#define WALL_L_OFFSET 0.f
#define WALL_R_OFFSET 5.f
/* Animation speed (50.0 mimics the original GLUT demo speed) */
#define ANIMATION_SPEED 50.f
/* Maximum allowed delta time per physics iteration */
#define MAX_DELTA_T 0.02f
/* Draw ball, or its shadow */
typedef enum { DRAW_BALL, DRAW_BALL_SHADOW } DRAW_BALL_ENUM;
/* Vertex type */
typedef struct {float x; float y; float z;} vertex_t;
/* Global vars */
GLfloat deg_rot_y = 0.f;
GLfloat deg_rot_y_inc = 2.f;
GLfloat ball_x = -RADIUS;
GLfloat ball_y = -RADIUS;
GLfloat ball_x_inc = 1.f;
GLfloat ball_y_inc = 2.f;
DRAW_BALL_ENUM drawBallHow;
double t;
double t_old = 0.f;
double dt;
/* Random number generator */
#ifndef RAND_MAX
#define RAND_MAX 4095
#endif
/* PI */
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
/*****************************************************************************
* Truncate a degree.
*****************************************************************************/
GLfloat TruncateDeg( GLfloat deg )
{
if ( deg >= 360.f )
return (deg - 360.f);
else
return deg;
}
/*****************************************************************************
* Convert a degree (360-based) into a radian.
* 360' = 2 * PI
*****************************************************************************/
double deg2rad( double deg )
{
return deg / 360 * (2 * M_PI);
}
/*****************************************************************************
* 360' sin().
*****************************************************************************/
double sin_deg( double deg )
{
return sin( deg2rad( deg ) );
}
/*****************************************************************************
* 360' cos().
*****************************************************************************/
double cos_deg( double deg )
{
return cos( deg2rad( deg ) );
}
/*****************************************************************************
* Compute a cross product (for a normal vector).
*
* c = a x b
*****************************************************************************/
void CrossProduct( vertex_t a, vertex_t b, vertex_t c, vertex_t *n )
{
GLfloat u1, u2, u3;
GLfloat v1, v2, v3;
u1 = b.x - a.x;
u2 = b.y - a.y;
u3 = b.y - a.z;
v1 = c.x - a.x;
v2 = c.y - a.y;
v3 = c.z - a.z;
n->x = u2 * v3 - v2 * v3;
n->y = u3 * v1 - v3 * u1;
n->z = u1 * v2 - v1 * u2;
}
/*****************************************************************************
* Calculate the angle to be passed to gluPerspective() so that a scene
* is visible. This function originates from the OpenGL Red Book.
*
* Parms : size
* The size of the segment when the angle is intersected at "dist"
* (ie at the outermost edge of the angle of vision).
*
* dist
* Distance from viewpoint to scene.
*****************************************************************************/
GLfloat PerspectiveAngle( GLfloat size,
GLfloat dist )
{
GLfloat radTheta, degTheta;
radTheta = 2.f * (GLfloat) atan2( size / 2.f, dist );
degTheta = (180.f * radTheta) / (GLfloat) M_PI;
return degTheta;
}
#define BOING_DEBUG 0
/*****************************************************************************
* init()
*****************************************************************************/
void init( void )
{
/*
* Clear background.
*/
glClearColor( 0.55f, 0.55f, 0.55f, 0.f );
glShadeModel( GL_FLAT );
}
/*****************************************************************************
* display()
*****************************************************************************/
void display(void)
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();
drawBallHow = DRAW_BALL_SHADOW;
DrawBoingBall();
DrawGrid();
drawBallHow = DRAW_BALL;
DrawBoingBall();
glPopMatrix();
glFlush();
}
/*****************************************************************************
* reshape()
*****************************************************************************/
void reshape( GLFWwindow* window, int w, int h )
{
glViewport( 0, 0, (GLsizei)w, (GLsizei)h );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( PerspectiveAngle( RADIUS * 2, 200 ),
(GLfloat)w / (GLfloat)h,
1.0,
VIEW_SCENE_DIST );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
gluLookAt( 0.0, 0.0, VIEW_SCENE_DIST,/* eye */
0.0, 0.0, 0.0, /* center of vision */
0.0, -1.0, 0.0 ); /* up vector */
}
void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods )
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
/*****************************************************************************
* Draw the Boing ball.
*
* The Boing ball is sphere in which each facet is a rectangle.
* Facet colors alternate between red and white.
* The ball is built by stacking latitudinal circles. Each circle is composed
* of a widely-separated set of points, so that each facet is noticably large.
*****************************************************************************/
void DrawBoingBall( void )
{
GLfloat lon_deg; /* degree of longitude */
double dt_total, dt2;
glPushMatrix();
glMatrixMode( GL_MODELVIEW );
/*
* Another relative Z translation to separate objects.
*/
glTranslatef( 0.0, 0.0, DIST_BALL );
/* Update ball position and rotation (iterate if necessary) */
dt_total = dt;
while( dt_total > 0.0 )
{
dt2 = dt_total > MAX_DELTA_T ? MAX_DELTA_T : dt_total;
dt_total -= dt2;
BounceBall( dt2 );
deg_rot_y = TruncateDeg( deg_rot_y + deg_rot_y_inc*((float)dt2*ANIMATION_SPEED) );
}
/* Set ball position */
glTranslatef( ball_x, ball_y, 0.0 );
/*
* Offset the shadow.
*/
if ( drawBallHow == DRAW_BALL_SHADOW )
{
glTranslatef( SHADOW_OFFSET_X,
SHADOW_OFFSET_Y,
SHADOW_OFFSET_Z );
}
/*
* Tilt the ball.
*/
glRotatef( -20.0, 0.0, 0.0, 1.0 );
/*
* Continually rotate ball around Y axis.
*/
glRotatef( deg_rot_y, 0.0, 1.0, 0.0 );
/*
* Set OpenGL state for Boing ball.
*/
glCullFace( GL_FRONT );
glEnable( GL_CULL_FACE );
glEnable( GL_NORMALIZE );
/*
* Build a faceted latitude slice of the Boing ball,
* stepping same-sized vertical bands of the sphere.
*/
for ( lon_deg = 0;
lon_deg < 180;
lon_deg += STEP_LONGITUDE )
{
/*
* Draw a latitude circle at this longitude.
*/
DrawBoingBallBand( lon_deg,
lon_deg + STEP_LONGITUDE );
}
glPopMatrix();
return;
}
/*****************************************************************************
* Bounce the ball.
*****************************************************************************/
void BounceBall( double delta_t )
{
GLfloat sign;
GLfloat deg;
/* Bounce on walls */
if ( ball_x > (BOUNCE_WIDTH/2 + WALL_R_OFFSET ) )
{
ball_x_inc = -0.5f - 0.75f * (GLfloat)rand() / (GLfloat)RAND_MAX;
deg_rot_y_inc = -deg_rot_y_inc;
}
if ( ball_x < -(BOUNCE_HEIGHT/2 + WALL_L_OFFSET) )
{
ball_x_inc = 0.5f + 0.75f * (GLfloat)rand() / (GLfloat)RAND_MAX;
deg_rot_y_inc = -deg_rot_y_inc;
}
/* Bounce on floor / roof */
if ( ball_y > BOUNCE_HEIGHT/2 )
{
ball_y_inc = -0.75f - 1.f * (GLfloat)rand() / (GLfloat)RAND_MAX;
}
if ( ball_y < -BOUNCE_HEIGHT/2*0.85 )
{
ball_y_inc = 0.75f + 1.f * (GLfloat)rand() / (GLfloat)RAND_MAX;
}
/* Update ball position */
ball_x += ball_x_inc * ((float)delta_t*ANIMATION_SPEED);
ball_y += ball_y_inc * ((float)delta_t*ANIMATION_SPEED);
/*
* Simulate the effects of gravity on Y movement.
*/
if ( ball_y_inc < 0 ) sign = -1.0; else sign = 1.0;
deg = (ball_y + BOUNCE_HEIGHT/2) * 90 / BOUNCE_HEIGHT;
if ( deg > 80 ) deg = 80;
if ( deg < 10 ) deg = 10;
ball_y_inc = sign * 4.f * (float) sin_deg( deg );
}
/*****************************************************************************
* Draw a faceted latitude band of the Boing ball.
*
* Parms: long_lo, long_hi
* Low and high longitudes of slice, resp.
*****************************************************************************/
void DrawBoingBallBand( GLfloat long_lo,
GLfloat long_hi )
{
vertex_t vert_ne; /* "ne" means south-east, so on */
vertex_t vert_nw;
vertex_t vert_sw;
vertex_t vert_se;
vertex_t vert_norm;
GLfloat lat_deg;
static int colorToggle = 0;
/*
* Iterate thru the points of a latitude circle.
* A latitude circle is a 2D set of X,Z points.
*/
for ( lat_deg = 0;
lat_deg <= (360 - STEP_LATITUDE);
lat_deg += STEP_LATITUDE )
{
/*
* Color this polygon with red or white.
*/
if ( colorToggle )
glColor3f( 0.8f, 0.1f, 0.1f );
else
glColor3f( 0.95f, 0.95f, 0.95f );
#if 0
if ( lat_deg >= 180 )
if ( colorToggle )
glColor3f( 0.1f, 0.8f, 0.1f );
else
glColor3f( 0.5f, 0.5f, 0.95f );
#endif
colorToggle = ! colorToggle;
/*
* Change color if drawing shadow.
*/
if ( drawBallHow == DRAW_BALL_SHADOW )
glColor3f( 0.35f, 0.35f, 0.35f );
/*
* Assign each Y.
*/
vert_ne.y = vert_nw.y = (float) cos_deg(long_hi) * RADIUS;
vert_sw.y = vert_se.y = (float) cos_deg(long_lo) * RADIUS;
/*
* Assign each X,Z with sin,cos values scaled by latitude radius indexed by longitude.
* Eg, long=0 and long=180 are at the poles, so zero scale is sin(longitude),
* while long=90 (sin(90)=1) is at equator.
*/
vert_ne.x = (float) cos_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE ));
vert_se.x = (float) cos_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo ));
vert_nw.x = (float) cos_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE ));
vert_sw.x = (float) cos_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo ));
vert_ne.z = (float) sin_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE ));
vert_se.z = (float) sin_deg( lat_deg ) * (RADIUS * (float) sin_deg( long_lo ));
vert_nw.z = (float) sin_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo + STEP_LONGITUDE ));
vert_sw.z = (float) sin_deg( lat_deg + STEP_LATITUDE ) * (RADIUS * (float) sin_deg( long_lo ));
/*
* Draw the facet.
*/
glBegin( GL_POLYGON );
CrossProduct( vert_ne, vert_nw, vert_sw, &vert_norm );
glNormal3f( vert_norm.x, vert_norm.y, vert_norm.z );
glVertex3f( vert_ne.x, vert_ne.y, vert_ne.z );
glVertex3f( vert_nw.x, vert_nw.y, vert_nw.z );
glVertex3f( vert_sw.x, vert_sw.y, vert_sw.z );
glVertex3f( vert_se.x, vert_se.y, vert_se.z );
glEnd();
#if BOING_DEBUG
printf( "----------------------------------------------------------- \n" );
printf( "lat = %f long_lo = %f long_hi = %f \n", lat_deg, long_lo, long_hi );
printf( "vert_ne x = %.8f y = %.8f z = %.8f \n", vert_ne.x, vert_ne.y, vert_ne.z );
printf( "vert_nw x = %.8f y = %.8f z = %.8f \n", vert_nw.x, vert_nw.y, vert_nw.z );
printf( "vert_se x = %.8f y = %.8f z = %.8f \n", vert_se.x, vert_se.y, vert_se.z );
printf( "vert_sw x = %.8f y = %.8f z = %.8f \n", vert_sw.x, vert_sw.y, vert_sw.z );
#endif
}
/*
* Toggle color so that next band will opposite red/white colors than this one.
*/
colorToggle = ! colorToggle;
/*
* This circular band is done.
*/
return;
}
/*****************************************************************************
* Draw the purple grid of lines, behind the Boing ball.
* When the Workbench is dropped to the bottom, Boing shows 12 rows.
*****************************************************************************/
void DrawGrid( void )
{
int row, col;
const int rowTotal = 12; /* must be divisible by 2 */
const int colTotal = rowTotal; /* must be same as rowTotal */
const GLfloat widthLine = 2.0; /* should be divisible by 2 */
const GLfloat sizeCell = GRID_SIZE / rowTotal;
const GLfloat z_offset = -40.0;
GLfloat xl, xr;
GLfloat yt, yb;
glPushMatrix();
glDisable( GL_CULL_FACE );
/*
* Another relative Z translation to separate objects.
*/
glTranslatef( 0.0, 0.0, DIST_BALL );
/*
* Draw vertical lines (as skinny 3D rectangles).
*/
for ( col = 0; col <= colTotal; col++ )
{
/*
* Compute co-ords of line.
*/
xl = -GRID_SIZE / 2 + col * sizeCell;
xr = xl + widthLine;
yt = GRID_SIZE / 2;
yb = -GRID_SIZE / 2 - widthLine;
glBegin( GL_POLYGON );
glColor3f( 0.6f, 0.1f, 0.6f ); /* purple */
glVertex3f( xr, yt, z_offset ); /* NE */
glVertex3f( xl, yt, z_offset ); /* NW */
glVertex3f( xl, yb, z_offset ); /* SW */
glVertex3f( xr, yb, z_offset ); /* SE */
glEnd();
}
/*
* Draw horizontal lines (as skinny 3D rectangles).
*/
for ( row = 0; row <= rowTotal; row++ )
{
/*
* Compute co-ords of line.
*/
yt = GRID_SIZE / 2 - row * sizeCell;
yb = yt - widthLine;
xl = -GRID_SIZE / 2;
xr = GRID_SIZE / 2 + widthLine;
glBegin( GL_POLYGON );
glColor3f( 0.6f, 0.1f, 0.6f ); /* purple */
glVertex3f( xr, yt, z_offset ); /* NE */
glVertex3f( xl, yt, z_offset ); /* NW */
glVertex3f( xl, yb, z_offset ); /* SW */
glVertex3f( xr, yb, z_offset ); /* SE */
glEnd();
}
glPopMatrix();
return;
}
/*======================================================================*
* main()
*======================================================================*/
int main( void )
{
GLFWwindow* window;
int width, height;
/* Init GLFW */
if( !glfwInit() )
exit( EXIT_FAILURE );
glfwWindowHint(GLFW_DEPTH_BITS, 16);
window = glfwCreateWindow( 400, 400, "Boing (classic Amiga demo)", NULL, NULL );
if (!window)
{
glfwTerminate();
exit( EXIT_FAILURE );
}
glfwSetFramebufferSizeCallback(window, reshape);
glfwSetKeyCallback(window, key_callback);
glfwMakeContextCurrent(window);
glfwSwapInterval( 1 );
glfwGetFramebufferSize(window, &width, &height);
reshape(window, width, height);
glfwSetTime( 0.0 );
init();
/* Main loop */
for (;;)
{
/* Timing */
t = glfwGetTime();
dt = t - t_old;
t_old = t;
/* Draw one frame */
display();
/* Swap buffers */
glfwSwapBuffers(window);
glfwPollEvents();
/* Check if we are still running */
if (glfwWindowShouldClose(window))
break;
}
glfwTerminate();
exit( EXIT_SUCCESS );
}

372
extern/glfw/examples/gears.c vendored Normal file
View File

@ -0,0 +1,372 @@
/*
* 3-D gear wheels. This program is in the public domain.
*
* Command line options:
* -info print GL implementation information
* -exit automatically exit after 30 seconds
*
*
* Brian Paul
*
*
* Marcus Geelnard:
* - Conversion to GLFW
* - Time based rendering (frame rate independent)
* - Slightly modified camera that should work better for stereo viewing
*
*
* Camilla Berglund:
* - Removed FPS counter (this is not a benchmark)
* - Added a few comments
* - Enabled vsync
*/
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GLFW/glfw3.h>
#ifndef M_PI
#define M_PI 3.141592654
#endif
/* If non-zero, the program exits after that many seconds
*/
static int autoexit = 0;
/**
Draw a gear wheel. You'll probably want to call this function when
building a display list since we do a lot of trig here.
Input: inner_radius - radius of hole at center
outer_radius - radius at center of teeth
width - width of gear teeth - number of teeth
tooth_depth - depth of tooth
**/
static void
gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
GLint teeth, GLfloat tooth_depth)
{
GLint i;
GLfloat r0, r1, r2;
GLfloat angle, da;
GLfloat u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.f;
r2 = outer_radius + tooth_depth / 2.f;
da = 2.f * (float) M_PI / teeth / 4.f;
glShadeModel(GL_FLAT);
glNormal3f(0.f, 0.f, 1.f);
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.f * (float) M_PI / teeth;
glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), width * 0.5f);
glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), width * 0.5f);
if (i < teeth) {
glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), width * 0.5f);
glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), width * 0.5f);
}
}
glEnd();
/* draw front sides of teeth */
glBegin(GL_QUADS);
da = 2.f * (float) M_PI / teeth / 4.f;
for (i = 0; i < teeth; i++) {
angle = i * 2.f * (float) M_PI / teeth;
glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), width * 0.5f);
glVertex3f(r2 * (float) cos(angle + da), r2 * (float) sin(angle + da), width * 0.5f);
glVertex3f(r2 * (float) cos(angle + 2 * da), r2 * (float) sin(angle + 2 * da), width * 0.5f);
glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), width * 0.5f);
}
glEnd();
glNormal3f(0.0, 0.0, -1.0);
/* draw back face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.f * (float) M_PI / teeth;
glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), -width * 0.5f);
glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), -width * 0.5f);
if (i < teeth) {
glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), -width * 0.5f);
glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), -width * 0.5f);
}
}
glEnd();
/* draw back sides of teeth */
glBegin(GL_QUADS);
da = 2.f * (float) M_PI / teeth / 4.f;
for (i = 0; i < teeth; i++) {
angle = i * 2.f * (float) M_PI / teeth;
glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), -width * 0.5f);
glVertex3f(r2 * (float) cos(angle + 2 * da), r2 * (float) sin(angle + 2 * da), -width * 0.5f);
glVertex3f(r2 * (float) cos(angle + da), r2 * (float) sin(angle + da), -width * 0.5f);
glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), -width * 0.5f);
}
glEnd();
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i = 0; i < teeth; i++) {
angle = i * 2.f * (float) M_PI / teeth;
glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), width * 0.5f);
glVertex3f(r1 * (float) cos(angle), r1 * (float) sin(angle), -width * 0.5f);
u = r2 * (float) cos(angle + da) - r1 * (float) cos(angle);
v = r2 * (float) sin(angle + da) - r1 * (float) sin(angle);
len = (float) sqrt(u * u + v * v);
u /= len;
v /= len;
glNormal3f(v, -u, 0.0);
glVertex3f(r2 * (float) cos(angle + da), r2 * (float) sin(angle + da), width * 0.5f);
glVertex3f(r2 * (float) cos(angle + da), r2 * (float) sin(angle + da), -width * 0.5f);
glNormal3f((float) cos(angle), (float) sin(angle), 0.f);
glVertex3f(r2 * (float) cos(angle + 2 * da), r2 * (float) sin(angle + 2 * da), width * 0.5f);
glVertex3f(r2 * (float) cos(angle + 2 * da), r2 * (float) sin(angle + 2 * da), -width * 0.5f);
u = r1 * (float) cos(angle + 3 * da) - r2 * (float) cos(angle + 2 * da);
v = r1 * (float) sin(angle + 3 * da) - r2 * (float) sin(angle + 2 * da);
glNormal3f(v, -u, 0.f);
glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), width * 0.5f);
glVertex3f(r1 * (float) cos(angle + 3 * da), r1 * (float) sin(angle + 3 * da), -width * 0.5f);
glNormal3f((float) cos(angle), (float) sin(angle), 0.f);
}
glVertex3f(r1 * (float) cos(0), r1 * (float) sin(0), width * 0.5f);
glVertex3f(r1 * (float) cos(0), r1 * (float) sin(0), -width * 0.5f);
glEnd();
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.f * (float) M_PI / teeth;
glNormal3f(-(float) cos(angle), -(float) sin(angle), 0.f);
glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), -width * 0.5f);
glVertex3f(r0 * (float) cos(angle), r0 * (float) sin(angle), width * 0.5f);
}
glEnd();
}
static GLfloat view_rotx = 20.f, view_roty = 30.f, view_rotz = 0.f;
static GLint gear1, gear2, gear3;
static GLfloat angle = 0.f;
/* OpenGL draw function & timing */
static void draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1.0, 0.0, 0.0);
glRotatef(view_roty, 0.0, 1.0, 0.0);
glRotatef(view_rotz, 0.0, 0.0, 1.0);
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
glRotatef(angle, 0.0, 0.0, 1.0);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1f, -2.f, 0.f);
glRotatef(-2.f * angle - 9.f, 0.f, 0.f, 1.f);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1f, 4.2f, 0.f);
glRotatef(-2.f * angle - 25.f, 0.f, 0.f, 1.f);
glCallList(gear3);
glPopMatrix();
glPopMatrix();
}
/* update animation parameters */
static void animate(void)
{
angle = 100.f * (float) glfwGetTime();
}
/* change view angle, exit upon ESC */
void key( GLFWwindow* window, int k, int s, int action, int mods )
{
if( action != GLFW_PRESS ) return;
switch (k) {
case GLFW_KEY_Z:
if( mods & GLFW_MOD_SHIFT )
view_rotz -= 5.0;
else
view_rotz += 5.0;
break;
case GLFW_KEY_ESCAPE:
glfwSetWindowShouldClose(window, GL_TRUE);
break;
case GLFW_KEY_UP:
view_rotx += 5.0;
break;
case GLFW_KEY_DOWN:
view_rotx -= 5.0;
break;
case GLFW_KEY_LEFT:
view_roty += 5.0;
break;
case GLFW_KEY_RIGHT:
view_roty -= 5.0;
break;
default:
return;
}
}
/* new window size */
void reshape( GLFWwindow* window, int width, int height )
{
GLfloat h = (GLfloat) height / (GLfloat) width;
GLfloat xmax, znear, zfar;
znear = 5.0f;
zfar = 30.0f;
xmax = znear * 0.5f;
glViewport( 0, 0, (GLint) width, (GLint) height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -xmax, xmax, -xmax*h, xmax*h, znear, zfar );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -20.0 );
}
/* program & OpenGL initialization */
static void init(int argc, char *argv[])
{
static GLfloat pos[4] = {5.f, 5.f, 10.f, 0.f};
static GLfloat red[4] = {0.8f, 0.1f, 0.f, 1.f};
static GLfloat green[4] = {0.f, 0.8f, 0.2f, 1.f};
static GLfloat blue[4] = {0.2f, 0.2f, 1.f, 1.f};
GLint i;
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
/* make the gears */
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
gear(1.f, 4.f, 1.f, 20, 0.7f);
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
gear(0.5f, 2.f, 2.f, 10, 0.7f);
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
gear(1.3f, 2.f, 0.5f, 10, 0.7f);
glEndList();
glEnable(GL_NORMALIZE);
for ( i=1; i<argc; i++ ) {
if (strcmp(argv[i], "-info")==0) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
else if ( strcmp(argv[i], "-exit")==0) {
autoexit = 30;
printf("Auto Exit after %i seconds.\n", autoexit );
}
}
}
/* program entry */
int main(int argc, char *argv[])
{
GLFWwindow* window;
int width, height;
if( !glfwInit() )
{
fprintf( stderr, "Failed to initialize GLFW\n" );
exit( EXIT_FAILURE );
}
glfwWindowHint(GLFW_DEPTH_BITS, 16);
window = glfwCreateWindow( 300, 300, "Gears", NULL, NULL );
if (!window)
{
fprintf( stderr, "Failed to open GLFW window\n" );
glfwTerminate();
exit( EXIT_FAILURE );
}
// Set callback functions
glfwSetFramebufferSizeCallback(window, reshape);
glfwSetKeyCallback(window, key);
glfwMakeContextCurrent(window);
glfwSwapInterval( 1 );
glfwGetFramebufferSize(window, &width, &height);
reshape(window, width, height);
// Parse command-line options
init(argc, argv);
// Main loop
while( !glfwWindowShouldClose(window) )
{
// Draw gears
draw();
// Update animation
animate();
// Swap buffers
glfwSwapBuffers(window);
glfwPollEvents();
}
// Terminate GLFW
glfwTerminate();
// Exit program
exit( EXIT_SUCCESS );
}

678
extern/glfw/examples/heightmap.c vendored Normal file
View File

@ -0,0 +1,678 @@
//========================================================================
// Heightmap example program using OpenGL 3 core profile
// Copyright (c) 2010 Olivier Delannoy
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <stddef.h>
#include "getopt.h"
#include <GLFW/glfw3.h>
#include <GL/glext.h>
/* OpenGL function pointers */
static PFNGLGENBUFFERSPROC pglGenBuffers = NULL;
static PFNGLGENVERTEXARRAYSPROC pglGenVertexArrays = NULL;
static PFNGLDELETEVERTEXARRAYSPROC pglDeleteVertexArrays = NULL;
static PFNGLCREATESHADERPROC pglCreateShader = NULL;
static PFNGLSHADERSOURCEPROC pglShaderSource = NULL;
static PFNGLCOMPILESHADERPROC pglCompileShader = NULL;
static PFNGLGETSHADERIVPROC pglGetShaderiv = NULL;
static PFNGLGETSHADERINFOLOGPROC pglGetShaderInfoLog = NULL;
static PFNGLDELETESHADERPROC pglDeleteShader = NULL;
static PFNGLCREATEPROGRAMPROC pglCreateProgram = NULL;
static PFNGLATTACHSHADERPROC pglAttachShader = NULL;
static PFNGLLINKPROGRAMPROC pglLinkProgram = NULL;
static PFNGLUSEPROGRAMPROC pglUseProgram = NULL;
static PFNGLGETPROGRAMIVPROC pglGetProgramiv = NULL;
static PFNGLGETPROGRAMINFOLOGPROC pglGetProgramInfoLog = NULL;
static PFNGLDELETEPROGRAMPROC pglDeleteProgram = NULL;
static PFNGLGETUNIFORMLOCATIONPROC pglGetUniformLocation = NULL;
static PFNGLUNIFORMMATRIX4FVPROC pglUniformMatrix4fv = NULL;
static PFNGLGETATTRIBLOCATIONPROC pglGetAttribLocation = NULL;
static PFNGLBINDVERTEXARRAYPROC pglBindVertexArray = NULL;
static PFNGLBUFFERDATAPROC pglBufferData = NULL;
static PFNGLBINDBUFFERPROC pglBindBuffer = NULL;
static PFNGLBUFFERSUBDATAPROC pglBufferSubData = NULL;
static PFNGLENABLEVERTEXATTRIBARRAYPROC pglEnableVertexAttribArray = NULL;
static PFNGLVERTEXATTRIBPOINTERPROC pglVertexAttribPointer = NULL;
/* Map height updates */
#define MAX_CIRCLE_SIZE (5.0f)
#define MAX_DISPLACEMENT (1.0f)
#define DISPLACEMENT_SIGN_LIMIT (0.3f)
#define MAX_ITER (200)
#define NUM_ITER_AT_A_TIME (1)
/* Map general information */
#define MAP_SIZE (10.0f)
#define MAP_NUM_VERTICES (80)
#define MAP_NUM_TOTAL_VERTICES (MAP_NUM_VERTICES*MAP_NUM_VERTICES)
#define MAP_NUM_LINES (3* (MAP_NUM_VERTICES - 1) * (MAP_NUM_VERTICES - 1) + \
2 * (MAP_NUM_VERTICES - 1))
/* OpenGL function pointers */
#define RESOLVE_GL_FCN(type, var, name) \
if (status == GL_TRUE) \
{\
var = (type) glfwGetProcAddress((name));\
if ((var) == NULL)\
{\
status = GL_FALSE;\
}\
}
static GLboolean init_opengl(void)
{
GLboolean status = GL_TRUE;
RESOLVE_GL_FCN(PFNGLCREATESHADERPROC, pglCreateShader, "glCreateShader");
RESOLVE_GL_FCN(PFNGLSHADERSOURCEPROC, pglShaderSource, "glShaderSource");
RESOLVE_GL_FCN(PFNGLCOMPILESHADERPROC, pglCompileShader, "glCompileShader");
RESOLVE_GL_FCN(PFNGLGETSHADERIVPROC, pglGetShaderiv, "glGetShaderiv");
RESOLVE_GL_FCN(PFNGLGETSHADERINFOLOGPROC, pglGetShaderInfoLog, "glGetShaderInfoLog");
RESOLVE_GL_FCN(PFNGLDELETESHADERPROC, pglDeleteShader, "glDeleteShader");
RESOLVE_GL_FCN(PFNGLCREATEPROGRAMPROC, pglCreateProgram, "glCreateProgram");
RESOLVE_GL_FCN(PFNGLATTACHSHADERPROC, pglAttachShader, "glAttachShader");
RESOLVE_GL_FCN(PFNGLLINKPROGRAMPROC, pglLinkProgram, "glLinkProgram");
RESOLVE_GL_FCN(PFNGLUSEPROGRAMPROC, pglUseProgram, "glUseProgram");
RESOLVE_GL_FCN(PFNGLGETPROGRAMIVPROC, pglGetProgramiv, "glGetProgramiv");
RESOLVE_GL_FCN(PFNGLGETPROGRAMINFOLOGPROC, pglGetProgramInfoLog, "glGetProgramInfoLog");
RESOLVE_GL_FCN(PFNGLDELETEPROGRAMPROC, pglDeleteProgram, "glDeleteProgram");
RESOLVE_GL_FCN(PFNGLGETUNIFORMLOCATIONPROC, pglGetUniformLocation, "glGetUniformLocation");
RESOLVE_GL_FCN(PFNGLUNIFORMMATRIX4FVPROC, pglUniformMatrix4fv, "glUniformMatrix4fv");
RESOLVE_GL_FCN(PFNGLGETATTRIBLOCATIONPROC, pglGetAttribLocation, "glGetAttribLocation");
RESOLVE_GL_FCN(PFNGLGENVERTEXARRAYSPROC, pglGenVertexArrays, "glGenVertexArrays");
RESOLVE_GL_FCN(PFNGLDELETEVERTEXARRAYSPROC, pglDeleteVertexArrays, "glDeleteVertexArrays");
RESOLVE_GL_FCN(PFNGLBINDVERTEXARRAYPROC, pglBindVertexArray, "glBindVertexArray");
RESOLVE_GL_FCN(PFNGLGENBUFFERSPROC, pglGenBuffers, "glGenBuffers");
RESOLVE_GL_FCN(PFNGLBINDBUFFERPROC, pglBindBuffer, "glBindBuffer");
RESOLVE_GL_FCN(PFNGLBUFFERDATAPROC, pglBufferData, "glBufferData");
RESOLVE_GL_FCN(PFNGLBUFFERSUBDATAPROC, pglBufferSubData, "glBufferSubData");
RESOLVE_GL_FCN(PFNGLENABLEVERTEXATTRIBARRAYPROC, pglEnableVertexAttribArray, "glEnableVertexAttribArray");
RESOLVE_GL_FCN(PFNGLVERTEXATTRIBPOINTERPROC, pglVertexAttribPointer, "glVertexAttribPointer");
return status;
}
/**********************************************************************
* Default shader programs
*********************************************************************/
static const char* default_vertex_shader =
"#version 150\n"
"uniform mat4 project;\n"
"uniform mat4 modelview;\n"
"in float x;\n"
"in float y;\n"
"in float z;\n"
"\n"
"void main()\n"
"{\n"
" gl_Position = project * modelview * vec4(x, y, z, 1.0);\n"
"}\n";
static const char* default_fragment_shader =
"#version 150\n"
"out vec4 gl_FragColor;\n"
"void main()\n"
"{\n"
" gl_FragColor = vec4(0.2, 1.0, 0.2, 1.0); \n"
"}\n";
/**********************************************************************
* Values for shader uniforms
*********************************************************************/
/* Frustum configuration */
static GLfloat view_angle = 45.0f;
static GLfloat aspect_ratio = 4.0f/3.0f;
static GLfloat z_near = 1.0f;
static GLfloat z_far = 100.f;
/* Projection matrix */
static GLfloat projection_matrix[16] = {
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
};
/* Model view matrix */
static GLfloat modelview_matrix[16] = {
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
};
/**********************************************************************
* Heightmap vertex and index data
*********************************************************************/
static GLfloat map_vertices[3][MAP_NUM_TOTAL_VERTICES];
static GLuint map_line_indices[2*MAP_NUM_LINES];
/* Store uniform location for the shaders
* Those values are setup as part of the process of creating
* the shader program. They should not be used before creating
* the program.
*/
static GLuint mesh;
static GLuint mesh_vbo[4];
/**********************************************************************
* OpenGL helper functions
*********************************************************************/
/* Load a (text) file into memory and return its contents
*/
static char* read_file_content(const char* filename)
{
FILE* fd;
size_t size = 0;
char* result = NULL;
fd = fopen(filename, "r");
if (fd != NULL)
{
size = fseek(fd, 0, SEEK_END);
(void) fseek(fd, 0, SEEK_SET);
result = malloc(size + 1);
result[size] = '\0';
if (fread(result, size, 1, fd) != 1)
{
free(result);
result = NULL;
}
(void) fclose(fd);
}
return result;
}
/* Creates a shader object of the specified type using the specified text
*/
static GLuint make_shader(GLenum type, const char* shader_src)
{
GLuint shader;
GLint shader_ok;
GLsizei log_length;
char info_log[8192];
shader = pglCreateShader(type);
if (shader != 0)
{
pglShaderSource(shader, 1, (const GLchar**)&shader_src, NULL);
pglCompileShader(shader);
pglGetShaderiv(shader, GL_COMPILE_STATUS, &shader_ok);
if (shader_ok != GL_TRUE)
{
fprintf(stderr, "ERROR: Failed to compile %s shader\n", (type == GL_FRAGMENT_SHADER) ? "fragment" : "vertex" );
pglGetShaderInfoLog(shader, 8192, &log_length,info_log);
fprintf(stderr, "ERROR: \n%s\n\n", info_log);
pglDeleteShader(shader);
shader = 0;
}
}
return shader;
}
/* Creates a program object using the specified vertex and fragment text
*/
static GLuint make_shader_program(const char* vertex_shader_src, const char* fragment_shader_src)
{
GLuint program = 0u;
GLint program_ok;
GLuint vertex_shader = 0u;
GLuint fragment_shader = 0u;
GLsizei log_length;
char info_log[8192];
vertex_shader = make_shader(GL_VERTEX_SHADER, (vertex_shader_src == NULL) ? default_vertex_shader : vertex_shader_src);
if (vertex_shader != 0u)
{
fragment_shader = make_shader(GL_FRAGMENT_SHADER, (fragment_shader_src == NULL) ? default_fragment_shader : fragment_shader_src);
if (fragment_shader != 0u)
{
/* make the program that connect the two shader and link it */
program = pglCreateProgram();
if (program != 0u)
{
/* attach both shader and link */
pglAttachShader(program, vertex_shader);
pglAttachShader(program, fragment_shader);
pglLinkProgram(program);
pglGetProgramiv(program, GL_LINK_STATUS, &program_ok);
if (program_ok != GL_TRUE)
{
fprintf(stderr, "ERROR, failed to link shader program\n");
pglGetProgramInfoLog(program, 8192, &log_length, info_log);
fprintf(stderr, "ERROR: \n%s\n\n", info_log);
pglDeleteProgram(program);
pglDeleteShader(fragment_shader);
pglDeleteShader(vertex_shader);
program = 0u;
}
}
}
else
{
fprintf(stderr, "ERROR: Unable to load fragment shader\n");
pglDeleteShader(vertex_shader);
}
}
else
{
fprintf(stderr, "ERROR: Unable to load vertex shader\n");
}
return program;
}
/**********************************************************************
* Geometry creation functions
*********************************************************************/
/* Generate vertices and indices for the heightmap
*/
static void init_map(void)
{
int i;
int j;
int k;
GLfloat step = MAP_SIZE / (MAP_NUM_VERTICES - 1);
GLfloat x = 0.0f;
GLfloat z = 0.0f;
/* Create a flat grid */
k = 0;
for (i = 0 ; i < MAP_NUM_VERTICES ; ++i)
{
for (j = 0 ; j < MAP_NUM_VERTICES ; ++j)
{
map_vertices[0][k] = x;
map_vertices[1][k] = 0.0f;
map_vertices[2][k] = z;
z += step;
++k;
}
x += step;
z = 0.0f;
}
#if DEBUG_ENABLED
for (i = 0 ; i < MAP_NUM_TOTAL_VERTICES ; ++i)
{
printf ("Vertice %d (%f, %f, %f)\n",
i, map_vertices[0][i], map_vertices[1][i], map_vertices[2][i]);
}
#endif
/* create indices */
/* line fan based on i
* i+1
* | / i + n + 1
* | /
* |/
* i --- i + n
*/
/* close the top of the square */
k = 0;
for (i = 0 ; i < MAP_NUM_VERTICES -1 ; ++i)
{
map_line_indices[k++] = (i + 1) * MAP_NUM_VERTICES -1;
map_line_indices[k++] = (i + 2) * MAP_NUM_VERTICES -1;
}
/* close the right of the square */
for (i = 0 ; i < MAP_NUM_VERTICES -1 ; ++i)
{
map_line_indices[k++] = (MAP_NUM_VERTICES - 1) * MAP_NUM_VERTICES + i;
map_line_indices[k++] = (MAP_NUM_VERTICES - 1) * MAP_NUM_VERTICES + i + 1;
}
for (i = 0 ; i < (MAP_NUM_VERTICES - 1) ; ++i)
{
for (j = 0 ; j < (MAP_NUM_VERTICES - 1) ; ++j)
{
int ref = i * (MAP_NUM_VERTICES) + j;
map_line_indices[k++] = ref;
map_line_indices[k++] = ref + 1;
map_line_indices[k++] = ref;
map_line_indices[k++] = ref + MAP_NUM_VERTICES;
map_line_indices[k++] = ref;
map_line_indices[k++] = ref + MAP_NUM_VERTICES + 1;
}
}
#ifdef DEBUG_ENABLED
for (k = 0 ; k < 2 * MAP_NUM_LINES ; k += 2)
{
int beg, end;
beg = map_line_indices[k];
end = map_line_indices[k+1];
printf ("Line %d: %d -> %d (%f, %f, %f) -> (%f, %f, %f)\n",
k / 2, beg, end,
map_vertices[0][beg], map_vertices[1][beg], map_vertices[2][beg],
map_vertices[0][end], map_vertices[1][end], map_vertices[2][end]);
}
#endif
}
static void generate_heightmap__circle(float* center_x, float* center_y,
float* size, float* displacement)
{
float sign;
/* random value for element in between [0-1.0] */
*center_x = (MAP_SIZE * rand()) / (1.0f * RAND_MAX);
*center_y = (MAP_SIZE * rand()) / (1.0f * RAND_MAX);
*size = (MAX_CIRCLE_SIZE * rand()) / (1.0f * RAND_MAX);
sign = (1.0f * rand()) / (1.0f * RAND_MAX);
sign = (sign < DISPLACEMENT_SIGN_LIMIT) ? -1.0f : 1.0f;
*displacement = (sign * (MAX_DISPLACEMENT * rand())) / (1.0f * RAND_MAX);
}
/* Run the specified number of iterations of the generation process for the
* heightmap
*/
static void update_map(int num_iter)
{
assert(num_iter > 0);
while(num_iter)
{
/* center of the circle */
float center_x;
float center_z;
float circle_size;
float disp;
size_t ii;
generate_heightmap__circle(&center_x, &center_z, &circle_size, &disp);
disp = disp / 2.0f;
for (ii = 0u ; ii < MAP_NUM_TOTAL_VERTICES ; ++ii)
{
GLfloat dx = center_x - map_vertices[0][ii];
GLfloat dz = center_z - map_vertices[2][ii];
GLfloat pd = (2.0f * sqrtf((dx * dx) + (dz * dz))) / circle_size;
if (fabs(pd) <= 1.0f)
{
/* tx,tz is within the circle */
GLfloat new_height = disp + (float) (cos(pd*3.14f)*disp);
map_vertices[1][ii] += new_height;
}
}
--num_iter;
}
}
/**********************************************************************
* OpenGL helper functions
*********************************************************************/
/* Create VBO, IBO and VAO objects for the heightmap geometry and bind them to
* the specified program object
*/
static void make_mesh(GLuint program)
{
GLuint attrloc;
pglGenVertexArrays(1, &mesh);
pglGenBuffers(4, mesh_vbo);
pglBindVertexArray(mesh);
/* Prepare the data for drawing through a buffer inidices */
pglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh_vbo[3]);
pglBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint)* MAP_NUM_LINES * 2, map_line_indices, GL_STATIC_DRAW);
/* Prepare the attributes for rendering */
attrloc = pglGetAttribLocation(program, "x");
pglBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[0]);
pglBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[0][0], GL_STATIC_DRAW);
pglEnableVertexAttribArray(attrloc);
pglVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
attrloc = pglGetAttribLocation(program, "z");
pglBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[2]);
pglBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[2][0], GL_STATIC_DRAW);
pglEnableVertexAttribArray(attrloc);
pglVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
attrloc = pglGetAttribLocation(program, "y");
pglBindBuffer(GL_ARRAY_BUFFER, mesh_vbo[1]);
pglBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0], GL_DYNAMIC_DRAW);
pglEnableVertexAttribArray(attrloc);
pglVertexAttribPointer(attrloc, 1, GL_FLOAT, GL_FALSE, 0, 0);
}
/* Update VBO vertices from source data
*/
static void update_mesh(void)
{
pglBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(GLfloat) * MAP_NUM_TOTAL_VERTICES, &map_vertices[1][0]);
}
/**********************************************************************
* GLFW callback functions
*********************************************************************/
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
switch(key)
{
case GLFW_KEY_ESCAPE:
/* Exit program on Escape */
glfwSetWindowShouldClose(window, GL_TRUE);
break;
}
}
/* Print usage information */
static void usage(void)
{
printf("Usage: heightmap [-v <vertex_shader_path>] [-f <fragment_shader_path>]\n");
printf(" heightmap [-h]\n");
}
int main(int argc, char** argv)
{
GLFWwindow* window;
int ch, iter;
double dt;
double last_update_time;
int frame;
float f;
GLint uloc_modelview;
GLint uloc_project;
char* vertex_shader_path = NULL;
char* fragment_shader_path = NULL;
char* vertex_shader_src = NULL;
char* fragment_shader_src = NULL;
GLuint shader_program;
while ((ch = getopt(argc, argv, "f:v:h")) != -1)
{
switch (ch)
{
case 'f':
fragment_shader_path = optarg;
break;
case 'v':
vertex_shader_path = optarg;
break;
case 'h':
usage();
exit(EXIT_SUCCESS);
default:
usage();
exit(EXIT_FAILURE);
}
}
if (fragment_shader_path)
{
vertex_shader_src = read_file_content(fragment_shader_path);
if (!fragment_shader_src)
{
fprintf(stderr,
"ERROR: unable to load fragment shader from '%s'\n",
fragment_shader_path);
exit(EXIT_FAILURE);
}
}
if (vertex_shader_path)
{
vertex_shader_src = read_file_content(vertex_shader_path);
if (!vertex_shader_src)
{
fprintf(stderr,
"ERROR: unable to load vertex shader from '%s'\n",
fragment_shader_path);
exit(EXIT_FAILURE);
}
}
if (!glfwInit())
{
fprintf(stderr, "ERROR: Unable to initialize GLFW\n");
usage();
free(vertex_shader_src);
free(fragment_shader_src);
exit(EXIT_FAILURE);
}
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_FALSE);
window = glfwCreateWindow(800, 600, "GLFW OpenGL3 Heightmap demo", NULL, NULL);
if (! window )
{
fprintf(stderr, "ERROR: Unable to create the OpenGL context and associated window\n");
usage();
free(vertex_shader_src);
free(fragment_shader_src);
glfwTerminate();
exit(EXIT_FAILURE);
}
/* Register events callback */
glfwSetKeyCallback(window, key_callback);
glfwMakeContextCurrent(window);
if (GL_TRUE != init_opengl())
{
fprintf(stderr, "ERROR: unable to resolve OpenGL function pointers\n");
free(vertex_shader_src);
free(fragment_shader_src);
glfwTerminate();
exit(EXIT_FAILURE);
}
/* Prepare opengl resources for rendering */
shader_program = make_shader_program(vertex_shader_src , fragment_shader_src);
free(vertex_shader_src);
free(fragment_shader_src);
if (shader_program == 0u)
{
fprintf(stderr, "ERROR: during creation of the shader program\n");
usage();
glfwTerminate();
exit(EXIT_FAILURE);
}
pglUseProgram(shader_program);
uloc_project = pglGetUniformLocation(shader_program, "project");
uloc_modelview = pglGetUniformLocation(shader_program, "modelview");
/* Compute the projection matrix */
f = 1.0f / tanf(view_angle / 2.0f);
projection_matrix[0] = f / aspect_ratio;
projection_matrix[5] = f;
projection_matrix[10] = (z_far + z_near)/ (z_near - z_far);
projection_matrix[11] = -1.0f;
projection_matrix[14] = 2.0f * (z_far * z_near) / (z_near - z_far);
pglUniformMatrix4fv(uloc_project, 1, GL_FALSE, projection_matrix);
/* Set the camera position */
modelview_matrix[12] = -5.0f;
modelview_matrix[13] = -5.0f;
modelview_matrix[14] = -20.0f;
pglUniformMatrix4fv(uloc_modelview, 1, GL_FALSE, modelview_matrix);
/* Create mesh data */
init_map();
make_mesh(shader_program);
/* Create vao + vbo to store the mesh */
/* Create the vbo to store all the information for the grid and the height */
/* setup the scene ready for rendering */
glViewport(0, 0, 800, 600);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
/* main loop */
frame = 0;
iter = 0;
last_update_time = glfwGetTime();
while (!glfwWindowShouldClose(window))
{
++frame;
/* render the next frame */
glClear(GL_COLOR_BUFFER_BIT);
glDrawElements(GL_LINES, 2* MAP_NUM_LINES , GL_UNSIGNED_INT, 0);
/* display and process events through callbacks */
glfwSwapBuffers(window);
glfwPollEvents();
/* Check the frame rate and update the heightmap if needed */
dt = glfwGetTime();
if ((dt - last_update_time) > 0.2)
{
/* generate the next iteration of the heightmap */
if (iter < MAX_ITER)
{
update_map(NUM_ITER_AT_A_TIME);
update_mesh();
iter += NUM_ITER_AT_A_TIME;
}
last_update_time = dt;
frame = 0;
}
}
glfwTerminate();
exit(EXIT_SUCCESS);
}

101
extern/glfw/examples/simple.c vendored Normal file
View File

@ -0,0 +1,101 @@
//========================================================================
// Simple GLFW example
// Copyright (c) Camilla Berglund <elmindreda@elmindreda.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
//! [code]
#include <GLFW/glfw3.h>
#include <stdlib.h>
#include <stdio.h>
static void error_callback(int error, const char* description)
{
fputs(description, stderr);
}
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
int main(void)
{
GLFWwindow* window;
glfwSetErrorCallback(error_callback);
if (!glfwInit())
exit(EXIT_FAILURE);
window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
if (!window)
{
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(window);
glfwSetKeyCallback(window, key_callback);
while (!glfwWindowShouldClose(window))
{
float ratio;
int width, height;
glfwGetFramebufferSize(window, &width, &height);
ratio = width / (float) height;
glViewport(0, 0, width, height);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-ratio, ratio, -1.f, 1.f, 1.f, -1.f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef((float) glfwGetTime() * 50.f, 0.f, 0.f, 1.f);
glBegin(GL_TRIANGLES);
glColor3f(1.f, 0.f, 0.f);
glVertex3f(-0.6f, -0.4f, 0.f);
glColor3f(0.f, 1.f, 0.f);
glVertex3f(0.6f, -0.4f, 0.f);
glColor3f(0.f, 0.f, 1.f);
glVertex3f(0.f, 0.6f, 0.f);
glEnd();
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_SUCCESS);
}
//! [code]

511
extern/glfw/examples/splitview.c vendored Normal file
View File

@ -0,0 +1,511 @@
//========================================================================
// This is an example program for the GLFW library
//
// The program uses a "split window" view, rendering four views of the
// same scene in one window (e.g. uesful for 3D modelling software). This
// demo uses scissors to separete the four different rendering areas from
// each other.
//
// (If the code seems a little bit strange here and there, it may be
// because I am not a friend of orthogonal projections)
//========================================================================
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
//========================================================================
// Global variables
//========================================================================
// Mouse position
static double xpos = 0, ypos = 0;
// Window size
static int width, height;
// Active view: 0 = none, 1 = upper left, 2 = upper right, 3 = lower left,
// 4 = lower right
static int active_view = 0;
// Rotation around each axis
static int rot_x = 0, rot_y = 0, rot_z = 0;
// Do redraw?
static int do_redraw = 1;
//========================================================================
// Draw a solid torus (use a display list for the model)
//========================================================================
#define TORUS_MAJOR 1.5
#define TORUS_MINOR 0.5
#define TORUS_MAJOR_RES 32
#define TORUS_MINOR_RES 32
static void drawTorus(void)
{
static GLuint torus_list = 0;
int i, j, k;
double s, t, x, y, z, nx, ny, nz, scale, twopi;
if (!torus_list)
{
// Start recording displaylist
torus_list = glGenLists(1);
glNewList(torus_list, GL_COMPILE_AND_EXECUTE);
// Draw torus
twopi = 2.0 * M_PI;
for (i = 0; i < TORUS_MINOR_RES; i++)
{
glBegin(GL_QUAD_STRIP);
for (j = 0; j <= TORUS_MAJOR_RES; j++)
{
for (k = 1; k >= 0; k--)
{
s = (i + k) % TORUS_MINOR_RES + 0.5;
t = j % TORUS_MAJOR_RES;
// Calculate point on surface
x = (TORUS_MAJOR + TORUS_MINOR * cos(s * twopi / TORUS_MINOR_RES)) * cos(t * twopi / TORUS_MAJOR_RES);
y = TORUS_MINOR * sin(s * twopi / TORUS_MINOR_RES);
z = (TORUS_MAJOR + TORUS_MINOR * cos(s * twopi / TORUS_MINOR_RES)) * sin(t * twopi / TORUS_MAJOR_RES);
// Calculate surface normal
nx = x - TORUS_MAJOR * cos(t * twopi / TORUS_MAJOR_RES);
ny = y;
nz = z - TORUS_MAJOR * sin(t * twopi / TORUS_MAJOR_RES);
scale = 1.0 / sqrt(nx*nx + ny*ny + nz*nz);
nx *= scale;
ny *= scale;
nz *= scale;
glNormal3f((float) nx, (float) ny, (float) nz);
glVertex3f((float) x, (float) y, (float) z);
}
}
glEnd();
}
// Stop recording displaylist
glEndList();
}
else
{
// Playback displaylist
glCallList(torus_list);
}
}
//========================================================================
// Draw the scene (a rotating torus)
//========================================================================
static void drawScene(void)
{
const GLfloat model_diffuse[4] = {1.0f, 0.8f, 0.8f, 1.0f};
const GLfloat model_specular[4] = {0.6f, 0.6f, 0.6f, 1.0f};
const GLfloat model_shininess = 20.0f;
glPushMatrix();
// Rotate the object
glRotatef((GLfloat) rot_x * 0.5f, 1.0f, 0.0f, 0.0f);
glRotatef((GLfloat) rot_y * 0.5f, 0.0f, 1.0f, 0.0f);
glRotatef((GLfloat) rot_z * 0.5f, 0.0f, 0.0f, 1.0f);
// Set model color (used for orthogonal views, lighting disabled)
glColor4fv(model_diffuse);
// Set model material (used for perspective view, lighting enabled)
glMaterialfv(GL_FRONT, GL_DIFFUSE, model_diffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, model_specular);
glMaterialf(GL_FRONT, GL_SHININESS, model_shininess);
// Draw torus
drawTorus();
glPopMatrix();
}
//========================================================================
// Draw a 2D grid (used for orthogonal views)
//========================================================================
static void drawGrid(float scale, int steps)
{
int i;
float x, y;
glPushMatrix();
// Set background to some dark bluish grey
glClearColor(0.05f, 0.05f, 0.2f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
// Setup modelview matrix (flat XY view)
glLoadIdentity();
gluLookAt(0.0, 0.0, 1.0,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
// We don't want to update the Z-buffer
glDepthMask(GL_FALSE);
// Set grid color
glColor3f(0.0f, 0.5f, 0.5f);
glBegin(GL_LINES);
// Horizontal lines
x = scale * 0.5f * (float) (steps - 1);
y = -scale * 0.5f * (float) (steps - 1);
for (i = 0; i < steps; i++)
{
glVertex3f(-x, y, 0.0f);
glVertex3f(x, y, 0.0f);
y += scale;
}
// Vertical lines
x = -scale * 0.5f * (float) (steps - 1);
y = scale * 0.5f * (float) (steps - 1);
for (i = 0; i < steps; i++)
{
glVertex3f(x, -y, 0.0f);
glVertex3f(x, y, 0.0f);
x += scale;
}
glEnd();
// Enable Z-buffer writing again
glDepthMask(GL_TRUE);
glPopMatrix();
}
//========================================================================
// Draw all views
//========================================================================
static void drawAllViews(void)
{
const GLfloat light_position[4] = {0.0f, 8.0f, 8.0f, 1.0f};
const GLfloat light_diffuse[4] = {1.0f, 1.0f, 1.0f, 1.0f};
const GLfloat light_specular[4] = {1.0f, 1.0f, 1.0f, 1.0f};
const GLfloat light_ambient[4] = {0.2f, 0.2f, 0.3f, 1.0f};
double aspect;
// Calculate aspect of window
if (height > 0)
aspect = (double) width / (double) height;
else
aspect = 1.0;
// Clear screen
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Enable scissor test
glEnable(GL_SCISSOR_TEST);
// Enable depth test
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
// ** ORTHOGONAL VIEWS **
// For orthogonal views, use wireframe rendering
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
// Enable line anti-aliasing
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Setup orthogonal projection matrix
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-3.0 * aspect, 3.0 * aspect, -3.0, 3.0, 1.0, 50.0);
// Upper left view (TOP VIEW)
glViewport(0, height / 2, width / 2, height / 2);
glScissor(0, height / 2, width / 2, height / 2);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0.0f, 10.0f, 1e-3f, // Eye-position (above)
0.0f, 0.0f, 0.0f, // View-point
0.0f, 1.0f, 0.0f); // Up-vector
drawGrid(0.5, 12);
drawScene();
// Lower left view (FRONT VIEW)
glViewport(0, 0, width / 2, height / 2);
glScissor(0, 0, width / 2, height / 2);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0.0f, 0.0f, 10.0f, // Eye-position (in front of)
0.0f, 0.0f, 0.0f, // View-point
0.0f, 1.0f, 0.0f); // Up-vector
drawGrid(0.5, 12);
drawScene();
// Lower right view (SIDE VIEW)
glViewport(width / 2, 0, width / 2, height / 2);
glScissor(width / 2, 0, width / 2, height / 2);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(10.0f, 0.0f, 0.0f, // Eye-position (to the right)
0.0f, 0.0f, 0.0f, // View-point
0.0f, 1.0f, 0.0f); // Up-vector
drawGrid(0.5, 12);
drawScene();
// Disable line anti-aliasing
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
// ** PERSPECTIVE VIEW **
// For perspective view, use solid rendering
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// Enable face culling (faster rendering)
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CW);
// Setup perspective projection matrix
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(65.0f, aspect, 1.0f, 50.0f);
// Upper right view (PERSPECTIVE VIEW)
glViewport(width / 2, height / 2, width / 2, height / 2);
glScissor(width / 2, height / 2, width / 2, height / 2);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(3.0f, 1.5f, 3.0f, // Eye-position
0.0f, 0.0f, 0.0f, // View-point
0.0f, 1.0f, 0.0f); // Up-vector
// Configure and enable light source 1
glLightfv(GL_LIGHT1, GL_POSITION, light_position);
glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient);
glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT1, GL_SPECULAR, light_specular);
glEnable(GL_LIGHT1);
glEnable(GL_LIGHTING);
// Draw scene
drawScene();
// Disable lighting
glDisable(GL_LIGHTING);
// Disable face culling
glDisable(GL_CULL_FACE);
// Disable depth test
glDisable(GL_DEPTH_TEST);
// Disable scissor test
glDisable(GL_SCISSOR_TEST);
// Draw a border around the active view
if (active_view > 0 && active_view != 2)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 2.0, 0.0, 2.0, 0.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef((GLfloat) ((active_view - 1) & 1), (GLfloat) (1 - (active_view - 1) / 2), 0.0f);
glColor3f(1.0f, 1.0f, 0.6f);
glBegin(GL_LINE_STRIP);
glVertex2i(0, 0);
glVertex2i(1, 0);
glVertex2i(1, 1);
glVertex2i(0, 1);
glVertex2i(0, 0);
glEnd();
}
}
//========================================================================
// Framebuffer size callback function
//========================================================================
static void framebufferSizeFun(GLFWwindow* window, int w, int h)
{
width = w;
height = h > 0 ? h : 1;
do_redraw = 1;
}
//========================================================================
// Window refresh callback function
//========================================================================
static void windowRefreshFun(GLFWwindow* window)
{
do_redraw = 1;
}
//========================================================================
// Mouse position callback function
//========================================================================
static void cursorPosFun(GLFWwindow* window, double x, double y)
{
// Depending on which view was selected, rotate around different axes
switch (active_view)
{
case 1:
rot_x += (int) (y - ypos);
rot_z += (int) (x - xpos);
do_redraw = 1;
break;
case 3:
rot_x += (int) (y - ypos);
rot_y += (int) (x - xpos);
do_redraw = 1;
break;
case 4:
rot_y += (int) (x - xpos);
rot_z += (int) (y - ypos);
do_redraw = 1;
break;
default:
// Do nothing for perspective view, or if no view is selected
break;
}
// Remember cursor position
xpos = x;
ypos = y;
}
//========================================================================
// Mouse button callback function
//========================================================================
static void mouseButtonFun(GLFWwindow* window, int button, int action, int mods)
{
if ((button == GLFW_MOUSE_BUTTON_LEFT) && action == GLFW_PRESS)
{
// Detect which of the four views was clicked
active_view = 1;
if (xpos >= width / 2)
active_view += 1;
if (ypos >= height / 2)
active_view += 2;
}
else if (button == GLFW_MOUSE_BUTTON_LEFT)
{
// Deselect any previously selected view
active_view = 0;
}
do_redraw = 1;
}
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
//========================================================================
// main
//========================================================================
int main(void)
{
GLFWwindow* window;
// Initialise GLFW
if (!glfwInit())
{
fprintf(stderr, "Failed to initialize GLFW\n");
exit(EXIT_FAILURE);
}
// Open OpenGL window
window = glfwCreateWindow(500, 500, "Split view demo", NULL, NULL);
if (!window)
{
fprintf(stderr, "Failed to open GLFW window\n");
glfwTerminate();
exit(EXIT_FAILURE);
}
// Set callback functions
glfwSetFramebufferSizeCallback(window, framebufferSizeFun);
glfwSetWindowRefreshCallback(window, windowRefreshFun);
glfwSetCursorPosCallback(window, cursorPosFun);
glfwSetMouseButtonCallback(window, mouseButtonFun);
glfwSetKeyCallback(window, key_callback);
// Enable vsync
glfwMakeContextCurrent(window);
glfwSwapInterval(1);
glfwGetFramebufferSize(window, &width, &height);
framebufferSizeFun(window, width, height);
// Main loop
for (;;)
{
// Only redraw if we need to
if (do_redraw)
{
// Draw all views
drawAllViews();
// Swap buffers
glfwSwapBuffers(window);
do_redraw = 0;
}
// Wait for new events
glfwWaitEvents();
// Check if the window should be closed
if (glfwWindowShouldClose(window))
break;
}
// Close OpenGL window and terminate GLFW
glfwTerminate();
exit(EXIT_SUCCESS);
}

457
extern/glfw/examples/wave.c vendored Normal file
View File

@ -0,0 +1,457 @@
/*****************************************************************************
* Wave Simulation in OpenGL
* (C) 2002 Jakob Thomsen
* http://home.in.tum.de/~thomsen
* Modified for GLFW by Sylvain Hellegouarch - sh@programmationworld.com
* Modified for variable frame rate by Marcus Geelnard
* 2003-Jan-31: Minor cleanups and speedups / MG
* 2010-10-24: Formatting and cleanup - Camilla Berglund
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
// Maximum delta T to allow for differential calculations
#define MAX_DELTA_T 0.01
// Animation speed (10.0 looks good)
#define ANIMATION_SPEED 10.0
GLfloat alpha = 210.f, beta = -70.f;
GLfloat zoom = 2.f;
GLboolean locked = GL_FALSE;
int cursorX;
int cursorY;
struct Vertex
{
GLfloat x, y, z;
GLfloat r, g, b;
};
#define GRIDW 50
#define GRIDH 50
#define VERTEXNUM (GRIDW*GRIDH)
#define QUADW (GRIDW - 1)
#define QUADH (GRIDH - 1)
#define QUADNUM (QUADW*QUADH)
GLuint quad[4 * QUADNUM];
struct Vertex vertex[VERTEXNUM];
/* The grid will look like this:
*
* 3 4 5
* *---*---*
* | | |
* | 0 | 1 |
* | | |
* *---*---*
* 0 1 2
*/
//========================================================================
// Initialize grid geometry
//========================================================================
void init_vertices(void)
{
int x, y, p;
// Place the vertices in a grid
for (y = 0; y < GRIDH; y++)
{
for (x = 0; x < GRIDW; x++)
{
p = y * GRIDW + x;
vertex[p].x = (GLfloat) (x - GRIDW / 2) / (GLfloat) (GRIDW / 2);
vertex[p].y = (GLfloat) (y - GRIDH / 2) / (GLfloat) (GRIDH / 2);
vertex[p].z = 0;
if ((x % 4 < 2) ^ (y % 4 < 2))
vertex[p].r = 0.0;
else
vertex[p].r = 1.0;
vertex[p].g = (GLfloat) y / (GLfloat) GRIDH;
vertex[p].b = 1.f - ((GLfloat) x / (GLfloat) GRIDW + (GLfloat) y / (GLfloat) GRIDH) / 2.f;
}
}
for (y = 0; y < QUADH; y++)
{
for (x = 0; x < QUADW; x++)
{
p = 4 * (y * QUADW + x);
quad[p + 0] = y * GRIDW + x; // Some point
quad[p + 1] = y * GRIDW + x + 1; // Neighbor at the right side
quad[p + 2] = (y + 1) * GRIDW + x + 1; // Upper right neighbor
quad[p + 3] = (y + 1) * GRIDW + x; // Upper neighbor
}
}
}
double dt;
double p[GRIDW][GRIDH];
double vx[GRIDW][GRIDH], vy[GRIDW][GRIDH];
double ax[GRIDW][GRIDH], ay[GRIDW][GRIDH];
//========================================================================
// Initialize grid
//========================================================================
void init_grid(void)
{
int x, y;
double dx, dy, d;
for (y = 0; y < GRIDH; y++)
{
for (x = 0; x < GRIDW; x++)
{
dx = (double) (x - GRIDW / 2);
dy = (double) (y - GRIDH / 2);
d = sqrt(dx * dx + dy * dy);
if (d < 0.1 * (double) (GRIDW / 2))
{
d = d * 10.0;
p[x][y] = -cos(d * (M_PI / (double)(GRIDW * 4))) * 100.0;
}
else
p[x][y] = 0.0;
vx[x][y] = 0.0;
vy[x][y] = 0.0;
}
}
}
//========================================================================
// Draw scene
//========================================================================
void draw_scene(GLFWwindow* window)
{
// Clear the color and depth buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// We don't want to modify the projection matrix
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// Move back
glTranslatef(0.0, 0.0, -zoom);
// Rotate the view
glRotatef(beta, 1.0, 0.0, 0.0);
glRotatef(alpha, 0.0, 0.0, 1.0);
glDrawElements(GL_QUADS, 4 * QUADNUM, GL_UNSIGNED_INT, quad);
glfwSwapBuffers(window);
}
//========================================================================
// Initialize Miscellaneous OpenGL state
//========================================================================
void init_opengl(void)
{
// Use Gouraud (smooth) shading
glShadeModel(GL_SMOOTH);
// Switch on the z-buffer
glEnable(GL_DEPTH_TEST);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeof(struct Vertex), vertex);
glColorPointer(3, GL_FLOAT, sizeof(struct Vertex), &vertex[0].r); // Pointer to the first color
glPointSize(2.0);
// Background color is black
glClearColor(0, 0, 0, 0);
}
//========================================================================
// Modify the height of each vertex according to the pressure
//========================================================================
void adjust_grid(void)
{
int pos;
int x, y;
for (y = 0; y < GRIDH; y++)
{
for (x = 0; x < GRIDW; x++)
{
pos = y * GRIDW + x;
vertex[pos].z = (float) (p[x][y] * (1.0 / 50.0));
}
}
}
//========================================================================
// Calculate wave propagation
//========================================================================
void calc_grid(void)
{
int x, y, x2, y2;
double time_step = dt * ANIMATION_SPEED;
// Compute accelerations
for (x = 0; x < GRIDW; x++)
{
x2 = (x + 1) % GRIDW;
for(y = 0; y < GRIDH; y++)
ax[x][y] = p[x][y] - p[x2][y];
}
for (y = 0; y < GRIDH; y++)
{
y2 = (y + 1) % GRIDH;
for(x = 0; x < GRIDW; x++)
ay[x][y] = p[x][y] - p[x][y2];
}
// Compute speeds
for (x = 0; x < GRIDW; x++)
{
for (y = 0; y < GRIDH; y++)
{
vx[x][y] = vx[x][y] + ax[x][y] * time_step;
vy[x][y] = vy[x][y] + ay[x][y] * time_step;
}
}
// Compute pressure
for (x = 1; x < GRIDW; x++)
{
x2 = x - 1;
for (y = 1; y < GRIDH; y++)
{
y2 = y - 1;
p[x][y] = p[x][y] + (vx[x2][y] - vx[x][y] + vy[x][y2] - vy[x][y]) * time_step;
}
}
}
//========================================================================
// Print errors
//========================================================================
static void error_callback(int error, const char* description)
{
fprintf(stderr, "Error: %s\n", description);
}
//========================================================================
// Handle key strokes
//========================================================================
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (action != GLFW_PRESS)
return;
switch (key)
{
case GLFW_KEY_ESCAPE:
glfwSetWindowShouldClose(window, GL_TRUE);
break;
case GLFW_KEY_SPACE:
init_grid();
break;
case GLFW_KEY_LEFT:
alpha += 5;
break;
case GLFW_KEY_RIGHT:
alpha -= 5;
break;
case GLFW_KEY_UP:
beta -= 5;
break;
case GLFW_KEY_DOWN:
beta += 5;
break;
case GLFW_KEY_PAGE_UP:
zoom -= 0.25f;
if (zoom < 0.f)
zoom = 0.f;
break;
case GLFW_KEY_PAGE_DOWN:
zoom += 0.25f;
break;
default:
break;
}
}
//========================================================================
// Callback function for mouse button events
//========================================================================
void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
{
if (button != GLFW_MOUSE_BUTTON_LEFT)
return;
if (action == GLFW_PRESS)
{
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
locked = GL_TRUE;
}
else
{
locked = GL_FALSE;
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
}
}
//========================================================================
// Callback function for cursor motion events
//========================================================================
void cursor_position_callback(GLFWwindow* window, double x, double y)
{
if (locked)
{
alpha += (GLfloat) (x - cursorX) / 10.f;
beta += (GLfloat) (y - cursorY) / 10.f;
}
cursorX = (int) x;
cursorY = (int) y;
}
//========================================================================
// Callback function for scroll events
//========================================================================
void scroll_callback(GLFWwindow* window, double x, double y)
{
zoom += (float) y / 4.f;
if (zoom < 0)
zoom = 0;
}
//========================================================================
// Callback function for framebuffer resize events
//========================================================================
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
{
float ratio = 1.f;
if (height > 0)
ratio = (float) width / (float) height;
// Setup viewport
glViewport(0, 0, width, height);
// Change to the projection matrix and set our viewing volume
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0, ratio, 1.0, 1024.0);
}
//========================================================================
// main
//========================================================================
int main(int argc, char* argv[])
{
GLFWwindow* window;
double t, dt_total, t_old;
int width, height;
glfwSetErrorCallback(error_callback);
if (!glfwInit())
exit(EXIT_FAILURE);
window = glfwCreateWindow(640, 480, "Wave Simulation", NULL, NULL);
if (!window)
{
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwSetKeyCallback(window, key_callback);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
glfwSetMouseButtonCallback(window, mouse_button_callback);
glfwSetCursorPosCallback(window, cursor_position_callback);
glfwSetScrollCallback(window, scroll_callback);
glfwMakeContextCurrent(window);
glfwSwapInterval(1);
glfwGetFramebufferSize(window, &width, &height);
framebuffer_size_callback(window, width, height);
// Initialize OpenGL
init_opengl();
// Initialize simulation
init_vertices();
init_grid();
adjust_grid();
// Initialize timer
t_old = glfwGetTime() - 0.01;
while (!glfwWindowShouldClose(window))
{
t = glfwGetTime();
dt_total = t - t_old;
t_old = t;
// Safety - iterate if dt_total is too large
while (dt_total > 0.f)
{
// Select iteration time step
dt = dt_total > MAX_DELTA_T ? MAX_DELTA_T : dt_total;
dt_total -= dt;
// Calculate wave propagation
calc_grid();
}
// Compute height of each vertex
adjust_grid();
// Draw wave grid to OpenGL display
draw_scene(window);
glfwPollEvents();
}
exit(EXIT_SUCCESS);
}

View File

@ -133,10 +133,38 @@ extern "C" {
/* Most GL/glu.h variants on Windows need wchar_t
* OpenGL/gl.h blocks the definition of ptrdiff_t by glext.h on OS X */
#include <stddef.h>
#if !defined(GLFW_INCLUDE_NONE)
#include <stddef.h>
#endif
/* ---------------- GLFW related system specific defines ----------------- */
/* Include the chosen client API headers.
*/
#if defined(__APPLE_CC__)
#if defined(GLFW_INCLUDE_GLCOREARB)
#include <OpenGL/gl3.h>
#elif !defined(GLFW_INCLUDE_NONE)
#define GL_GLEXT_LEGACY
#include <OpenGL/gl.h>
#endif
#if defined(GLFW_INCLUDE_GLU)
#include <OpenGL/glu.h>
#endif
#else
#if defined(GLFW_INCLUDE_GLCOREARB)
#include <GL/glcorearb.h>
#elif defined(GLFW_INCLUDE_ES1)
#include <GLES/gl.h>
#elif defined(GLFW_INCLUDE_ES2)
#include <GLES2/gl2.h>
#elif defined(GLFW_INCLUDE_ES3)
#include <GLES3/gl3.h>
#elif !defined(GLFW_INCLUDE_NONE)
#include <GL/gl.h>
#endif
#if defined(GLFW_INCLUDE_GLU)
#include <GL/glu.h>
#endif
#endif
#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
/* GLFW_DLL is defined by users of GLFW when compiling programs that will link
@ -173,35 +201,6 @@ extern "C" {
/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
/* Include the chosen client API headers.
*/
#if defined(__APPLE_CC__)
#if defined(GLFW_INCLUDE_GLCOREARB)
#include <OpenGL/gl3.h>
#elif !defined(GLFW_INCLUDE_NONE)
#define GL_GLEXT_LEGACY
#include <OpenGL/gl.h>
#endif
#if defined(GLFW_INCLUDE_GLU)
#include <OpenGL/glu.h>
#endif
#else
#if defined(GLFW_INCLUDE_GLCOREARB)
#include <GL/glcorearb.h>
#elif defined(GLFW_INCLUDE_ES1)
#include <GLES/gl.h>
#elif defined(GLFW_INCLUDE_ES2)
#include <GLES2/gl2.h>
#elif defined(GLFW_INCLUDE_ES3)
#include <GLES3/gl3.h>
#elif !defined(GLFW_INCLUDE_NONE)
#include <GL/gl.h>
#endif
#if defined(GLFW_INCLUDE_GLU)
#include <GL/glu.h>
#endif
#endif
/*************************************************************************
* GLFW API tokens
@ -228,7 +227,7 @@ extern "C" {
* API changes.
* @ingroup init
*/
#define GLFW_VERSION_REVISION 2
#define GLFW_VERSION_REVISION 4
/*! @} */
/*! @name Key and button actions
@ -707,8 +706,8 @@ typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
* This is the function signature for cursor position callback functions.
*
* @param[in] window The window that received the event.
* @param[in] xpos The new x-coordinate of the cursor.
* @param[in] ypos The new y-coordinate of the cursor.
* @param[in] xpos The new x-coordinate, in screen coordinates, of the cursor.
* @param[in] ypos The new y-coordinate, in screen coordinates, of the cursor.
*
* @sa glfwSetCursorPosCallback
*
@ -766,7 +765,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
* This is the function signature for Unicode character callback functions.
*
* @param[in] window The window that received the event.
* @param[in] character The Unicode code point of the character.
* @param[in] codepoint The Unicode code point of the character.
*
* @sa glfwSetCharCallback
*
@ -793,7 +792,7 @@ typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
*
* @ingroup monitor
*/
typedef struct
typedef struct GLFWvidmode
{
/*! The width, in screen coordinates, of the video mode.
*/
@ -823,7 +822,7 @@ typedef struct
*
* @ingroup monitor
*/
typedef struct
typedef struct GLFWgammaramp
{
/*! An array of value describing the response of the red channel.
*/
@ -864,10 +863,7 @@ typedef struct
*
* @note This function may only be called from the main thread.
*
* @note This function may take several seconds to complete on some systems,
* while on other systems it may take only a fraction of a second to complete.
*
* @note **Mac OS X:** This function will change the current directory of the
* @note **OS X:** This function will change the current directory of the
* application to the `Contents/Resources` subdirectory of the application's
* bundle, if present.
*
@ -1233,17 +1229,26 @@ GLFWAPI void glfwWindowHint(int target, int hint);
* to not share resources.
* @return The handle of the created window, or `NULL` if an error occurred.
*
* @remarks **Windows:** Window creation will fail if the Microsoft GDI
* software OpenGL implementation is the only one available.
*
* @remarks **Windows:** If the executable has an icon resource named
* `GLFW_ICON,` it will be set as the icon for the window. If no such icon is
* present, the `IDI_WINLOGO` icon will be used instead.
*
* @remarks **Mac OS X:** The GLFW window has no icon, as it is not a document
* @remarks **OS X:** The GLFW window has no icon, as it is not a document
* window, but the dock icon will be the same as the application bundle's icon.
* Also, the first time a window is opened the menu bar is populated with
* common commands like Hide, Quit and About. The (minimal) about dialog uses
* information from the application's bundle. For more information on bundles,
* see the Bundle Programming Guide provided by Apple.
*
* @remarks **X11:** There is no mechanism for setting the window icon yet.
*
* @remarks The swap interval is not set during window creation, but is left at
* the default value for that platform. For more information, see @ref
* glfwSwapInterval.
*
* @note This function may only be called from the main thread.
*
* @sa glfwDestroyWindow
@ -1355,10 +1360,6 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
*
* @note The window manager may put limits on what positions are allowed.
*
* @bug **X11:** Some window managers ignore the set position of hidden (i.e.
* unmapped) windows, instead placing them where it thinks is appropriate once
* they are shown.
*
* @sa glfwGetWindowPos
*
* @ingroup window
@ -1368,7 +1369,8 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
/*! @brief Retrieves the size of the client area of the specified window.
*
* This function retrieves the size, in screen coordinates, of the client area
* of the specified window.
* of the specified window. If you wish to retrieve the size of the
* framebuffer in pixels, see @ref glfwGetFramebufferSize.
*
* @param[in] window The window whose size to retrieve.
* @param[out] width Where to store the width, in screen coordinates, of the
@ -1409,7 +1411,8 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
/*! @brief Retrieves the size of the framebuffer of the specified window.
*
* This function retrieves the size, in pixels, of the framebuffer of the
* specified window.
* specified window. If you wish to retrieve the size of the window in screen
* coordinates, see @ref glfwGetWindowSize.
*
* @param[in] window The window whose framebuffer to query.
* @param[out] width Where to store the width, in pixels, of the framebuffer,
@ -1592,7 +1595,10 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwind
* @return The previously set callback, or `NULL` if no callback was set or an
* error occurred.
*
* @remarks **Mac OS X:** Selecting Quit from the application menu will
* @par New in GLFW 3
* The close callback no longer returns a value.
*
* @remarks **OS X:** Selecting Quit from the application menu will
* trigger the close callback for all windows.
*
* @ingroup window
@ -1685,6 +1691,12 @@ GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window
* This function is no longer called by @ref glfwSwapBuffers. You need to call
* it or @ref glfwWaitEvents yourself.
*
* @remarks On some platforms, a window move, resize or menu operation will
* cause event processing to block. This is due to how event processing is
* designed on those platforms. You can use the
* [window refresh callback](@ref GLFWwindowrefreshfun) to redraw the contents
* of your window when necessary during the operation.
*
* @note This function may only be called from the main thread.
*
* @note This function may not be called from a callback.
@ -1712,6 +1724,12 @@ GLFWAPI void glfwPollEvents(void);
*
* This function is not required for joystick input to work.
*
* @remarks On some platforms, a window move, resize or menu operation will
* cause event processing to block. This is due to how event processing is
* designed on those platforms. You can use the
* [window refresh callback](@ref GLFWwindowrefreshfun) to redraw the contents
* of your window when necessary during the operation.
*
* @note This function may only be called from the main thread.
*
* @note This function may not be called from a callback.
@ -1747,9 +1765,12 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
* modes:
* - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
* - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
* area of the window.
* - `GLFW_CURSOR_DISABLED` disables the cursor and removes any limitations on
* cursor movement.
* area of the window but does not restrict the cursor from leaving. This is
* useful if you wish to render your own cursor or have no visible cursor at
* all.
* - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
* and unlimited cursor movement. This is useful for implementing for
* example 3D camera controls.
*
* If `mode` is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to
* enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are
@ -1819,7 +1840,8 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
/*! @brief Retrieves the last reported cursor position, relative to the client
* area of the window.
*
* This function returns the last reported position of the cursor to the
* This function returns the last reported position of the cursor, in screen
* coordinates, relative to the upper-left corner of the client area of the
* specified window.
*
* If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
@ -1842,11 +1864,13 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
*/
GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
/*! @brief Sets the position of the cursor, relative to the client area of the window.
/*! @brief Sets the position of the cursor, relative to the client area of the
* window.
*
* This function sets the position of the cursor. The specified window must be
* focused. If the window does not have focus when this function is called, it
* fails silently.
* This function sets the position, in screen coordinates, of the cursor
* relative to the upper-left corner of the client area of the specified
* window. The window must be focused. If the window does not have focus when
* this function is called, it fails silently.
*
* If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
* position is unbounded and limited only by the minimum and maximum values of
@ -1854,9 +1878,9 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
*
* @param[in] window The desired window.
* @param[in] xpos The desired x-coordinate, relative to the left edge of the
* client area, or `NULL`.
* client area.
* @param[in] ypos The desired y-coordinate, relative to the top edge of the
* client area, or `NULL`.
* client area.
*
* @sa glfwGetCursorPos
*
@ -1942,7 +1966,8 @@ GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmo
*
* This function sets the cursor position callback of the specified window,
* which is called when the cursor is moved. The callback is provided with the
* position relative to the upper-left corner of the client area of the window.
* position, in screen coordinates, relative to the upper-left corner of the
* client area of the window.
*
* @param[in] window The window whose callback to set.
* @param[in] cbfun The new callback, or `NULL` to remove the currently set
@ -2202,6 +2227,11 @@ GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
*
* @remarks This function may be called from secondary threads.
*
* @note This function is not called during window creation, leaving the swap
* interval set to whatever is the default on that platform. This is done
* because some swap interval extensions used by GLFW do not allow the swap
* interval to be reset to zero once it has been set to a non-zero value.
*
* @note Some GPU drivers do not honor the requested swap interval, either
* because of user settings that override the request or due to bugs in the
* driver.

View File

@ -3,7 +3,9 @@ include_directories(${GLFW_SOURCE_DIR}/src
${GLFW_BINARY_DIR}/src
${glfw_INCLUDE_DIRS})
set(common_HEADERS ${GLFW_BINARY_DIR}/src/config.h internal.h
add_definitions(-D_GLFW_USE_CONFIG_H)
set(common_HEADERS ${GLFW_BINARY_DIR}/src/glfw_config.h internal.h
${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h
${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h)
set(common_SOURCES clipboard.c context.c gamma.c init.c input.c joystick.c
@ -72,7 +74,8 @@ if (BUILD_SHARED_LIBS)
set(glfw_CFLAGS "")
endif()
set_target_properties(glfw PROPERTIES
COMPILE_FLAGS "${glfw_CFLAGS} -fno-common")
COMPILE_FLAGS "${glfw_CFLAGS} -fno-common"
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
endif()
target_link_libraries(glfw ${glfw_LIBRARIES})

View File

@ -122,7 +122,7 @@ void _glfwPlatformTerminate(void)
const char* _glfwPlatformGetVersionString(void)
{
const char* version = _GLFW_VERSION_FULL " Cocoa"
const char* version = _GLFW_VERSION_NUMBER " Cocoa"
#if defined(_GLFW_NSGL)
" NSGL"
#endif

View File

@ -251,9 +251,6 @@ static void pollJoystickEvents(void)
joystick->axes[i] = value;
else
joystick->axes[i] = (2.f * (value - axis->minReport) / readScale) - 1.f;
if (i & 1)
joystick->axes[i] = -joystick->axes[i];
}
for (i = 0; i < CFArrayGetCount(joystick->hatElements); i++)
@ -319,8 +316,9 @@ void _glfwInitJoysticks(void)
while ((ioHIDDeviceObject = IOIteratorNext(objectIterator)))
{
CFMutableDictionaryRef propsRef = NULL;
CFTypeRef valueRef = NULL;
kern_return_t result;
CFTypeRef valueRef = 0;
IOCFPlugInInterface** ppPlugInInterface = NULL;
HRESULT plugInResult = S_OK;
@ -329,26 +327,29 @@ void _glfwInitJoysticks(void)
long usagePage, usage;
// Check device type
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
CFSTR(kIOHIDPrimaryUsagePageKey),
result = IORegistryEntryCreateCFProperties(ioHIDDeviceObject,
&propsRef,
kCFAllocatorDefault,
kNilOptions);
if (result != kIOReturnSuccess)
continue;
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDPrimaryUsagePageKey));
if (valueRef)
{
CFNumberGetValue(valueRef, kCFNumberLongType, &usagePage);
if (usagePage != kHIDPage_GenericDesktop)
{
// This device is not relevant to GLFW
CFRelease(valueRef);
continue;
}
CFRelease(valueRef);
}
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
CFSTR(kIOHIDPrimaryUsageKey),
kCFAllocatorDefault,
kNilOptions);
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDPrimaryUsageKey));
if (valueRef)
{
CFNumberGetValue(valueRef, kCFNumberLongType, &usage);
@ -358,6 +359,7 @@ void _glfwInitJoysticks(void)
usage != kHIDUsage_GD_MultiAxisController))
{
// This device is not relevant to GLFW
CFRelease(valueRef);
continue;
}
@ -393,10 +395,7 @@ void _glfwInitJoysticks(void)
joystick);
// Get product string
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
CFSTR(kIOHIDProductKey),
kCFAllocatorDefault,
kNilOptions);
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDProductKey));
if (valueRef)
{
CFStringGetCString(valueRef,
@ -410,10 +409,7 @@ void _glfwInitJoysticks(void)
joystick->buttonElements = CFArrayCreateMutable(NULL, 0, NULL);
joystick->hatElements = CFArrayCreateMutable(NULL, 0, NULL);
valueRef = IORegistryEntryCreateCFProperty(ioHIDDeviceObject,
CFSTR(kIOHIDElementKey),
kCFAllocatorDefault,
kNilOptions);
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDElementKey));
if (CFGetTypeID(valueRef) == CFArrayGetTypeID())
{
CFRange range = { 0, CFArrayGetCount(valueRef) };

View File

@ -31,6 +31,9 @@
#include <limits.h>
#include <IOKit/graphics/IOGraphicsLib.h>
#include <IOKit/graphics/IOGraphicsLib.h>
#include <CoreVideo/CVBase.h>
#include <CoreVideo/CVDisplayLink.h>
// Get the name of the specified display
@ -46,9 +49,11 @@ static const char* getDisplayName(CGDirectDisplayID displayID)
kIODisplayOnlyPreferredName);
names = CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
if (!CFDictionaryGetValueIfPresent(names, CFSTR("en_US"),
if (!names || !CFDictionaryGetValueIfPresent(names, CFSTR("en_US"),
(const void**) &value))
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Failed to retrieve display name");
CFRelease(info);
return strdup("Unknown");
}
@ -74,9 +79,6 @@ static GLboolean modeIsGood(CGDisplayModeRef mode)
if (flags & kDisplayModeInterlacedFlag)
return GL_FALSE;
if (flags & kDisplayModeTelevisionFlag)
return GL_FALSE;
if (flags & kDisplayModeStretchedFlag)
return GL_FALSE;
@ -94,13 +96,21 @@ static GLboolean modeIsGood(CGDisplayModeRef mode)
// Convert Core Graphics display mode to GLFW video mode
//
static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode)
static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode,
CVDisplayLinkRef link)
{
GLFWvidmode result;
result.width = CGDisplayModeGetWidth(mode);
result.height = CGDisplayModeGetHeight(mode);
result.width = (int) CGDisplayModeGetWidth(mode);
result.height = (int) CGDisplayModeGetHeight(mode);
result.refreshRate = (int) CGDisplayModeGetRefreshRate(mode);
if (result.refreshRate == 0)
{
const CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(link);
if (!(time.flags & kCVTimeIsIndefinite))
result.refreshRate = (int) (time.timeScale / (double) time.timeValue);
}
CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) == 0)
@ -334,6 +344,9 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
CFArrayRef modes;
CFIndex count, i;
GLFWvidmode* result;
CVDisplayLinkRef link;
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
count = CFArrayGetCount(modes);
@ -348,21 +361,28 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
mode = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
if (modeIsGood(mode))
{
result[*found] = vidmodeFromCGDisplayMode(mode);
result[*found] = vidmodeFromCGDisplayMode(mode, link);
(*found)++;
}
}
CFRelease(modes);
CVDisplayLinkRelease(link);
return result;
}
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode)
{
CGDisplayModeRef displayMode;
CVDisplayLinkRef link;
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
displayMode = CGDisplayCopyDisplayMode(monitor->ns.displayID);
*mode = vidmodeFromCGDisplayMode(displayMode);
*mode = vidmodeFromCGDisplayMode(displayMode, link);
CGDisplayModeRelease(displayMode);
CVDisplayLinkRelease(link);
}

View File

@ -105,8 +105,6 @@ typedef struct _GLFWlibraryNS
id autoreleasePool;
id cursor;
GLboolean cursorHidden;
char* clipboardString;
_GLFWjoy joysticks[GLFW_JOYSTICK_LAST + 1];

View File

@ -30,6 +30,25 @@
#include <crt_externs.h>
// Center the cursor in the view of the window
//
static void centerCursor(_GLFWwindow *window)
{
int width, height;
_glfwPlatformGetWindowSize(window, &width, &height);
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
}
// Update the cursor to match the specified cursor mode
//
static void setModeCursor(_GLFWwindow* window, int mode)
{
if (mode == GLFW_CURSOR_NORMAL)
[[NSCursor arrowCursor] set];
else
[(NSCursor*) _glfw.ns.cursor set];
}
// Enter fullscreen mode
//
static void enterFullscreenMode(_GLFWwindow* window)
@ -39,8 +58,18 @@ static void enterFullscreenMode(_GLFWwindow* window)
_glfwSetVideoMode(window->monitor, &window->videoMode);
NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO],
NSFullScreenModeAllScreens,
nil];
[window->ns.view enterFullScreenMode:window->monitor->ns.screen
withOptions:nil];
withOptions:options];
// HACK: Synthesize focus event as window does not become key when the view
// is made full screen
// TODO: Remove this when moving to a full screen window
_glfwInputWindowFocus(window, GL_TRUE);
}
// Leave fullscreen mode
@ -50,6 +79,11 @@ static void leaveFullscreenMode(_GLFWwindow* window)
if (![window->ns.view isInFullScreenMode])
return;
// HACK: Synthesize focus event as window does not become key when the view
// is made full screen
// TODO: Remove this when moving to a full screen window
_glfwInputWindowFocus(window, GL_FALSE);
_glfwRestoreVideoMode(window->monitor);
// Exit full screen after the video restore to avoid a nasty display
@ -71,7 +105,7 @@ static float transformY(float y)
static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect)
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_7)
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
return [window->ns.view convertRectToBacking:contentRect];
else
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
@ -94,13 +128,6 @@ static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect)
@implementation GLFWWindowDelegate
static void centerCursor(_GLFWwindow *window)
{
int width, height;
_glfwPlatformGetWindowSize(window, &width, &height);
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
}
- (id)initWithGlfwWindow:(_GLFWwindow *)initWindow
{
self = [super init];
@ -159,14 +186,13 @@ static void centerCursor(_GLFWwindow *window)
- (void)windowDidBecomeKey:(NSNotification *)notification
{
_glfwInputWindowFocus(window, GL_TRUE);
if (window->cursorMode == GLFW_CURSOR_DISABLED)
centerCursor(window);
_glfwPlatformSetCursorMode(window, window->cursorMode);
}
- (void)windowDidResignKey:(NSNotification *)notification
{
_glfwInputWindowFocus(window, GL_FALSE);
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_NORMAL);
}
@end
@ -240,7 +266,6 @@ static int translateFlags(NSUInteger flags)
static int translateKey(unsigned int key)
{
// Keyboard symbol translation table
// TODO: Need to find mappings for F13-F15, volume down/up/mute, and eject.
static const unsigned int table[128] =
{
/* 00 */ GLFW_KEY_A,
@ -253,7 +278,7 @@ static int translateKey(unsigned int key)
/* 07 */ GLFW_KEY_X,
/* 08 */ GLFW_KEY_C,
/* 09 */ GLFW_KEY_V,
/* 0a */ GLFW_KEY_GRAVE_ACCENT,
/* 0a */ GLFW_KEY_WORLD_1,
/* 0b */ GLFW_KEY_B,
/* 0c */ GLFW_KEY_Q,
/* 0d */ GLFW_KEY_W,
@ -293,7 +318,7 @@ static int translateKey(unsigned int key)
/* 2f */ GLFW_KEY_PERIOD,
/* 30 */ GLFW_KEY_TAB,
/* 31 */ GLFW_KEY_SPACE,
/* 32 */ GLFW_KEY_WORLD_1,
/* 32 */ GLFW_KEY_GRAVE_ACCENT,
/* 33 */ GLFW_KEY_BACKSPACE,
/* 34 */ GLFW_KEY_UNKNOWN,
/* 35 */ GLFW_KEY_ESCAPE,
@ -348,7 +373,7 @@ static int translateKey(unsigned int key)
/* 66 */ GLFW_KEY_UNKNOWN,
/* 67 */ GLFW_KEY_F11,
/* 68 */ GLFW_KEY_UNKNOWN,
/* 69 */ GLFW_KEY_PRINT_SCREEN,
/* 69 */ GLFW_KEY_F13,
/* 6a */ GLFW_KEY_F16,
/* 6b */ GLFW_KEY_F14,
/* 6c */ GLFW_KEY_UNKNOWN,
@ -445,6 +470,11 @@ static int translateKey(unsigned int key)
return YES;
}
- (void)cursorUpdate:(NSEvent *)event
{
setModeCursor(window, window->cursorMode);
}
- (void)mouseDown:(NSEvent *)event
{
_glfwInputMouseClick(window,
@ -503,7 +533,7 @@ static int translateKey(unsigned int key)
- (void)otherMouseDown:(NSEvent *)event
{
_glfwInputMouseClick(window,
[event buttonNumber],
(int) [event buttonNumber],
GLFW_PRESS,
translateFlags([event modifierFlags]));
}
@ -516,7 +546,7 @@ static int translateKey(unsigned int key)
- (void)otherMouseUp:(NSEvent *)event
{
_glfwInputMouseClick(window,
[event buttonNumber],
(int) [event buttonNumber],
GLFW_RELEASE,
translateFlags([event modifierFlags]));
}
@ -548,7 +578,8 @@ static int translateKey(unsigned int key)
}
NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited |
NSTrackingActiveAlways |
NSTrackingActiveInKeyWindow |
NSTrackingCursorUpdate |
NSTrackingInVisibleRect;
trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds]
@ -603,7 +634,7 @@ static int translateKey(unsigned int key)
double deltaX, deltaY;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_7)
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
{
deltaX = [event scrollingDeltaX];
deltaY = [event scrollingDeltaY];
@ -625,12 +656,6 @@ static int translateKey(unsigned int key)
_glfwInputScroll(window, deltaX, deltaY);
}
- (void)resetCursorRects
{
[self discardCursorRects];
[self addCursorRect:[self bounds] cursor:_glfw.ns.cursor];
}
@end
@ -759,7 +784,7 @@ static void createMenuBar(void)
[NSApp setWindowsMenu:windowMenu];
[windowMenuItem setSubmenu:windowMenu];
[windowMenu addItemWithTitle:@"Miniaturize"
[windowMenu addItemWithTitle:@"Minimize"
action:@selector(performMiniaturize:)
keyEquivalent:@"m"];
[windowMenu addItemWithTitle:@"Zoom"
@ -770,9 +795,23 @@ static void createMenuBar(void)
action:@selector(arrangeInFront:)
keyEquivalent:@""];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
{
// TODO: Make this appear at the bottom of the menu (for consistency)
[windowMenu addItem:[NSMenuItem separatorItem]];
[[windowMenu addItemWithTitle:@"Enter Full Screen"
action:@selector(toggleFullScreen:)
keyEquivalent:@"f"]
setKeyEquivalentModifierMask:NSControlKeyMask | NSCommandKeyMask];
}
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
// Prior to Snow Leopard, we need to use this oddly-named semi-private API
// to get the application menu working properly.
[NSApp performSelector:@selector(setAppleMenu:) withObject:appMenu];
SEL setAppleMenuSelector = NSSelectorFromString(@"setAppleMenu:");
[NSApp performSelector:setAppleMenuSelector withObject:appMenu];
}
#endif /* _GLFW_USE_MENUBAR */
@ -787,13 +826,8 @@ static GLboolean initializeAppKit(void)
// Implicitly create shared NSApplication instance
[GLFWApplication sharedApplication];
// If we get here, the application is unbundled
ProcessSerialNumber psn = { 0, kCurrentProcess };
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
// Having the app in front of the terminal window is also generally
// handy. There is an NSApplication API to do this, but...
SetFrontProcess(&psn);
// In case we are unbundled, make us a proper UI application
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
#if defined(_GLFW_USE_MENUBAR)
// Menu bar setup must go between sharedApplication above and
@ -840,19 +874,23 @@ static GLboolean createWindow(_GLFWwindow* window,
window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_7)
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
{
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
if (wndconfig->resizable)
[window->ns.object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
}
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
[window->ns.object setTitle:[NSString stringWithUTF8String:wndconfig->title]];
[window->ns.object setContentView:window->ns.view];
[window->ns.object setDelegate:window->ns.delegate];
[window->ns.object setAcceptsMouseMovedEvents:YES];
[window->ns.object disableCursorRects];
[window->ns.object center];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_7)
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
[window->ns.object setRestorable:NO];
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
@ -996,6 +1034,12 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
void _glfwPlatformShowWindow(_GLFWwindow* window)
{
// Make us the active application
// HACK: This has been moved here from initializeAppKit to prevent
// applications using only hidden windows from being activated, but
// should probably not be done every time any window is shown
[NSApp activateIgnoringOtherApps:YES];
[window->ns.object makeKeyAndOrderFront:nil];
_glfwInputWindowVisibility(window, GL_TRUE);
}
@ -1040,6 +1084,8 @@ void _glfwPlatformWaitEvents(void)
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
{
setModeCursor(window, window->cursorMode);
if (window->monitor)
{
CGDisplayMoveCursorToPoint(window->monitor->ns.displayID,
@ -1058,37 +1104,15 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
{
if (mode == GLFW_CURSOR_HIDDEN)
{
[window->ns.object enableCursorRects];
[window->ns.object invalidateCursorRectsForView:window->ns.view];
}
else
{
[window->ns.object disableCursorRects];
[window->ns.object invalidateCursorRectsForView:window->ns.view];
}
setModeCursor(window, mode);
if (mode == GLFW_CURSOR_DISABLED)
{
CGAssociateMouseAndMouseCursorPosition(false);
if (!_glfw.ns.cursorHidden)
{
[NSCursor hide];
_glfw.ns.cursorHidden = GL_TRUE;
}
centerCursor(window);
}
else
{
CGAssociateMouseAndMouseCursorPosition(true);
if (_glfw.ns.cursorHidden)
{
[NSCursor unhide];
_glfw.ns.cursorHidden = GL_FALSE;
}
}
}

84
extern/glfw/src/config.h vendored Normal file
View File

@ -0,0 +1,84 @@
//========================================================================
// GLFW 3.0 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
// As config.h.in, this file is used by CMake to produce the config.h shared
// configuration header file. If you are adding a feature requiring
// conditional compilation, this is the proper place to add the macros.
//========================================================================
// As config.h, this file defines compile-time build options and macros for
// all platforms supported by GLFW. As this is a generated file, don't modify
// it. Instead, you should modify the config.h.in file.
//========================================================================
// Define this to 1 if building GLFW for X11
#define _GLFW_X11
// Define this to 1 if building GLFW for Win32
/* #undef _GLFW_WIN32 */
// Define this to 1 if building GLFW for Cocoa
/* #undef _GLFW_COCOA */
// Define this to 1 if building GLFW for EGL
/* #undef _GLFW_EGL */
// Define this to 1 if building GLFW for GLX
#define _GLFW_GLX
// Define this to 1 if building GLFW for WGL
/* #undef _GLFW_WGL */
// Define this to 1 if building GLFW for NSGL
/* #undef _GLFW_NSGL */
// Define this to 1 if building as a shared library / dynamic library / DLL
/* #undef _GLFW_BUILD_DLL */
// Define this to 1 to disable dynamic loading of winmm
/* #undef _GLFW_NO_DLOAD_WINMM */
// Define this to 1 if glfwSwapInterval should ignore DWM compositing status
/* #undef _GLFW_USE_DWM_SWAP_INTERVAL */
// Define this to 1 to force use of high-performance GPU on Optimus systems
/* #undef _GLFW_USE_OPTIMUS_HPG */
// Define this to 1 if glXGetProcAddress is available
#define _GLFW_HAS_GLXGETPROCADDRESS
// Define this to 1 if glXGetProcAddressARB is available
#define _GLFW_HAS_GLXGETPROCADDRESSARB
// Define this to 1 if glXGetProcAddressEXT is available
/* #undef _GLFW_HAS_GLXGETPROCADDRESSEXT */
// Define this to 1 if dlopen is available
/* #undef _GLFW_HAS_DLOPEN */
// Define this to 1 if glfwInit should change the current directory
/* #undef _GLFW_USE_CHDIR */
// Define this to 1 if glfwCreateWindow should populate the menu bar
/* #undef _GLFW_USE_MENUBAR */
// Define this to 1 if using OpenGL as the client library
#define _GLFW_USE_OPENGL
// Define this to 1 if using OpenGL ES 1.1 as the client library
/* #undef _GLFW_USE_GLESV1 */
// Define this to 1 if using OpenGL ES 2.0 as the client library
/* #undef _GLFW_USE_GLESV2 */
// The GLFW version as used by glfwGetVersionString
#define _GLFW_VERSION_FULL "3.0.2"

View File

@ -98,7 +98,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
if (wndconfig->clientAPI == GLFW_OPENGL_API)
{
if (wndconfig->glMajor < 1 || wndconfig->glMinor < 0 ||
if ((wndconfig->glMajor < 1 || wndconfig->glMinor < 0) ||
(wndconfig->glMajor == 1 && wndconfig->glMinor > 5) ||
(wndconfig->glMajor == 2 && wndconfig->glMinor > 1) ||
(wndconfig->glMajor == 3 && wndconfig->glMinor > 3))
@ -402,8 +402,8 @@ GLboolean _glfwRefreshContextAttribs(void)
else if (glfwExtensionSupported("GL_ARB_debug_output"))
{
// HACK: This is a workaround for older drivers (pre KHR_debug)
// not setting the debug bit in the context flags for debug
// contexts
// not setting the debug bit in the context flags for
// debug contexts
window->glDebug = GL_TRUE;
}
}
@ -419,6 +419,14 @@ GLboolean _glfwRefreshContextAttribs(void)
window->glProfile = GLFW_OPENGL_COMPAT_PROFILE;
else if (mask & GL_CONTEXT_CORE_PROFILE_BIT)
window->glProfile = GLFW_OPENGL_CORE_PROFILE;
else if (glfwExtensionSupported("GL_ARB_compatibility"))
{
// HACK: This is a workaround for the compatibility profile bit
// not being set in the context flags if an OpenGL 3.2+
// context was created without having requested a specific
// version
window->glProfile = GLFW_OPENGL_COMPAT_PROFILE;
}
}
// Read back robustness strategy
@ -566,7 +574,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
return GL_FALSE;
}
if (extension == NULL || *extension == '\0')
if (!extension || *extension == '\0')
{
_glfwInputError(GLFW_INVALID_VALUE, NULL);
return GL_FALSE;
@ -577,12 +585,16 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
// Check if extension is in the old style OpenGL extensions string
extensions = glGetString(GL_EXTENSIONS);
if (extensions != NULL)
if (!extensions)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Failed to retrieve extension string");
return GL_FALSE;
}
if (_glfwStringInExtensionString(extension, extensions))
return GL_TRUE;
}
}
#if defined(_GLFW_USE_OPENGL)
else
{
@ -595,11 +607,16 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
for (i = 0; i < count; i++)
{
if (strcmp((const char*) window->GetStringi(GL_EXTENSIONS, i),
extension) == 0)
const char* en = (const char*) window->GetStringi(GL_EXTENSIONS, i);
if (!en)
{
return GL_TRUE;
_glfwInputError(GLFW_PLATFORM_ERROR,
"Failed to retrieve extension string %i", i);
return GL_FALSE;
}
if (strcmp(en, extension) == 0)
return GL_TRUE;
}
}
#endif // _GLFW_USE_OPENGL

View File

@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
libdir=${exec_prefix}/lib@LIB_SUFFIX@
Name: GLFW
Description: A portable library for OpenGL, window and input

View File

@ -23,13 +23,15 @@
// distribution.
//
//========================================================================
// As config.h.in, this file is used by CMake to produce the config.h shared
// configuration header file. If you are adding a feature requiring
// conditional compilation, this is the proper place to add the macros.
// As glfw_config.h.in, this file is used by CMake to produce the
// glfw_config.h configuration header file. If you are adding a feature
// requiring conditional compilation, this is where to add the macro.
//========================================================================
// As config.h, this file defines compile-time build options and macros for
// all platforms supported by GLFW. As this is a generated file, don't modify
// it. Instead, you should modify the config.h.in file.
// As glfw_config.h, this file defines compile-time option macros for a
// specific platform and development environment. If you are using the
// GLFW CMake files, modify glfw_config.h.in instead of this file. If you
// are using your own build system, make this file define the appropriate
// macros in whatever way is suitable.
//========================================================================
// Define this to 1 if building GLFW for X11
@ -79,6 +81,3 @@
// Define this to 1 if using OpenGL ES 2.0 as the client library
#cmakedefine _GLFW_USE_GLESV2
// The GLFW version as used by glfwGetVersionString
#define _GLFW_VERSION_FULL "@GLFW_VERSION_FULL@"

View File

@ -30,7 +30,6 @@
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <pthread.h>
// This is the only glXGetProcAddress variant not declared by glxext.h
@ -457,8 +456,8 @@ int _glfwCreateContext(_GLFWwindow* window,
if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0)
{
// NOTE: Only request an explicitly versioned context when
// necessary, as explicitly requesting version 1.0 does not always
// return the highest available version
// necessary, as explicitly requesting version 1.0 does not
// always return the highest available version
setGLXattrib(GLX_CONTEXT_MAJOR_VERSION_ARB, wndconfig->glMajor);
setGLXattrib(GLX_CONTEXT_MINOR_VERSION_ARB, wndconfig->glMinor);
@ -485,8 +484,9 @@ int _glfwCreateContext(_GLFWwindow* window,
if (window->glx.context == NULL)
{
// HACK: This is a fallback for the broken Mesa implementation of
// GLX_ARB_create_context_profile, which fails default 1.0 context
// creation with a GLXBadProfileARB error in violation of the spec
// GLX_ARB_create_context_profile, which fails default 1.0
// context creation with a GLXBadProfileARB error in violation
// of the extension spec
if (_glfw.x11.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
wndconfig->clientAPI == GLFW_OPENGL_API &&
wndconfig->glProfile == GLFW_OPENGL_ANY_PROFILE &&

View File

@ -41,6 +41,8 @@
#include <dlfcn.h>
#endif
#include <pthread.h>
// We support four different ways for getting addresses for GL/GLX
// extension functions: glXGetProcAddress, glXGetProcAddressARB,
// glXGetProcAddressEXT, and dlsym

View File

@ -35,7 +35,7 @@
//
static void setCursorMode(_GLFWwindow* window, int newMode)
{
int oldMode;
const int oldMode = window->cursorMode;
if (newMode != GLFW_CURSOR_NORMAL &&
newMode != GLFW_CURSOR_HIDDEN &&
@ -45,10 +45,11 @@ static void setCursorMode(_GLFWwindow* window, int newMode)
return;
}
oldMode = window->cursorMode;
if (oldMode == newMode)
return;
window->cursorMode = newMode;
if (window == _glfw.focusedWindow)
{
if (oldMode == GLFW_CURSOR_DISABLED)
@ -71,8 +72,6 @@ static void setCursorMode(_GLFWwindow* window, int newMode)
_glfwPlatformSetCursorMode(window, newMode);
}
window->cursorMode = newMode;
}
// Set sticky keys mode for the specified window
@ -149,13 +148,13 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m
window->callbacks.key((GLFWwindow*) window, key, scancode, action, mods);
}
void _glfwInputChar(_GLFWwindow* window, unsigned int character)
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint)
{
if (character < 32 || (character > 126 && character < 160))
if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
return;
if (window->callbacks.character)
window->callbacks.character((GLFWwindow*) window, character);
window->callbacks.character((GLFWwindow*) window, codepoint);
}
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)

View File

@ -29,7 +29,11 @@
#define _internal_h_
#include "config.h"
#if defined(_GLFW_USE_CONFIG_H)
#include "glfw_config.h"
#endif
#define _GLFW_VERSION_NUMBER "3.0.4"
#if defined(_GLFW_USE_OPENGL)
// This is the default for glfw3.h
@ -624,10 +628,10 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m
/*! @brief Notifies shared code of a Unicode character input event.
* @param[in] window The window that received the event.
* @param[in] character The Unicode code point of the input character.
* @param[in] codepoint The Unicode code point of the input character.
* @ingroup event
*/
void _glfwInputChar(_GLFWwindow* window, unsigned int character);
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint);
/*! @brief Notifies shared code of a scroll event.
* @param[in] window The window that received the event.
@ -750,11 +754,18 @@ void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size);
*/
void _glfwFreeGammaArrays(GLFWgammaramp* ramp);
/*! @ingroup utility
/*! @brief Allocates and returns a monitor object with the specified name
* and dimensions.
* @param[in] name The name of the monitor.
* @param[in] widthMM The width, in mm, of the monitor's display area.
* @param[in] heightMM The height, in mm, of the monitor's display area.
* @return The newly created object.
* @ingroup utility
*/
_GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heightMM);
/*! @ingroup utility
/*! @brief Frees a monitor object and any data associated with it.
* @ingroup utility
*/
void _glfwDestroyMonitor(_GLFWmonitor* monitor);

View File

@ -40,7 +40,7 @@ int _glfwInitContextAPI(void)
if (pthread_key_create(&_glfw.nsgl.current, NULL) != 0)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"NSOpenGL: Failed to create context TLS");
"NSGL: Failed to create context TLS");
return GL_FALSE;
}
@ -81,16 +81,15 @@ int _glfwCreateContext(_GLFWwindow* window,
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSOpenGL: This API does not support OpenGL ES");
"NSGL: This API does not support OpenGL ES");
return GL_FALSE;
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
// Fail if any OpenGL version above 2.1 other than 3.2 was requested
if (wndconfig->glMajor == 3 && wndconfig->glMinor < 2)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSOpenGL: The targeted version of OS X does not "
"NSGL: The targeted version of OS X does not "
"support OpenGL 3.0 or 3.1");
return GL_FALSE;
}
@ -100,7 +99,7 @@ int _glfwCreateContext(_GLFWwindow* window,
if (!wndconfig->glForward)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSOpenGL: The targeted version of OS X only "
"NSGL: The targeted version of OS X only "
"supports OpenGL 3.2 and later versions if they "
"are forward-compatible");
return GL_FALSE;
@ -109,7 +108,7 @@ int _glfwCreateContext(_GLFWwindow* window,
if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSOpenGL: The targeted version of OS X only "
"NSGL: The targeted version of OS X only "
"supports OpenGL 3.2 and later versions if they "
"use the core profile");
return GL_FALSE;
@ -120,7 +119,7 @@ int _glfwCreateContext(_GLFWwindow* window,
if (wndconfig->glMajor > 2)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSOpenGL: The targeted version of OS X does not "
"NSGL: The targeted version of OS X does not "
"support OpenGL version 3.0 or above");
return GL_FALSE;
}
@ -130,7 +129,7 @@ int _glfwCreateContext(_GLFWwindow* window,
if (wndconfig->glRobustness)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSOpenGL: OS X does not support OpenGL robustness "
"NSGL: OS X does not support OpenGL robustness "
"strategies");
return GL_FALSE;
}
@ -191,7 +190,7 @@ int _glfwCreateContext(_GLFWwindow* window,
if (window->nsgl.pixelFormat == nil)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"NSOpenGL: Failed to create OpenGL pixel format");
"NSGL: Failed to create OpenGL pixel format");
return GL_FALSE;
}
@ -206,7 +205,7 @@ int _glfwCreateContext(_GLFWwindow* window,
if (window->nsgl.context == nil)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"NSOpenGL: Failed to create OpenGL context");
"NSGL: Failed to create OpenGL context");
return GL_FALSE;
}

View File

@ -272,9 +272,21 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
usableCount++;
}
if (!usableCount)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"WGL: The driver does not appear to support OpenGL");
free(usableConfigs);
return GL_FALSE;
}
closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount);
if (!closest)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"WGL: Failed to find a suitable pixel format");
free(usableConfigs);
return GL_FALSE;
}
@ -355,11 +367,7 @@ int _glfwCreateContext(_GLFWwindow* window,
}
if (!choosePixelFormat(window, fbconfig, &pixelFormat))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"WGL: Failed to find a suitable pixel format");
return GL_FALSE;
}
if (!DescribePixelFormat(window->wgl.dc, pixelFormat, sizeof(pfd), &pfd))
{
@ -598,7 +606,7 @@ void _glfwPlatformSwapInterval(int interval)
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
#if !defined(_GLFW_USE_DWM_SWAP_INTERVAL)
if (_glfwIsCompositionEnabled())
if (_glfwIsCompositionEnabled() && interval)
{
// Don't enabled vsync when desktop compositing is enabled, as it leads
// to frame jitter

View File

@ -243,7 +243,7 @@ void _glfwPlatformTerminate(void)
const char* _glfwPlatformGetVersionString(void)
{
const char* version = _GLFW_VERSION_FULL " Win32"
const char* version = _GLFW_VERSION_NUMBER " Win32"
#if defined(_GLFW_WGL)
" WGL"
#elif defined(_GLFW_EGL)
@ -252,7 +252,7 @@ const char* _glfwPlatformGetVersionString(void)
#if defined(__MINGW32__)
" MinGW"
#elif defined(_MSC_VER)
" VisualC "
" VisualC"
#elif defined(__BORLANDC__)
" BorlandC"
#endif

View File

@ -97,7 +97,7 @@ const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
return NULL;
axes[(*count)++] = calcJoystickPos(ji.dwXpos, jc.wXmin, jc.wXmax);
axes[(*count)++] = -calcJoystickPos(ji.dwYpos, jc.wYmin, jc.wYmax);
axes[(*count)++] = calcJoystickPos(ji.dwYpos, jc.wYmin, jc.wYmax);
if (jc.wCaps & JOYCAPS_HASZ)
axes[(*count)++] = calcJoystickPos(ji.dwZpos, jc.wZmin, jc.wZmax);
@ -109,7 +109,7 @@ const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
axes[(*count)++] = calcJoystickPos(ji.dwUpos, jc.wUmin, jc.wUmax);
if (jc.wCaps & JOYCAPS_HASV)
axes[(*count)++] = -calcJoystickPos(ji.dwVpos, jc.wVmin, jc.wVmax);
axes[(*count)++] = calcJoystickPos(ji.dwVpos, jc.wVmin, jc.wVmax);
return axes;
}

View File

@ -52,10 +52,15 @@
#define UNICODE
#endif
// GLFW requires Windows XP
#ifndef WINVER
// GLFW requires Windows XP or later
#if WINVER < 0x0501
#undef WINVER
#define WINVER 0x0501
#endif
#if _WIN32_WINNT < 0x0501
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#include <windows.h>
#include <mmsystem.h>
@ -152,7 +157,7 @@ typedef struct _GLFWwindowWin32
GLboolean cursorCentered;
GLboolean cursorInside;
GLboolean cursorHidden;
double oldCursorX, oldCursorY;
int oldCursorX, oldCursorY;
} _GLFWwindowWin32;
@ -169,8 +174,7 @@ typedef struct _GLFWlibraryWin32
struct {
GLboolean hasPC;
double resolution;
unsigned int t0_32;
__int64 t0_64;
unsigned __int64 base;
} timer;
#ifndef _GLFW_NO_DLOAD_WINMM

View File

@ -28,6 +28,21 @@
#include "internal.h"
// Return raw time
//
static unsigned __int64 getRawTime(void)
{
if (_glfw.win32.timer.hasPC)
{
unsigned __int64 time;
QueryPerformanceCounter((LARGE_INTEGER*) &time);
return time;
}
else
return (unsigned __int64) _glfw_timeGetTime();
}
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
@ -36,20 +51,20 @@
//
void _glfwInitTimer(void)
{
__int64 freq;
unsigned __int64 frequency;
if (QueryPerformanceFrequency((LARGE_INTEGER*) &freq))
if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency))
{
_glfw.win32.timer.hasPC = GL_TRUE;
_glfw.win32.timer.resolution = 1.0 / (double) freq;
QueryPerformanceCounter((LARGE_INTEGER*) &_glfw.win32.timer.t0_64);
_glfw.win32.timer.resolution = 1.0 / (double) frequency;
}
else
{
_glfw.win32.timer.hasPC = GL_FALSE;
_glfw.win32.timer.resolution = 0.001; // winmm resolution is 1 ms
_glfw.win32.timer.t0_32 = _glfw_timeGetTime();
}
_glfw.win32.timer.base = getRawTime();
}
@ -59,30 +74,13 @@ void _glfwInitTimer(void)
double _glfwPlatformGetTime(void)
{
double t;
__int64 t_64;
if (_glfw.win32.timer.hasPC)
{
QueryPerformanceCounter((LARGE_INTEGER*) &t_64);
t = (double)(t_64 - _glfw.win32.timer.t0_64);
}
else
t = (double)(_glfw_timeGetTime() - _glfw.win32.timer.t0_32);
return t * _glfw.win32.timer.resolution;
return (double) (getRawTime() - _glfw.win32.timer.base) *
_glfw.win32.timer.resolution;
}
void _glfwPlatformSetTime(double t)
void _glfwPlatformSetTime(double time)
{
__int64 t_64;
if (_glfw.win32.timer.hasPC)
{
QueryPerformanceCounter((LARGE_INTEGER*) &t_64);
_glfw.win32.timer.t0_64 = t_64 - (__int64) (t / _glfw.win32.timer.resolution);
}
else
_glfw.win32.timer.t0_32 = _glfw_timeGetTime() - (int)(t * 1000.0);
_glfw.win32.timer.base = getRawTime() -
(unsigned __int64) (time / _glfw.win32.timer.resolution);
}

View File

@ -387,12 +387,23 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
BOOL iconified = HIWORD(wParam) ? TRUE : FALSE;
if (focused && iconified)
{
if (window->iconified && _glfw.focusedWindow != window)
{
// This is a workaround for window restoration using the
// Win+D hot key leading to windows being told they're
// focused and iconified and then never told they're
// restored
iconified = FALSE;
}
else
{
// This is a workaround for window iconification using the
// taskbar leading to windows being told they're focused and
// iconified and then never told they're defocused
focused = FALSE;
}
}
if (!focused && _glfw.focusedWindow == window)
{
@ -431,6 +442,19 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
return 0;
}
case WM_ACTIVATEAPP:
{
if (!wParam && IsIconic(hWnd))
{
// This is a workaround for full screen windows losing focus
// through Alt+Tab leading to windows being told they're
// unfocused and restored and then never told they're iconified
_glfwInputWindowIconify(window, GL_TRUE);
}
return 0;
}
case WM_SHOWWINDOW:
{
_glfwInputWindowVisibility(window, wParam ? GL_TRUE : GL_FALSE);
@ -593,7 +617,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
if (newCursorX != window->win32.oldCursorX ||
newCursorY != window->win32.oldCursorY)
{
double x, y;
int x, y;
if (window->cursorMode == GLFW_CURSOR_DISABLED)
{
@ -654,8 +678,11 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_SIZE:
{
if (window->cursorMode == GLFW_CURSOR_DISABLED)
if (window->cursorMode == GLFW_CURSOR_DISABLED &&
_glfw.focusedWindow == window)
{
updateClipRect(window);
}
_glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam));
_glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam));
@ -664,10 +691,17 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_MOVE:
{
if (window->cursorMode == GLFW_CURSOR_DISABLED)
if (window->cursorMode == GLFW_CURSOR_DISABLED &&
_glfw.focusedWindow == window)
{
updateClipRect(window);
}
_glfwInputWindowPos(window, LOWORD(lParam), HIWORD(lParam));
// NOTE: This cannot use LOWORD/HIWORD recommended by MSDN, as
// those macros do not handle negative window positions correctly
_glfwInputWindowPos(window,
GET_X_LPARAM(lParam),
GET_Y_LPARAM(lParam));
return 0;
}
@ -679,8 +713,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_SETCURSOR:
{
if (window->cursorMode == GLFW_CURSOR_HIDDEN &&
window->win32.handle == GetForegroundWindow() &&
if (window->cursorMode != GLFW_CURSOR_NORMAL &&
_glfw.focusedWindow == window &&
LOWORD(lParam) == HTCLIENT)
{
SetCursor(NULL);
@ -902,7 +936,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
// First we clear the current context (the one we just created)
// This is usually done by glfwDestroyWindow, but as we're not doing
// full window destruction, it's duplicated here
// full GLFW window destruction, it's duplicated here
_glfwPlatformMakeContextCurrent(NULL);
// Next destroy the Win32 window and WGL context (without resetting or
@ -1000,7 +1034,7 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
SetWindowPos(window->win32.handle, HWND_TOP,
0, 0, fullWidth, fullHeight,
SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOZORDER);
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOZORDER);
}
}
@ -1104,8 +1138,8 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos)
ClientToScreen(window->win32.handle, &pos);
SetCursorPos(pos.x, pos.y);
window->win32.oldCursorX = xpos;
window->win32.oldCursorY = ypos;
window->win32.oldCursorX = (int) xpos;
window->win32.oldCursorY = (int) ypos;
}
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)

Some files were not shown because too many files have changed in this diff Show More