├── .gitignore ├── BUILD.md ├── COPYING.txt ├── README.md └── neo ├── CMakeLists.txt ├── cm ├── CollisionModel.h ├── CollisionModel_contacts.cpp ├── CollisionModel_contents.cpp ├── CollisionModel_debug.cpp ├── CollisionModel_files.cpp ├── CollisionModel_load.cpp ├── CollisionModel_local.h ├── CollisionModel_rotate.cpp ├── CollisionModel_trace.cpp └── CollisionModel_translate.cpp ├── config.h.in ├── framework ├── BuildDefines.h ├── BuildVersion.h ├── CVarSystem.cpp ├── CVarSystem.h ├── CmdSystem.cpp ├── CmdSystem.h ├── Common.cpp ├── Common.h ├── Compressor.cpp ├── Compressor.h ├── Console.cpp ├── Console.h ├── DeclAF.cpp ├── DeclAF.h ├── DeclEntityDef.cpp ├── DeclEntityDef.h ├── DeclFX.cpp ├── DeclFX.h ├── DeclManager.cpp ├── DeclManager.h ├── DeclPDA.cpp ├── DeclPDA.h ├── DeclParticle.cpp ├── DeclParticle.h ├── DeclSkin.cpp ├── DeclSkin.h ├── DeclTable.cpp ├── DeclTable.h ├── DemoChecksum.h ├── DemoFile.cpp ├── DemoFile.h ├── EditField.cpp ├── EditField.h ├── EventLoop.cpp ├── EventLoop.h ├── File.cpp ├── File.h ├── FileSystem.cpp ├── FileSystem.h ├── Game.h ├── GameCallbacks_local.h ├── KeyInput.cpp ├── KeyInput.h ├── Licensee.h ├── Session.cpp ├── Session.h ├── Session_local.h ├── Session_menu.cpp ├── Unzip.h ├── UsercmdGen.cpp ├── UsercmdGen.h ├── async │ ├── AsyncClient.cpp │ ├── AsyncClient.h │ ├── AsyncNetwork.cpp │ ├── AsyncNetwork.h │ ├── MsgChannel.cpp │ ├── MsgChannel.h │ ├── NetworkSystem.cpp │ ├── NetworkSystem.h │ ├── ServerScan.cpp │ └── ServerScan.h └── minizip │ ├── MiniZip64_info.txt │ ├── ioapi.c │ ├── ioapi.h │ ├── unzip.cpp │ └── unzip.h ├── game ├── AF.cpp ├── AF.h ├── AFEntity.cpp ├── AFEntity.h ├── Actor.cpp ├── Actor.h ├── BrittleFracture.cpp ├── BrittleFracture.h ├── Camera.cpp ├── Camera.h ├── EndLevel.cpp ├── EndLevel.h ├── Entity.cpp ├── Entity.h ├── Fx.cpp ├── Fx.h ├── GameBase.h ├── GameEdit.cpp ├── GameEdit.h ├── Game_local.cpp ├── Game_local.h ├── Game_network.cpp ├── IK.cpp ├── IK.h ├── Item.cpp ├── Item.h ├── Light.cpp ├── Light.h ├── Misc.cpp ├── Misc.h ├── Moveable.cpp ├── Moveable.h ├── Mover.cpp ├── Mover.h ├── MultiplayerGame.cpp ├── MultiplayerGame.h ├── Player.cpp ├── Player.h ├── PlayerIcon.cpp ├── PlayerIcon.h ├── PlayerView.cpp ├── PlayerView.h ├── Projectile.cpp ├── Projectile.h ├── Pvs.cpp ├── Pvs.h ├── SecurityCamera.cpp ├── SecurityCamera.h ├── SmokeParticles.cpp ├── SmokeParticles.h ├── Sound.cpp ├── Sound.h ├── Target.cpp ├── Target.h ├── Trigger.cpp ├── Trigger.h ├── Weapon.cpp ├── Weapon.h ├── WorldSpawn.cpp ├── WorldSpawn.h ├── ai │ ├── AAS.cpp │ ├── AAS.h │ ├── AAS_debug.cpp │ ├── AAS_local.h │ ├── AAS_pathing.cpp │ ├── AAS_routing.cpp │ ├── AI.cpp │ ├── AI.h │ ├── AI_Vagary.cpp │ ├── AI_events.cpp │ └── AI_pathing.cpp ├── anim │ ├── Anim.cpp │ ├── Anim.h │ └── Anim_Blend.cpp ├── gamesys │ ├── Callbacks.cpp │ ├── Class.cpp │ ├── Class.h │ ├── DebugGraph.cpp │ ├── DebugGraph.h │ ├── Event.cpp │ ├── Event.h │ ├── NoGameTypeInfo.h │ ├── SaveGame.cpp │ ├── SaveGame.h │ ├── SysCmds.cpp │ ├── SysCmds.h │ ├── SysCvar.cpp │ ├── SysCvar.h │ ├── TypeInfo.cpp │ └── TypeInfo.h ├── physics │ ├── Clip.cpp │ ├── Clip.h │ ├── Force.cpp │ ├── Force.h │ ├── Force_Constant.cpp │ ├── Force_Constant.h │ ├── Force_Drag.cpp │ ├── Force_Drag.h │ ├── Force_Field.cpp │ ├── Force_Field.h │ ├── Force_Spring.cpp │ ├── Force_Spring.h │ ├── Physics.cpp │ ├── Physics.h │ ├── Physics_AF.cpp │ ├── Physics_AF.h │ ├── Physics_Actor.cpp │ ├── Physics_Actor.h │ ├── Physics_Base.cpp │ ├── Physics_Base.h │ ├── Physics_Monster.cpp │ ├── Physics_Monster.h │ ├── Physics_Parametric.cpp │ ├── Physics_Parametric.h │ ├── Physics_Player.cpp │ ├── Physics_Player.h │ ├── Physics_RigidBody.cpp │ ├── Physics_RigidBody.h │ ├── Physics_Static.cpp │ ├── Physics_Static.h │ ├── Physics_StaticMulti.cpp │ ├── Physics_StaticMulti.h │ ├── Push.cpp │ └── Push.h └── script │ ├── Script_Compiler.cpp │ ├── Script_Compiler.h │ ├── Script_Interpreter.cpp │ ├── Script_Interpreter.h │ ├── Script_Program.cpp │ ├── Script_Program.h │ ├── Script_Thread.cpp │ └── Script_Thread.h ├── idlib ├── Base64.cpp ├── Base64.h ├── BitMsg.cpp ├── BitMsg.h ├── CmdArgs.cpp ├── CmdArgs.h ├── Dict.cpp ├── Dict.h ├── Heap.cpp ├── Heap.h ├── LangDict.cpp ├── LangDict.h ├── Lexer.cpp ├── Lexer.h ├── Lib.cpp ├── Lib.h ├── MapFile.cpp ├── MapFile.h ├── Parser.cpp ├── Parser.h ├── Str.cpp ├── Str.h ├── Timer.cpp ├── Timer.h ├── Token.cpp ├── Token.h ├── bv │ ├── Bounds.cpp │ ├── Bounds.h │ ├── Box.cpp │ ├── Box.h │ ├── Frustum.cpp │ ├── Frustum.h │ ├── Sphere.cpp │ └── Sphere.h ├── containers │ ├── BTree.h │ ├── BinSearch.h │ ├── HashIndex.cpp │ ├── HashIndex.h │ ├── HashTable.h │ ├── Hierarchy.h │ ├── LinkList.h │ ├── List.h │ ├── PlaneSet.h │ ├── Queue.h │ ├── Stack.h │ ├── StaticList.h │ ├── StrList.h │ ├── StrPool.h │ └── VectorSet.h ├── geometry │ ├── DrawVert.cpp │ ├── DrawVert.h │ ├── JointTransform.cpp │ ├── JointTransform.h │ ├── Surface.cpp │ ├── Surface.h │ ├── Surface_Patch.cpp │ ├── Surface_Patch.h │ ├── Surface_Polytope.cpp │ ├── Surface_Polytope.h │ ├── Surface_SweptSpline.cpp │ ├── Surface_SweptSpline.h │ ├── TraceModel.cpp │ ├── TraceModel.h │ ├── Winding.cpp │ ├── Winding.h │ ├── Winding2D.cpp │ └── Winding2D.h ├── hashing │ ├── CRC32.cpp │ ├── CRC32.h │ ├── MD4.cpp │ ├── MD4.h │ ├── MD5.cpp │ └── MD5.h └── math │ ├── Angles.cpp │ ├── Angles.h │ ├── Complex.cpp │ ├── Complex.h │ ├── Curve.h │ ├── Extrapolate.h │ ├── Interpolate.h │ ├── Lcp.cpp │ ├── Lcp.h │ ├── Math.cpp │ ├── Math.h │ ├── Matrix.cpp │ ├── Matrix.h │ ├── Ode.cpp │ ├── Ode.h │ ├── Plane.cpp │ ├── Plane.h │ ├── Pluecker.cpp │ ├── Pluecker.h │ ├── Polynomial.cpp │ ├── Polynomial.h │ ├── Quat.cpp │ ├── Quat.h │ ├── Random.h │ ├── Rotation.cpp │ ├── Rotation.h │ ├── Simd.cpp │ ├── Simd.h │ ├── Simd_Generic.cpp │ ├── Simd_Generic.h │ ├── Simd_MMX.cpp │ ├── Simd_MMX.h │ ├── Simd_SSE.cpp │ ├── Simd_SSE.h │ ├── Simd_SSE2.cpp │ ├── Simd_SSE2.h │ ├── Simd_SSE3.cpp │ ├── Simd_SSE3.h │ ├── Vector.cpp │ └── Vector.h ├── renderer ├── Cinematic.cpp ├── Cinematic.h ├── GuiModel.cpp ├── GuiModel.h ├── Image.h ├── Image_files.cpp ├── Image_init.cpp ├── Image_load.cpp ├── Image_process.cpp ├── Image_program.cpp ├── Interaction.cpp ├── Interaction.h ├── Material.cpp ├── Material.h ├── MegaTexture.cpp ├── MegaTexture.h ├── Model.cpp ├── Model.h ├── ModelDecal.cpp ├── ModelDecal.h ├── ModelManager.cpp ├── ModelManager.h ├── ModelOverlay.cpp ├── ModelOverlay.h ├── Model_ase.cpp ├── Model_ase.h ├── Model_beam.cpp ├── Model_liquid.cpp ├── Model_local.h ├── Model_lwo.cpp ├── Model_lwo.h ├── Model_ma.cpp ├── Model_ma.h ├── Model_md3.cpp ├── Model_md3.h ├── Model_md5.cpp ├── Model_prt.cpp ├── Model_sprite.cpp ├── RenderEntity.cpp ├── RenderSystem.cpp ├── RenderSystem.h ├── RenderSystem_init.cpp ├── RenderWorld.cpp ├── RenderWorld.h ├── RenderWorld_demo.cpp ├── RenderWorld_load.cpp ├── RenderWorld_local.h ├── RenderWorld_portals.cpp ├── VertexCache.cpp ├── VertexCache.h ├── draw_common.cpp ├── draw_gles2.cpp ├── glsl │ ├── blendLightShaderVP.cpp │ ├── cubeMapShaderFP.cpp │ ├── diffuseCubeShaderVP.cpp │ ├── diffuseMapShaderFP.cpp │ ├── diffuseMapShaderVP.cpp │ ├── fogShaderFP.cpp │ ├── fogShaderVP.cpp │ ├── glsl_shaders.h │ ├── interactionPhongShaderFP.cpp │ ├── interactionPhongShaderVP.cpp │ ├── interactionShaderFP.cpp │ ├── interactionShaderVP.cpp │ ├── reflectionCubeShaderVP.cpp │ ├── skyboxCubeShaderVP.cpp │ ├── stencilShadowShaderFP.cpp │ ├── stencilShadowShaderVP.cpp │ ├── zfillClipShaderFP.cpp │ ├── zfillClipShaderVP.cpp │ ├── zfillShaderFP.cpp │ └── zfillShaderVP.cpp ├── qgl.h ├── qgl_proc.h ├── tr_backend.cpp ├── tr_deform.cpp ├── tr_font.cpp ├── tr_guisurf.cpp ├── tr_light.cpp ├── tr_lightrun.cpp ├── tr_local.h ├── tr_main.cpp ├── tr_orderIndexes.cpp ├── tr_polytope.cpp ├── tr_render.cpp ├── tr_shadowbounds.cpp ├── tr_stencilshadow.cpp ├── tr_subview.cpp ├── tr_trace.cpp ├── tr_trisurf.cpp └── tr_turboshadow.cpp ├── sound ├── efxlib.h ├── snd_cache.cpp ├── snd_decoder.cpp ├── snd_efxfile.cpp ├── snd_emitter.cpp ├── snd_local.h ├── snd_shader.cpp ├── snd_system.cpp ├── snd_wavefile.cpp ├── snd_world.cpp └── sound.h ├── sys ├── cmake │ ├── FindOGG.cmake │ ├── FindSDL2.cmake │ ├── FindVorbis.cmake │ └── FindVorbisFile.cmake ├── cpu.cpp ├── doom_icon.h ├── events.cpp ├── glimp.cpp ├── linux │ └── main.cpp ├── platform.h ├── posix │ ├── posix_main.cpp │ ├── posix_net.cpp │ └── posix_public.h ├── sys_local.cpp ├── sys_local.h ├── sys_public.h ├── threads.cpp └── wasm │ ├── asyncify.json │ ├── asyncify.win.json │ ├── package_chunked_demo_data.bat │ ├── package_chunked_demo_data.sh │ ├── package_demo_data.bat │ ├── package_demo_data.sh │ ├── post-chunked.js │ ├── pre-chunked.js │ ├── pre.js │ └── shell.html ├── tools └── compilers │ └── aas │ ├── AASBuild.cpp │ ├── AASBuild_file.cpp │ ├── AASBuild_gravity.cpp │ ├── AASBuild_ledge.cpp │ ├── AASBuild_local.h │ ├── AASBuild_merge.cpp │ ├── AASCluster.cpp │ ├── AASCluster.h │ ├── AASFile.cpp │ ├── AASFile.h │ ├── AASFileManager.cpp │ ├── AASFileManager.h │ ├── AASFile_local.h │ ├── AASFile_optimize.cpp │ ├── AASFile_sample.cpp │ ├── AASReach.cpp │ ├── AASReach.h │ ├── Brush.cpp │ ├── Brush.h │ ├── BrushBSP.cpp │ └── BrushBSP.h └── ui ├── BindWindow.cpp ├── BindWindow.h ├── ChoiceWindow.cpp ├── ChoiceWindow.h ├── DeviceContext.cpp ├── DeviceContext.h ├── EditWindow.cpp ├── EditWindow.h ├── FieldWindow.cpp ├── FieldWindow.h ├── GameBearShootWindow.cpp ├── GameBearShootWindow.h ├── GameBustOutWindow.cpp ├── GameBustOutWindow.h ├── GameSSDWindow.cpp ├── GameSSDWindow.h ├── GameWindow.cpp ├── GameWindow.h ├── GuiScript.cpp ├── GuiScript.h ├── ListGUI.cpp ├── ListGUI.h ├── ListGUILocal.h ├── ListWindow.cpp ├── ListWindow.h ├── MarkerWindow.cpp ├── MarkerWindow.h ├── Rectangle.h ├── RegExp.cpp ├── RegExp.h ├── RegExp_old.h ├── RenderWindow.cpp ├── RenderWindow.h ├── SimpleWindow.cpp ├── SimpleWindow.h ├── SliderWindow.cpp ├── SliderWindow.h ├── UserInterface.cpp ├── UserInterface.h ├── UserInterfaceLocal.h ├── Window.cpp ├── Window.h ├── Winvar.cpp └── Winvar.h /.gitignore: -------------------------------------------------------------------------------- 1 | /build* 2 | /cmake-build* 3 | /neo/cmake-build* 4 | *~ 5 | .*.swp 6 | *.pyc 7 | .cproject 8 | .project 9 | .settings/ 10 | .idea/ 11 | -------------------------------------------------------------------------------- /BUILD.md: -------------------------------------------------------------------------------- 1 | 2 | # Building on Ubuntu 18.04 3 | 4 | #### 1) Install Emscripten 5 | a) Get the Emscripten SDK and install Emscripten "upstream" variant: 6 | ``` 7 | git clone https://github.com/emscripten-core/emsdk.git 8 | ./emsdk/emsdk install latest-upstream 9 | ./emsdk/emsdk activate latest-upstream 10 | ``` 11 | b) Enable Emscripten tools from the command line 12 | ``` 13 | source ./emsdk/emsdk_env.sh 14 | ``` 15 | 16 | #### 2) Build d3wasm 17 | a) Get d3wasm source code 18 | ``` 19 | git clone https://github.com/gabrielcuvillier/d3wasm.git 20 | cd d3wasm 21 | ``` 22 | b) Build the project 23 | ``` 24 | mkdir build-wasm 25 | cd build-wasm 26 | emcmake cmake ../neo -DCMAKE_BUILD_TYPE=Release 27 | emmake make 28 | ``` 29 | Normaly, this should have generated *d3wasm.html*, *d3wasm.js*, and *d3wasm.wasm* files. 30 | 31 | #### 4) Package the game demo data 32 | a) Get the Doom 3 Demo from Fileplanet (or other sources): https://www.fileplanet.com/archive/p-15998/DOOM-3-Demo 33 | 34 | b) Install the Demo (using wine on Linux) 35 | 36 | c) Copy __/demo/demo00.pk4__ to __/build-wasm/data/demo__ folder 37 | 38 | d) Package the data using the *package_demo_data* cmake target 39 | ``` 40 | make package_demo_data 41 | ``` 42 | Normally, this should have generated *demo00.data* and *demo00.js* files 43 | 44 | #### 5) Deploy locally 45 | a) Run a local web server from the build directory. The simplest is to use python SimpleHTTPServer: 46 | ``` 47 | python -m SimpleHTTPServer 8080 48 | ``` 49 | or (python 3) 50 | ``` 51 | python -m http.server 8080 52 | ``` 53 | b) open your favorite Browser to http://localhost:8080/d3wasm.html 54 | 55 | #### 6) Enjoy! 56 | 57 | **NB**: it is possible to do a native build also, to compare the performance for example. 58 | To do so: 59 | ``` 60 | mkdir build-native 61 | cd build-native 62 | cmake ../neo -DCMAKE_BUILD_TYPE=Release 63 | make 64 | ``` 65 | Packaging the data works differently for native builds. Have a look at https://github.com/dhewm/dhewm3/wiki/FAQ 66 | 67 | # Building on Windows 10 68 | 69 | While it is possible to build using the Windows version of Emscripten toolchain, it is a bit more tedious to do (require to manually install Windows version of Cmake, GNU Make or Ninja, and setup environment paths). 70 | 71 | A simpler way is to use **WSL** (*Windows Subsystem for Linux*) with Ubuntu 18.04 installed: the instructions are then exactly the same as the Ubuntu build. Nice! 72 | -------------------------------------------------------------------------------- /COPYING.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gabrielcuvillier/d3wasm/48f8f65d1216db3ee0b11872bb3b413febadc669/COPYING.txt -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ABOUT 2 | 3 | _d3wasm_ is a port of the Doom 3 video game to WebAssembly, with a full WebGL renderer backend. 4 | 5 | The goal of _d3wasm_ is to demonstrate the power of WebAssembly, while bringing the idTech4 engine to the web. 6 | 7 | Full technical details and online demonstration here: 8 | 9 | http://www.continuation-labs.com/projects/d3wasm/ 10 | 11 | See BUILD.md for build instructions. 12 | 13 | Enjoy! -------------------------------------------------------------------------------- /neo/cm/CollisionModel_contacts.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | /* 30 | =============================================================================== 31 | 32 | Trace model vs. polygonal model collision detection. 33 | 34 | =============================================================================== 35 | */ 36 | 37 | #include "sys/platform.h" 38 | 39 | #include "cm/CollisionModel_local.h" 40 | 41 | /* 42 | =============================================================================== 43 | 44 | Retrieving contacts 45 | 46 | =============================================================================== 47 | */ 48 | 49 | /* 50 | ================== 51 | idCollisionModelManagerLocal::Contacts 52 | ================== 53 | */ 54 | int idCollisionModelManagerLocal::Contacts( contactInfo_t *contacts, const int maxContacts, const idVec3 &start, const idVec6 &dir, const float depth, 55 | const idTraceModel *trm, const idMat3 &trmAxis, int contentMask, 56 | cmHandle_t model, const idVec3 &origin, const idMat3 &modelAxis ) { 57 | trace_t results; 58 | idVec3 end; 59 | 60 | // same as Translation but instead of storing the first collision we store all collisions as contacts 61 | idCollisionModelManagerLocal::getContacts = true; 62 | idCollisionModelManagerLocal::contacts = contacts; 63 | idCollisionModelManagerLocal::maxContacts = maxContacts; 64 | idCollisionModelManagerLocal::numContacts = 0; 65 | end = start + dir.SubVec3(0) * depth; 66 | idCollisionModelManagerLocal::Translation( &results, start, end, trm, trmAxis, contentMask, model, origin, modelAxis ); 67 | if ( dir.SubVec3(1).LengthSqr() != 0.0f ) { 68 | // FIXME: rotational contacts 69 | } 70 | idCollisionModelManagerLocal::getContacts = false; 71 | idCollisionModelManagerLocal::maxContacts = 0; 72 | 73 | return idCollisionModelManagerLocal::numContacts; 74 | } 75 | -------------------------------------------------------------------------------- /neo/config.h.in: -------------------------------------------------------------------------------- 1 | #ifndef __DOOM3_CONFIG_H__ 2 | #define __DOOM3_CONFIG_H__ 3 | 4 | #define BUILD_OS "@os@" 5 | #define BUILD_CPU "@cpu@" 6 | 7 | #define BUILD_LIBRARY_SUFFIX "@CMAKE_SHARED_LIBRARY_SUFFIX@" 8 | 9 | #define BUILD_LIBDIR "@libdir@" 10 | #define BUILD_DATADIR "@datadir@" 11 | 12 | #cmakedefine HAVE_JPEG_MEM_SRC 13 | 14 | #cmakedefine ID_ENABLE_CURL 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /neo/framework/BuildVersion.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | const int BUILD_NUMBER = 19040; 29 | -------------------------------------------------------------------------------- /neo/framework/Console.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __CONSOLE_H__ 30 | #define __CONSOLE_H__ 31 | 32 | #include "framework/Session.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | The console is strictly for development and advanced users. It should 38 | never be used to convey actual game information to the user, which should 39 | always be done through a GUI. 40 | 41 | The force options are for the editor console display window, which 42 | doesn't respond to pull up / pull down 43 | 44 | =============================================================================== 45 | */ 46 | 47 | class idConsole { 48 | public: 49 | virtual ~idConsole( void ) {} 50 | 51 | virtual void Init( void ) = 0; 52 | virtual void Shutdown( void ) = 0; 53 | 54 | // can't be combined with Init, because Init happens before renderer is started 55 | virtual void LoadGraphics() = 0; 56 | 57 | virtual bool ProcessEvent( const sysEvent_t *event, bool forceAccept ) = 0; 58 | 59 | // the system code can release the mouse pointer when the console is active 60 | virtual bool Active( void ) = 0; 61 | 62 | // clear the timers on any recent prints that are displayed in the notify lines 63 | virtual void ClearNotifyLines( void ) = 0; 64 | 65 | // some console commands, like timeDemo, will force the console closed before they start 66 | virtual void Close( void ) = 0; 67 | 68 | virtual void Draw( bool forceFullScreen ) = 0; 69 | virtual void Print( const char *text ) = 0; 70 | 71 | virtual void SaveHistory() = 0; 72 | virtual void LoadHistory() = 0; 73 | }; 74 | 75 | extern idConsole * console; // statically initialized to an idConsoleLocal 76 | 77 | #endif /* !__CONSOLE_H__ */ 78 | -------------------------------------------------------------------------------- /neo/framework/DeclEntityDef.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __DECLENTITYDEF_H__ 30 | #define __DECLENTITYDEF_H__ 31 | 32 | #include "idlib/Dict.h" 33 | #include "framework/DeclManager.h" 34 | 35 | /* 36 | =============================================================================== 37 | 38 | idDeclEntityDef 39 | 40 | =============================================================================== 41 | */ 42 | 43 | class idDeclEntityDef : public idDecl { 44 | public: 45 | idDict dict; 46 | 47 | virtual size_t Size( void ) const; 48 | virtual const char * DefaultDefinition() const; 49 | virtual bool Parse( const char *text, const int textLength ); 50 | virtual void FreeData( void ); 51 | virtual void Print( void ) const; 52 | }; 53 | 54 | #endif /* !__DECLENTITYDEF_H__ */ 55 | -------------------------------------------------------------------------------- /neo/framework/DeclSkin.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __DECLSKIN_H__ 30 | #define __DECLSKIN_H__ 31 | 32 | #include "idlib/containers/StrList.h" 33 | #include "framework/DeclManager.h" 34 | #include "renderer/Material.h" 35 | 36 | /* 37 | =============================================================================== 38 | 39 | idDeclSkin 40 | 41 | =============================================================================== 42 | */ 43 | 44 | typedef struct { 45 | const idMaterial * from; // 0 == any unmatched shader 46 | const idMaterial * to; 47 | } skinMapping_t; 48 | 49 | class idDeclSkin : public idDecl { 50 | public: 51 | virtual size_t Size( void ) const; 52 | virtual bool SetDefaultText( void ); 53 | virtual const char * DefaultDefinition( void ) const; 54 | virtual bool Parse( const char *text, const int textLength ); 55 | virtual void FreeData( void ); 56 | 57 | const idMaterial * RemapShaderBySkin( const idMaterial *shader ) const; 58 | 59 | // model associations are just for the preview dialog in the editor 60 | const int GetNumModelAssociations() const; 61 | const char * GetAssociatedModel( int index ) const; 62 | 63 | private: 64 | idList mappings; 65 | idStrList associatedModels; 66 | }; 67 | 68 | #endif /* !__DECLSKIN_H__ */ 69 | -------------------------------------------------------------------------------- /neo/framework/DeclTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __DECLTABLE_H__ 30 | #define __DECLTABLE_H__ 31 | 32 | #include "idlib/containers/List.h" 33 | #include "framework/DeclManager.h" 34 | 35 | /* 36 | =============================================================================== 37 | 38 | tables are used to map a floating point input value to a floating point 39 | output value, with optional wrap / clamp and interpolation 40 | 41 | =============================================================================== 42 | */ 43 | 44 | class idDeclTable : public idDecl { 45 | public: 46 | virtual size_t Size( void ) const; 47 | virtual const char * DefaultDefinition( void ) const; 48 | virtual bool Parse( const char *text, const int textLength ); 49 | virtual void FreeData( void ); 50 | 51 | float TableLookup( float index ) const; 52 | 53 | private: 54 | bool clamp; 55 | bool snap; 56 | idList values; 57 | }; 58 | 59 | #endif /* !__DECLTABLE_H__ */ 60 | -------------------------------------------------------------------------------- /neo/framework/DemoChecksum.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | /* 30 | =============================================================================== 31 | 32 | Pak file checksum for demo build. 33 | 34 | =============================================================================== 35 | */ 36 | 37 | // every time a new demo pk4 file is built, this checksum must be updated. 38 | // the easiest way to get it is to just run the game and see what it spits out 39 | #define DEMO_PAK_CHECKSUM 0xfe75bbef 40 | -------------------------------------------------------------------------------- /neo/framework/DemoFile.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __DEMOFILE_H__ 30 | #define __DEMOFILE_H__ 31 | 32 | #include "framework/File.h" 33 | #include "framework/Compressor.h" 34 | 35 | class idRenderWorld; 36 | 37 | /* 38 | =============================================================================== 39 | 40 | Demo file 41 | 42 | =============================================================================== 43 | */ 44 | 45 | typedef enum { 46 | DS_FINISHED, 47 | DS_RENDER, 48 | DS_SOUND, 49 | DS_VERSION 50 | } demoSystem_t; 51 | 52 | class idDemoFile : public idFile { 53 | public: 54 | idDemoFile(); 55 | ~idDemoFile(); 56 | 57 | const char * GetName( void ) { return (f?f->GetName():""); } 58 | const char * GetFullPath( void ) { return (f?f->GetFullPath():""); } 59 | 60 | void SetLog( bool b, const char *p ); 61 | void Log( const char *p ); 62 | bool OpenForReading( const char *fileName ); 63 | bool OpenForWriting( const char *fileName ); 64 | void Close(); 65 | 66 | const char * ReadHashString(); 67 | void WriteHashString( const char *str ); 68 | 69 | void ReadDict( idDict &dict ); 70 | void WriteDict( const idDict &dict ); 71 | 72 | int Read( void *buffer, int len ); 73 | int Write( const void *buffer, int len ); 74 | 75 | private: 76 | static idCompressor *AllocCompressor( int type ); 77 | 78 | bool writing; 79 | byte * fileImage; 80 | idFile * f; 81 | idCompressor * compressor; 82 | 83 | idList demoStrings; 84 | idFile * fLog; 85 | bool log; 86 | idStr logStr; 87 | 88 | static idCVar com_logDemos; 89 | static idCVar com_compressDemos; 90 | static idCVar com_preloadDemos; 91 | }; 92 | 93 | #endif /* !__DEMOFILE_H__ */ 94 | -------------------------------------------------------------------------------- /neo/framework/EditField.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __EDITFIELD_H__ 30 | #define __EDITFIELD_H__ 31 | 32 | #include "renderer/Material.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Edit field 38 | 39 | =============================================================================== 40 | */ 41 | 42 | const int MAX_EDIT_LINE = 256; 43 | 44 | typedef struct autoComplete_s { 45 | bool valid; 46 | int length; 47 | char completionString[MAX_EDIT_LINE]; 48 | char currentMatch[MAX_EDIT_LINE]; 49 | int matchCount; 50 | int matchIndex; 51 | int findMatchIndex; 52 | } autoComplete_t; 53 | 54 | class idEditField { 55 | public: 56 | idEditField(); 57 | ~idEditField(); 58 | 59 | void Clear( void ); 60 | void SetWidthInChars( int w ); 61 | void SetCursor( int c ); 62 | int GetCursor( void ) const; 63 | void ClearAutoComplete( void ); 64 | int GetAutoCompleteLength( void ) const; 65 | void AutoComplete( void ); 66 | void CharEvent( int c ); 67 | void KeyDownEvent( int key ); 68 | void Paste( void ); 69 | char * GetBuffer( void ); 70 | void Draw( int x, int y, int width, bool showCursor, const idMaterial *material ); 71 | void SetBuffer( const char *buffer ); 72 | 73 | private: 74 | int cursor; 75 | int scroll; 76 | int widthInChars; 77 | char buffer[MAX_EDIT_LINE]; 78 | autoComplete_t autoComplete; 79 | }; 80 | 81 | #endif /* !__EDITFIELD_H__ */ 82 | -------------------------------------------------------------------------------- /neo/framework/GameCallbacks_local.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | Copyright (C) 2018 Daniel Gibson 7 | 8 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 9 | 10 | Doom 3 Source Code is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | 15 | Doom 3 Source Code is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with Doom 3 Source Code. If not, see . 22 | 23 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 24 | 25 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 26 | 27 | =========================================================================== 28 | */ 29 | 30 | // Implementation details for idCommon::SetCallback() and idCommon::GetAdditionalFunction() 31 | // Needed in different parts of the Engine (that are supposed to call the callbacks) 32 | // but *not* part of the Game API exported to Game DLLs. 33 | // Common.h (above idCommon::SetCallback()) has a lengthy explanation of what all this is good for.. 34 | 35 | #ifndef NEO_FRAMEWORK_GAMECALLBACKS_LOCAL_H_ 36 | #define NEO_FRAMEWORK_GAMECALLBACKS_LOCAL_H_ 37 | 38 | #include "Common.h" 39 | 40 | struct idGameCallbacks { 41 | 42 | typedef void (*ReloadImagesCallback)(void* userArg, const idCmdArgs &args); 43 | ReloadImagesCallback reloadImagesCB; 44 | void* reloadImagesUserArg; 45 | 46 | 47 | idGameCallbacks(); 48 | 49 | // called when Game DLL is unloaded (=> the registered callbacks become invalid) 50 | void Reset(); 51 | 52 | }; 53 | 54 | extern idGameCallbacks gameCallbacks; 55 | 56 | 57 | #endif /* NEO_FRAMEWORK_GAMECALLBACKS_LOCAL_H_ */ 58 | -------------------------------------------------------------------------------- /neo/framework/Unzip.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __UNZIP_H__ 30 | #define __UNZIP_H__ 31 | 32 | #include "framework/minizip/unzip.h" 33 | 34 | // everything that was here is now in unzip.h (most of it was there originally anyway, 35 | // the three custom functions added by id Software were added there) 36 | 37 | #endif /* __UNZIP_H__ */ 38 | -------------------------------------------------------------------------------- /neo/framework/async/NetworkSystem.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __NETWORKSYSTEM_H__ 30 | #define __NETWORKSYSTEM_H__ 31 | 32 | #include "idlib/BitMsg.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Network System. 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idNetworkSystem { 43 | public: 44 | virtual ~idNetworkSystem( void ) {} 45 | 46 | virtual void ServerSendReliableMessage( int clientNum, const idBitMsg &msg ); 47 | virtual void ServerSendReliableMessageExcluding( int clientNum, const idBitMsg &msg ); 48 | virtual int ServerGetClientPing( int clientNum ); 49 | virtual int ServerGetClientPrediction( int clientNum ); 50 | virtual int ServerGetClientTimeSinceLastPacket( int clientNum ); 51 | virtual int ServerGetClientTimeSinceLastInput( int clientNum ); 52 | virtual int ServerGetClientOutgoingRate( int clientNum ); 53 | virtual int ServerGetClientIncomingRate( int clientNum ); 54 | virtual float ServerGetClientIncomingPacketLoss( int clientNum ); 55 | 56 | virtual void ClientSendReliableMessage( const idBitMsg &msg ); 57 | virtual int ClientGetPrediction( void ); 58 | virtual int ClientGetTimeSinceLastPacket( void ); 59 | virtual int ClientGetOutgoingRate( void ); 60 | virtual int ClientGetIncomingRate( void ); 61 | virtual float ClientGetIncomingPacketLoss( void ); 62 | }; 63 | 64 | extern idNetworkSystem * networkSystem; 65 | 66 | #endif /* !__NETWORKSYSTEM_H__ */ 67 | -------------------------------------------------------------------------------- /neo/game/EndLevel.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAME_ENDLEVEL_H__ 30 | #define __GAME_ENDLEVEL_H__ 31 | 32 | #include "Entity.h" 33 | 34 | class idTarget_EndLevel : public idEntity { 35 | public: 36 | CLASS_PROTOTYPE( idTarget_EndLevel ); 37 | 38 | void Spawn( void ); 39 | ~idTarget_EndLevel(); 40 | 41 | void Draw(); 42 | // the endLevel will be responsible for drawing the entire screen 43 | // when it is active 44 | 45 | void PlayerCommand( int buttons ); 46 | // when an endlevel is active, plauer buttons get sent here instead 47 | // of doing anything to the player, which will allow moving to 48 | // the next level 49 | 50 | const char *ExitCommand(); 51 | // the game will check this each frame, and return it to the 52 | // session when there is something to give 53 | 54 | private: 55 | idStr exitCommand; 56 | 57 | idVec3 initialViewOrg; 58 | idVec3 initialViewAngles; 59 | // set when the player triggers the exit 60 | 61 | idUserInterface *gui; 62 | 63 | bool buttonsReleased; 64 | // don't skip out until buttons are released, then pressed 65 | 66 | bool readyToExit; 67 | bool noGui; 68 | 69 | void Event_Trigger( idEntity *activator ); 70 | }; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /neo/game/PlayerIcon.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __PLAYERICON_H__ 30 | #define __PLAYERICON_H__ 31 | 32 | typedef enum { 33 | ICON_LAG, 34 | ICON_CHAT, 35 | ICON_NONE 36 | } playerIconType_t; 37 | 38 | class idPlayerIcon { 39 | public: 40 | 41 | public: 42 | idPlayerIcon(); 43 | ~idPlayerIcon(); 44 | 45 | void Draw( idPlayer *player, jointHandle_t joint ); 46 | void Draw( idPlayer *player, const idVec3 &origin ); 47 | 48 | public: 49 | playerIconType_t iconType; 50 | renderEntity_t renderEnt; 51 | qhandle_t iconHandle; 52 | 53 | public: 54 | void FreeIcon( void ); 55 | bool CreateIcon( idPlayer* player, playerIconType_t type, const char *mtr, const idVec3 &origin, const idMat3 &axis ); 56 | bool CreateIcon( idPlayer* player, playerIconType_t type, const idVec3 &origin, const idMat3 &axis ); 57 | void UpdateIcon( idPlayer* player, const idVec3 &origin, const idMat3 &axis ); 58 | 59 | }; 60 | 61 | 62 | #endif /* !_PLAYERICON_H_ */ 63 | -------------------------------------------------------------------------------- /neo/game/Sound.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAME_SOUND_H__ 30 | #define __GAME_SOUND_H__ 31 | 32 | #include "Entity.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Generic sound emitter. 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idSound : public idEntity { 43 | public: 44 | CLASS_PROTOTYPE( idSound ); 45 | 46 | idSound( void ); 47 | 48 | void Save( idSaveGame *savefile ) const; 49 | void Restore( idRestoreGame *savefile ); 50 | 51 | virtual void UpdateChangeableSpawnArgs( const idDict *source ); 52 | 53 | void Spawn( void ); 54 | 55 | void ToggleOnOff( idEntity *other, idEntity *activator ); 56 | void Think( void ); 57 | void SetSound( const char *sound, int channel = SND_CHANNEL_ANY ); 58 | 59 | virtual void ShowEditingDialog( void ); 60 | 61 | private: 62 | float lastSoundVol; 63 | float soundVol; 64 | float random; 65 | float wait; 66 | bool timerOn; 67 | idVec3 shakeTranslate; 68 | idAngles shakeRotate; 69 | int playingUntilTime; 70 | 71 | void Event_Trigger( idEntity *activator ); 72 | void Event_Timer( void ); 73 | void Event_On( void ); 74 | void Event_Off( void ); 75 | void DoSound( bool play ); 76 | }; 77 | 78 | #endif /* !__GAME_SOUND_H__ */ 79 | -------------------------------------------------------------------------------- /neo/game/WorldSpawn.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAME_WORLDSPAWN_H__ 30 | #define __GAME_WORLDSPAWN_H__ 31 | 32 | #include "Entity.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | World entity. 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idWorldspawn : public idEntity { 43 | public: 44 | CLASS_PROTOTYPE( idWorldspawn ); 45 | 46 | ~idWorldspawn(); 47 | 48 | void Spawn( void ); 49 | 50 | void Save( idRestoreGame *savefile ); 51 | void Restore( idRestoreGame *savefile ); 52 | 53 | private: 54 | void Event_Remove( void ); 55 | }; 56 | 57 | #endif /* !__GAME_WORLDSPAWN_H__ */ 58 | -------------------------------------------------------------------------------- /neo/game/gamesys/DebugGraph.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | #include "Player.h" 31 | #include "Game_local.h" 32 | 33 | #include "DebugGraph.h" 34 | 35 | /* 36 | ================ 37 | idDebugGraph::idDebugGraph 38 | ================ 39 | */ 40 | idDebugGraph::idDebugGraph() { 41 | index = 0; 42 | } 43 | 44 | /* 45 | ================ 46 | idDebugGraph::SetNumSamples 47 | ================ 48 | */ 49 | void idDebugGraph::SetNumSamples( int num ) { 50 | index = 0; 51 | samples.Clear(); 52 | samples.SetNum( num ); 53 | memset( samples.Ptr(), 0, samples.MemoryUsed() ); 54 | } 55 | 56 | /* 57 | ================ 58 | idDebugGraph::AddValue 59 | ================ 60 | */ 61 | void idDebugGraph::AddValue( float value ) { 62 | samples[ index ] = value; 63 | index++; 64 | if ( index >= samples.Num() ) { 65 | index = 0; 66 | } 67 | } 68 | 69 | /* 70 | ================ 71 | idDebugGraph::Draw 72 | ================ 73 | */ 74 | void idDebugGraph::Draw( const idVec4 &color, float scale ) const { 75 | int i; 76 | float value1; 77 | float value2; 78 | idVec3 vec1; 79 | idVec3 vec2; 80 | 81 | const idMat3 &axis = gameLocal.GetLocalPlayer()->viewAxis; 82 | const idVec3 pos = gameLocal.GetLocalPlayer()->GetPhysics()->GetOrigin() + axis[ 1 ] * samples.Num() * 0.5f; 83 | 84 | value1 = samples[ index ] * scale; 85 | for( i = 1; i < samples.Num(); i++ ) { 86 | value2 = samples[ ( i + index ) % samples.Num() ] * scale; 87 | 88 | vec1 = pos + axis[ 2 ] * value1 - axis[ 1 ] * ( i - 1 ) + axis[ 0 ] * samples.Num(); 89 | vec2 = pos + axis[ 2 ] * value2 - axis[ 1 ] * i + axis[ 0 ] * samples.Num(); 90 | 91 | gameRenderWorld->DebugLine( color, vec1, vec2, gameLocal.msec, false ); 92 | value1 = value2; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /neo/game/gamesys/DebugGraph.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __DEBUGGRAPH_H__ 30 | #define __DEBUGGRAPH_H__ 31 | 32 | #include "idlib/containers/List.h" 33 | #include "idlib/math/Vector.h" 34 | 35 | class idDebugGraph { 36 | public: 37 | idDebugGraph(); 38 | void SetNumSamples( int num ); 39 | void AddValue( float value ); 40 | void Draw( const idVec4 &color, float scale ) const; 41 | 42 | private: 43 | idList samples; 44 | int index; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /neo/game/gamesys/NoGameTypeInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAMETYPEINFO_H__ 30 | #define __GAMETYPEINFO_H__ 31 | 32 | /* 33 | =================================================================================== 34 | 35 | This file has been generated with the Type Info Generator v1.0 (c) 2004 id Software 36 | 37 | =================================================================================== 38 | */ 39 | 40 | typedef struct { 41 | const char * name; 42 | const char * type; 43 | const char * value; 44 | } constantInfo_t; 45 | 46 | typedef struct { 47 | const char * name; 48 | int value; 49 | } enumValueInfo_t; 50 | 51 | typedef struct { 52 | const char * typeName; 53 | const enumValueInfo_t * values; 54 | } enumTypeInfo_t; 55 | 56 | typedef struct { 57 | const char * type; 58 | const char * name; 59 | int offset; 60 | int size; 61 | } classVariableInfo_t; 62 | 63 | typedef struct { 64 | const char * typeName; 65 | const char * superType; 66 | int size; 67 | const classVariableInfo_t * variables; 68 | } classTypeInfo_t; 69 | 70 | 71 | static enumTypeInfo_t enumTypeInfo[] = { 72 | { NULL, NULL } 73 | }; 74 | 75 | static classTypeInfo_t classTypeInfo[] = { 76 | { NULL, NULL, 0, NULL } 77 | }; 78 | 79 | #endif /* !__GAMETYPEINFO_H__ */ 80 | -------------------------------------------------------------------------------- /neo/game/gamesys/SysCmds.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __SYS_CMDS_H__ 30 | #define __SYS_CMDS_H__ 31 | 32 | void D_DrawDebugLines( void ); 33 | 34 | #endif /* !__SYS_CMDS_H__ */ 35 | -------------------------------------------------------------------------------- /neo/game/gamesys/TypeInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __SYS_TYPEINFO_H__ 30 | #define __SYS_TYPEINFO_H__ 31 | 32 | #include "idlib/CmdArgs.h" 33 | 34 | class idFile; 35 | 36 | /* 37 | =================================================================================== 38 | 39 | Game Type Info 40 | 41 | =================================================================================== 42 | */ 43 | 44 | const char * GetTypeVariableName( const char *typeName, int offset ); 45 | 46 | void PrintType( const void *typePtr, const char *typeName ); 47 | void WriteTypeToFile( idFile *fp, const void *typePtr, const char *typeName ); 48 | void InitTypeVariables( const void *typePtr, const char *typeName, int value ); 49 | 50 | void ListTypeInfo_f( const idCmdArgs &args ); 51 | 52 | void WriteGameState_f( const idCmdArgs &args ); 53 | void CompareGameState_f( const idCmdArgs &args ); 54 | //void TestSaveGame_f( const idCmdArgs &args ); 55 | 56 | #endif /* !__SYS_TYPEINFO_H__ */ 57 | -------------------------------------------------------------------------------- /neo/game/physics/Force.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | 31 | #include "physics/Force.h" 32 | 33 | CLASS_DECLARATION( idClass, idForce ) 34 | END_CLASS 35 | 36 | idList idForce::forceList; 37 | 38 | /* 39 | ================ 40 | idForce::idForce 41 | ================ 42 | */ 43 | idForce::idForce( void ) { 44 | forceList.Append( this ); 45 | } 46 | 47 | /* 48 | ================ 49 | idForce::~idForce 50 | ================ 51 | */ 52 | idForce::~idForce( void ) { 53 | forceList.Remove( this ); 54 | } 55 | 56 | /* 57 | ================ 58 | idForce::DeletePhysics 59 | ================ 60 | */ 61 | void idForce::DeletePhysics( const idPhysics *phys ) { 62 | int i; 63 | 64 | for ( i = 0; i < forceList.Num(); i++ ) { 65 | forceList[i]->RemovePhysics( phys ); 66 | } 67 | } 68 | 69 | /* 70 | ================ 71 | idForce::ClearForceList 72 | ================ 73 | */ 74 | void idForce::ClearForceList( void ) { 75 | forceList.Clear(); 76 | } 77 | 78 | /* 79 | ================ 80 | idForce::Evaluate 81 | ================ 82 | */ 83 | void idForce::Evaluate( int time ) { 84 | } 85 | 86 | /* 87 | ================ 88 | idForce::RemovePhysics 89 | ================ 90 | */ 91 | void idForce::RemovePhysics( const idPhysics *phys ) { 92 | } 93 | -------------------------------------------------------------------------------- /neo/game/physics/Force.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_H__ 30 | #define __FORCE_H__ 31 | 32 | #include "gamesys/Class.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Force base class 38 | 39 | A force object applies a force to a physics object. 40 | 41 | =============================================================================== 42 | */ 43 | 44 | class idEntity; 45 | class idPhysics; 46 | 47 | class idForce : public idClass { 48 | 49 | public: 50 | CLASS_PROTOTYPE( idForce ); 51 | 52 | idForce( void ); 53 | virtual ~idForce( void ); 54 | static void DeletePhysics( const idPhysics *phys ); 55 | static void ClearForceList( void ); 56 | 57 | public: // common force interface 58 | // evalulate the force up to the given time 59 | virtual void Evaluate( int time ); 60 | // removes any pointers to the physics object 61 | virtual void RemovePhysics( const idPhysics *phys ); 62 | 63 | private: 64 | 65 | static idList forceList; 66 | }; 67 | 68 | #endif /* !__FORCE_H__ */ 69 | -------------------------------------------------------------------------------- /neo/game/physics/Force_Constant.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_CONSTANT_H__ 30 | #define __FORCE_CONSTANT_H__ 31 | 32 | #include "physics/Force.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Constant force 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idForce_Constant : public idForce { 43 | 44 | public: 45 | CLASS_PROTOTYPE( idForce_Constant ); 46 | 47 | idForce_Constant( void ); 48 | virtual ~idForce_Constant( void ); 49 | 50 | 51 | void Save( idSaveGame *savefile ) const; 52 | void Restore( idRestoreGame *savefile ); 53 | 54 | // constant force 55 | void SetForce( const idVec3 &force ); 56 | // set force position 57 | void SetPosition( idPhysics *physics, int id, const idVec3 &point ); 58 | 59 | void SetPhysics( idPhysics *physics ); 60 | 61 | public: // common force interface 62 | virtual void Evaluate( int time ); 63 | virtual void RemovePhysics( const idPhysics *phys ); 64 | 65 | private: 66 | // force properties 67 | idVec3 force; 68 | idPhysics * physics; 69 | int id; 70 | idVec3 point; 71 | }; 72 | 73 | #endif /* !__FORCE_CONSTANT_H__ */ 74 | -------------------------------------------------------------------------------- /neo/game/physics/Force_Drag.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_DRAG_H__ 30 | #define __FORCE_DRAG_H__ 31 | 32 | #include "physics/Force.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Drag force 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idForce_Drag : public idForce { 43 | 44 | public: 45 | CLASS_PROTOTYPE( idForce_Drag ); 46 | 47 | idForce_Drag( void ); 48 | virtual ~idForce_Drag( void ); 49 | // initialize the drag force 50 | void Init( float damping ); 51 | // set physics object being dragged 52 | void SetPhysics( idPhysics *physics, int id, const idVec3 &p ); 53 | // set position to drag towards 54 | void SetDragPosition( const idVec3 &pos ); 55 | // get the position dragged towards 56 | const idVec3 & GetDragPosition( void ) const; 57 | // get the position on the dragged physics object 58 | const idVec3 GetDraggedPosition( void ) const; 59 | 60 | public: // common force interface 61 | virtual void Evaluate( int time ); 62 | virtual void RemovePhysics( const idPhysics *phys ); 63 | 64 | private: 65 | 66 | // properties 67 | float damping; 68 | 69 | // positioning 70 | idPhysics * physics; // physics object 71 | int id; // clip model id of physics object 72 | idVec3 p; // position on clip model 73 | idVec3 dragPosition; // drag towards this position 74 | }; 75 | 76 | #endif /* !__FORCE_DRAG_H__ */ 77 | -------------------------------------------------------------------------------- /neo/game/physics/Force_Spring.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __FORCE_SPRING_H__ 30 | #define __FORCE_SPRING_H__ 31 | 32 | #include "physics/Force.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Spring force 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idForce_Spring : public idForce { 43 | 44 | public: 45 | CLASS_PROTOTYPE( idForce_Spring ); 46 | 47 | idForce_Spring( void ); 48 | virtual ~idForce_Spring( void ); 49 | // initialize the spring 50 | void InitSpring( float Kstretch, float Kcompress, float damping, float restLength ); 51 | // set the entities and positions on these entities the spring is attached to 52 | void SetPosition( idPhysics *physics1, int id1, const idVec3 &p1, 53 | idPhysics *physics2, int id2, const idVec3 &p2 ); 54 | 55 | public: // common force interface 56 | virtual void Evaluate( int time ); 57 | virtual void RemovePhysics( const idPhysics *phys ); 58 | 59 | private: 60 | 61 | // spring properties 62 | float Kstretch; 63 | float Kcompress; 64 | float damping; 65 | float restLength; 66 | 67 | // positioning 68 | idPhysics * physics1; // first physics object 69 | int id1; // clip model id of first physics object 70 | idVec3 p1; // position on clip model 71 | idPhysics * physics2; // second physics object 72 | int id2; // clip model id of second physics object 73 | idVec3 p2; // position on clip model 74 | 75 | }; 76 | 77 | #endif /* !__FORCE_SPRING_H__ */ 78 | -------------------------------------------------------------------------------- /neo/game/physics/Physics.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | #include "Game_local.h" 31 | 32 | #include "physics/Physics.h" 33 | 34 | ABSTRACT_DECLARATION( idClass, idPhysics ) 35 | END_CLASS 36 | 37 | 38 | /* 39 | ================ 40 | idPhysics::~idPhysics 41 | ================ 42 | */ 43 | idPhysics::~idPhysics( void ) { 44 | } 45 | 46 | /* 47 | ================ 48 | idPhysics::Save 49 | ================ 50 | */ 51 | void idPhysics::Save( idSaveGame *savefile ) const { 52 | } 53 | 54 | /* 55 | ================ 56 | idPhysics::Restore 57 | ================ 58 | */ 59 | void idPhysics::Restore( idRestoreGame *savefile ) { 60 | } 61 | 62 | /* 63 | ================ 64 | idPhysics::SetClipBox 65 | ================ 66 | */ 67 | void idPhysics::SetClipBox( const idBounds &bounds, float density ) { 68 | SetClipModel( new idClipModel( idTraceModel( bounds ) ), density ); 69 | } 70 | 71 | /* 72 | ================ 73 | idPhysics::SnapTimeToPhysicsFrame 74 | ================ 75 | */ 76 | int idPhysics::SnapTimeToPhysicsFrame( int t ) { 77 | int s; 78 | s = t + USERCMD_MSEC - 1; 79 | return ( s - s % USERCMD_MSEC ); 80 | } 81 | -------------------------------------------------------------------------------- /neo/idlib/LangDict.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __LANGDICT_H__ 30 | #define __LANGDICT_H__ 31 | 32 | #include "idlib/containers/List.h" 33 | #include "idlib/containers/HashIndex.h" 34 | #include "idlib/Str.h" 35 | 36 | /* 37 | =============================================================================== 38 | 39 | Simple dictionary specifically for the localized string tables. 40 | 41 | =============================================================================== 42 | */ 43 | 44 | class idLangKeyValue { 45 | public: 46 | idStr key; 47 | idStr value; 48 | }; 49 | 50 | class idLangDict { 51 | public: 52 | idLangDict( void ); 53 | ~idLangDict( void ); 54 | 55 | void Clear( void ); 56 | bool Load( const char *fileName, bool clear = true ); 57 | void Save( const char *fileName ); 58 | 59 | const char * AddString( const char *str ); 60 | const char * GetString( const char *str ) const; 61 | 62 | // adds the value and key as passed (doesn't generate a "#str_xxxxx" key or ensure the key/value pair is unique) 63 | void AddKeyVal( const char *key, const char *val ); 64 | 65 | int GetNumKeyVals( void ) const; 66 | const idLangKeyValue * GetKeyVal( int i ) const; 67 | 68 | void SetBaseID(int id) { baseID = id; }; 69 | 70 | private: 71 | idList args; 72 | idHashIndex hash; 73 | 74 | bool ExcludeString( const char *str ) const; 75 | int GetNextId( void ) const; 76 | int GetHashKey( const char *str ) const; 77 | 78 | int baseID; 79 | }; 80 | 81 | #endif /* !__LANGDICT_H__ */ 82 | -------------------------------------------------------------------------------- /neo/idlib/containers/PlaneSet.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __PLANESET_H__ 30 | #define __PLANESET_H__ 31 | 32 | #include "idlib/containers/List.h" 33 | #include "idlib/containers/HashIndex.h" 34 | #include "idlib/math/Plane.h" 35 | 36 | /* 37 | =============================================================================== 38 | 39 | Plane Set 40 | 41 | =============================================================================== 42 | */ 43 | 44 | class idPlaneSet : public idList { 45 | public: 46 | 47 | void Clear( void ) { idList::Clear(); hash.Free(); } 48 | 49 | int FindPlane( const idPlane &plane, const float normalEps, const float distEps ); 50 | 51 | private: 52 | idHashIndex hash; 53 | }; 54 | 55 | ID_INLINE int idPlaneSet::FindPlane( const idPlane &plane, const float normalEps, const float distEps ) { 56 | int i, border, hashKey; 57 | 58 | assert( distEps <= 0.125f ); 59 | 60 | hashKey = (int)( idMath::Fabs( plane.Dist() ) * 0.125f ); 61 | for ( border = -1; border <= 1; border++ ) { 62 | for ( i = hash.First( hashKey + border ); i >= 0; i = hash.Next( i ) ) { 63 | if ( (*this)[i].Compare( plane, normalEps, distEps ) ) { 64 | return i; 65 | } 66 | } 67 | } 68 | 69 | if ( plane.Type() >= PLANETYPE_NEGX && plane.Type() < PLANETYPE_TRUEAXIAL ) { 70 | Append( -plane ); 71 | hash.Add( hashKey, Num()-1 ); 72 | Append( plane ); 73 | hash.Add( hashKey, Num()-1 ); 74 | return ( Num() - 1 ); 75 | } 76 | else { 77 | Append( plane ); 78 | hash.Add( hashKey, Num()-1 ); 79 | Append( -plane ); 80 | hash.Add( hashKey, Num()-1 ); 81 | return ( Num() - 2 ); 82 | } 83 | } 84 | 85 | #endif /* !__PLANESET_H__ */ 86 | -------------------------------------------------------------------------------- /neo/idlib/containers/Queue.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __QUEUE_H__ 30 | #define __QUEUE_H__ 31 | 32 | /* 33 | =============================================================================== 34 | 35 | Queue template 36 | 37 | =============================================================================== 38 | */ 39 | 40 | #define idQueue( type, next ) idQueueTemplatenext)> 41 | 42 | template< class type, int nextOffset > 43 | class idQueueTemplate { 44 | public: 45 | idQueueTemplate( void ); 46 | 47 | void Add( type *element ); 48 | type * Get( void ); 49 | 50 | private: 51 | type * first; 52 | type * last; 53 | }; 54 | 55 | #define QUEUE_NEXT_PTR( element ) (*((type**)(((byte*)element)+nextOffset))) 56 | 57 | template< class type, int nextOffset > 58 | idQueueTemplate::idQueueTemplate( void ) { 59 | first = last = NULL; 60 | } 61 | 62 | template< class type, int nextOffset > 63 | void idQueueTemplate::Add( type *element ) { 64 | QUEUE_NEXT_PTR(element) = NULL; 65 | if ( last ) { 66 | QUEUE_NEXT_PTR(last) = element; 67 | } else { 68 | first = element; 69 | } 70 | last = element; 71 | } 72 | 73 | template< class type, int nextOffset > 74 | type *idQueueTemplate::Get( void ) { 75 | type *element; 76 | 77 | element = first; 78 | if ( element ) { 79 | first = QUEUE_NEXT_PTR(first); 80 | if ( last == element ) { 81 | last = NULL; 82 | } 83 | QUEUE_NEXT_PTR(element) = NULL; 84 | } 85 | return element; 86 | } 87 | 88 | #endif /* !__QUEUE_H__ */ 89 | -------------------------------------------------------------------------------- /neo/idlib/containers/Stack.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __STACK_H__ 30 | #define __STACK_H__ 31 | 32 | /* 33 | =============================================================================== 34 | 35 | Stack template 36 | 37 | =============================================================================== 38 | */ 39 | 40 | #define idStack( type, next ) idStackTemplatenext)> 41 | 42 | template< class type, int nextOffset > 43 | class idStackTemplate { 44 | public: 45 | idStackTemplate( void ); 46 | 47 | void Add( type *element ); 48 | type * Get( void ); 49 | 50 | private: 51 | type * top; 52 | type * bottom; 53 | }; 54 | 55 | #define STACK_NEXT_PTR( element ) (*(type**)(((byte*)element)+nextOffset)) 56 | 57 | template< class type, int nextOffset > 58 | idStackTemplate::idStackTemplate( void ) { 59 | top = bottom = NULL; 60 | } 61 | 62 | template< class type, int nextOffset > 63 | void idStackTemplate::Add( type *element ) { 64 | STACK_NEXT_PTR(element) = top; 65 | top = element; 66 | if ( !bottom ) { 67 | bottom = element; 68 | } 69 | } 70 | 71 | template< class type, int nextOffset > 72 | type *idStackTemplate::Get( void ) { 73 | type *element; 74 | 75 | element = top; 76 | if ( element ) { 77 | top = STACK_NEXT_PTR(top); 78 | if ( bottom == element ) { 79 | bottom = NULL; 80 | } 81 | STACK_NEXT_PTR(element) = NULL; 82 | } 83 | return element; 84 | } 85 | 86 | #endif /* !__STACK_H__ */ 87 | -------------------------------------------------------------------------------- /neo/idlib/geometry/DrawVert.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | 31 | #include "idlib/geometry/DrawVert.h" 32 | 33 | /* 34 | ============= 35 | idDrawVert::Normalize 36 | ============= 37 | */ 38 | void idDrawVert::Normalize( void ) { 39 | normal.Normalize(); 40 | tangents[1].Cross( normal, tangents[0] ); 41 | tangents[1].Normalize(); 42 | tangents[0].Cross( tangents[1], normal ); 43 | tangents[0].Normalize(); 44 | } 45 | -------------------------------------------------------------------------------- /neo/idlib/geometry/JointTransform.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | 31 | #include "idlib/geometry/JointTransform.h" 32 | 33 | /* 34 | ============= 35 | idJointMat::ToJointQuat 36 | ============= 37 | */ 38 | idJointQuat idJointMat::ToJointQuat( void ) const { 39 | idJointQuat jq; 40 | float trace; 41 | float s; 42 | float t; 43 | int i; 44 | int j; 45 | int k; 46 | 47 | static int next[3] = { 1, 2, 0 }; 48 | 49 | trace = mat[0 * 4 + 0] + mat[1 * 4 + 1] + mat[2 * 4 + 2]; 50 | 51 | if ( trace > 0.0f ) { 52 | 53 | t = trace + 1.0f; 54 | s = idMath::InvSqrt( t ) * 0.5f; 55 | 56 | jq.q[3] = s * t; 57 | jq.q[0] = ( mat[1 * 4 + 2] - mat[2 * 4 + 1] ) * s; 58 | jq.q[1] = ( mat[2 * 4 + 0] - mat[0 * 4 + 2] ) * s; 59 | jq.q[2] = ( mat[0 * 4 + 1] - mat[1 * 4 + 0] ) * s; 60 | 61 | } else { 62 | 63 | i = 0; 64 | if ( mat[1 * 4 + 1] > mat[0 * 4 + 0] ) { 65 | i = 1; 66 | } 67 | if ( mat[2 * 4 + 2] > mat[i * 4 + i] ) { 68 | i = 2; 69 | } 70 | j = next[i]; 71 | k = next[j]; 72 | 73 | t = ( mat[i * 4 + i] - ( mat[j * 4 + j] + mat[k * 4 + k] ) ) + 1.0f; 74 | s = idMath::InvSqrt( t ) * 0.5f; 75 | 76 | jq.q[i] = s * t; 77 | jq.q[3] = ( mat[j * 4 + k] - mat[k * 4 + j] ) * s; 78 | jq.q[j] = ( mat[i * 4 + j] + mat[j * 4 + i] ) * s; 79 | jq.q[k] = ( mat[i * 4 + k] + mat[k * 4 + i] ) * s; 80 | } 81 | 82 | jq.t[0] = mat[0 * 4 + 3]; 83 | jq.t[1] = mat[1 * 4 + 3]; 84 | jq.t[2] = mat[2 * 4 + 3]; 85 | 86 | return jq; 87 | } 88 | -------------------------------------------------------------------------------- /neo/idlib/geometry/Surface_Polytope.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __SURFACE_POLYTOPE_H__ 30 | #define __SURFACE_POLYTOPE_H__ 31 | 32 | #include "idlib/geometry/Surface.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Polytope surface. 38 | 39 | NOTE: vertexes are not duplicated for texture coordinates. 40 | 41 | =============================================================================== 42 | */ 43 | 44 | class idSurface_Polytope : public idSurface { 45 | public: 46 | idSurface_Polytope( void ); 47 | 48 | void FromPlanes( const idPlane *planes, const int numPlanes ); 49 | 50 | void SetupTetrahedron( const idBounds &bounds ); 51 | void SetupHexahedron( const idBounds &bounds ); 52 | void SetupOctahedron( const idBounds &bounds ); 53 | void SetupDodecahedron( const idBounds &bounds ); 54 | void SetupIcosahedron( const idBounds &bounds ); 55 | void SetupCylinder( const idBounds &bounds, const int numSides ); 56 | void SetupCone( const idBounds &bounds, const int numSides ); 57 | 58 | int SplitPolytope( const idPlane &plane, const float epsilon, idSurface_Polytope **front, idSurface_Polytope **back ) const; 59 | 60 | protected: 61 | 62 | }; 63 | 64 | /* 65 | ==================== 66 | idSurface_Polytope::idSurface_Polytope 67 | ==================== 68 | */ 69 | ID_INLINE idSurface_Polytope::idSurface_Polytope( void ) { 70 | } 71 | 72 | #endif /* !__SURFACE_POLYTOPE_H__ */ 73 | -------------------------------------------------------------------------------- /neo/idlib/hashing/CRC32.h: -------------------------------------------------------------------------------- 1 | #ifndef __CRC32_H__ 2 | #define __CRC32_H__ 3 | 4 | /* 5 | =============================================================================== 6 | 7 | Calculates a checksum for a block of data 8 | using the CRC-32. 9 | 10 | =============================================================================== 11 | */ 12 | 13 | void CRC32_InitChecksum( unsigned int &crcvalue ); 14 | void CRC32_UpdateChecksum( unsigned int &crcvalue, const void *data, int length ); 15 | void CRC32_FinishChecksum( unsigned int &crcvalue ); 16 | unsigned int CRC32_BlockChecksum( const void *data, int length ); 17 | 18 | #endif /* !__CRC32_H__ */ 19 | -------------------------------------------------------------------------------- /neo/idlib/hashing/MD4.h: -------------------------------------------------------------------------------- 1 | #ifndef __MD4_H__ 2 | #define __MD4_H__ 3 | 4 | /* 5 | =============================================================================== 6 | 7 | Calculates a checksum for a block of data 8 | using the MD4 message-digest algorithm. 9 | 10 | =============================================================================== 11 | */ 12 | 13 | unsigned int MD4_BlockChecksum( const void *data, int length ); 14 | 15 | #endif /* !__MD4_H__ */ 16 | -------------------------------------------------------------------------------- /neo/idlib/hashing/MD5.h: -------------------------------------------------------------------------------- 1 | #ifndef __MD5_H__ 2 | #define __MD5_H__ 3 | 4 | /* 5 | =============================================================================== 6 | 7 | Calculates a checksum for a block of data 8 | using the MD5 message-digest algorithm. 9 | 10 | =============================================================================== 11 | */ 12 | 13 | unsigned int MD5_BlockChecksum( const void *data, int length ); 14 | 15 | #endif /* !__MD5_H__ */ 16 | -------------------------------------------------------------------------------- /neo/idlib/math/Complex.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | 31 | #include "idlib/math/Complex.h" 32 | 33 | idComplex complex_origin( 0.0f, 0.0f ); 34 | 35 | /* 36 | ============= 37 | idComplex::ToString 38 | ============= 39 | */ 40 | const char *idComplex::ToString( int precision ) const { 41 | return idStr::FloatArrayToString( ToFloatPtr(), GetDimension(), precision ); 42 | } 43 | -------------------------------------------------------------------------------- /neo/idlib/math/Simd_MMX.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | 31 | #include "idlib/math/Simd_MMX.h" 32 | 33 | //=============================================================== 34 | // 35 | // MMX implementation of idSIMDProcessor 36 | // 37 | //=============================================================== 38 | 39 | #if defined(__GNUC__) && defined(__MMX__) 40 | /* 41 | ============ 42 | idSIMD_MMX::GetName 43 | ============ 44 | */ 45 | const char * idSIMD_MMX::GetName( void ) const { 46 | return "MMX"; 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /neo/idlib/math/Simd_MMX.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __MATH_SIMD_MMX_H__ 30 | #define __MATH_SIMD_MMX_H__ 31 | 32 | #include "idlib/math/Simd_Generic.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | MMX implementation of idSIMDProcessor 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idSIMD_MMX : public idSIMD_Generic { 43 | public: 44 | #if defined(__GNUC__) && defined(__MMX__) 45 | virtual const char * VPCALL GetName( void ) const; 46 | #endif 47 | }; 48 | 49 | #endif /* !__MATH_SIMD_MMX_H__ */ 50 | -------------------------------------------------------------------------------- /neo/idlib/math/Simd_SSE.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __MATH_SIMD_SSE_H__ 30 | #define __MATH_SIMD_SSE_H__ 31 | 32 | #include "idlib/math/Simd_MMX.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | SSE implementation of idSIMDProcessor 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idSIMD_SSE : public idSIMD_MMX { 43 | public: 44 | #if defined(__GNUC__) && defined(__SSE__) 45 | using idSIMD_MMX::Dot; 46 | using idSIMD_MMX::MinMax; 47 | 48 | virtual const char * VPCALL GetName( void ) const; 49 | virtual void VPCALL Dot( float *dst, const idPlane &constant,const idDrawVert *src, const int count ); 50 | virtual void VPCALL MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, const int *indexes, const int count ); 51 | virtual void VPCALL Dot( float *dst, const idVec3 &constant, const idPlane *src, const int count ); 52 | #endif 53 | }; 54 | 55 | #endif /* !__MATH_SIMD_SSE_H__ */ 56 | -------------------------------------------------------------------------------- /neo/idlib/math/Simd_SSE2.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __MATH_SIMD_SSE2_H__ 30 | #define __MATH_SIMD_SSE2_H__ 31 | 32 | #include "idlib/math/Simd_SSE.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | SSE2 implementation of idSIMDProcessor 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idSIMD_SSE2 : public idSIMD_SSE { 43 | public: 44 | #if defined(__GNUC__) && defined(__SSE2__) 45 | using idSIMD_SSE::CmpLT; 46 | 47 | virtual const char * VPCALL GetName( void ) const; 48 | virtual void VPCALL CmpLT( byte *dst, const byte bitNum, const float *src0, const float constant, const int count ); 49 | #endif 50 | }; 51 | 52 | #endif /* !__MATH_SIMD_SSE2_H__ */ 53 | -------------------------------------------------------------------------------- /neo/idlib/math/Simd_SSE3.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | 31 | #include "idlib/math/Simd_SSE3.h" 32 | 33 | //=============================================================== 34 | // 35 | // SSE3 implementation of idSIMDProcessor 36 | // 37 | //=============================================================== 38 | 39 | #if defined(__GNUC__) && defined(__SSE3__) 40 | 41 | /* 42 | ============ 43 | idSIMD_SSE3::GetName 44 | ============ 45 | */ 46 | const char * idSIMD_SSE3::GetName( void ) const { 47 | return "MMX & SSE & SSE2 & SSE3"; 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /neo/idlib/math/Simd_SSE3.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __MATH_SIMD_SSE3_H__ 30 | #define __MATH_SIMD_SSE3_H__ 31 | 32 | #include "idlib/math/Simd_SSE2.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | SSE3 implementation of idSIMDProcessor 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idSIMD_SSE3 : public idSIMD_SSE2 { 43 | public: 44 | #if defined(__GNUC__) && defined(__SSE3__) 45 | virtual const char * VPCALL GetName( void ) const; 46 | #endif 47 | }; 48 | 49 | #endif /* !__MATH_SIMD_SSE3_H__ */ 50 | -------------------------------------------------------------------------------- /neo/renderer/GuiModel.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "idlib/containers/List.h" 30 | #include "idlib/geometry/DrawVert.h" 31 | #include "renderer/Model.h" 32 | 33 | class idDemoFile; 34 | 35 | typedef struct { 36 | const idMaterial *material; 37 | float color[4]; 38 | int firstVert; 39 | int numVerts; 40 | int firstIndex; 41 | int numIndexes; 42 | } guiModelSurface_t; 43 | 44 | class idGuiModel { 45 | public: 46 | idGuiModel(); 47 | 48 | void Clear(); 49 | 50 | void WriteToDemo( idDemoFile *demo ); 51 | void ReadFromDemo( idDemoFile *demo ); 52 | 53 | void EmitToCurrentView( float modelMatrix[16], bool depthHack ); 54 | void EmitFullScreen(); 55 | 56 | // these calls are forwarded from the renderer 57 | void SetColor( float r, float g, float b, float a ); 58 | void DrawStretchPic( const idDrawVert *verts, const glIndex_t *indexes, int vertCount, int indexCount, const idMaterial *hShader, 59 | bool clip = true, float min_x = 0.0f, float min_y = 0.0f, float max_x = 640.0f, float max_y = 480.0f ); 60 | void DrawStretchPic( float x, float y, float w, float h, 61 | float s1, float t1, float s2, float t2, const idMaterial *hShader); 62 | void DrawStretchTri ( idVec2 p1, idVec2 p2, idVec2 p3, idVec2 t1, idVec2 t2, idVec2 t3, const idMaterial *material ); 63 | 64 | //--------------------------- 65 | private: 66 | void AdvanceSurf(); 67 | void EmitSurface( guiModelSurface_t *surf, float modelMatrix[16], float modelViewMatrix[16], bool depthHack ); 68 | 69 | guiModelSurface_t *surf; 70 | 71 | idList surfaces; 72 | idList indexes; 73 | idList verts; 74 | }; 75 | -------------------------------------------------------------------------------- /neo/renderer/glsl/blendLightShaderVP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const blendLightShaderVP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | attribute highp vec4 attr_Vertex; 26 | 27 | // Uniforms 28 | uniform highp mat4 u_modelViewProjectionMatrix; 29 | uniform mat4 u_fogMatrix; 30 | 31 | // Out 32 | // gl_Position 33 | varying vec2 var_TexFog; 34 | varying vec2 var_TexFogEnter; 35 | 36 | void main(void) 37 | { 38 | gl_Position = u_modelViewProjectionMatrix * attr_Vertex; 39 | 40 | // What will be computed: 41 | // 42 | // vec4 tc; 43 | // tc.x = dot( u_fogMatrix[0], attr_Vertex ); 44 | // tc.y = dot( u_fogMatrix[1], attr_Vertex ); 45 | // tc.z = 0.0; 46 | // tc.w = dot( u_fogMatrix[2], attr_Vertex ); 47 | // var_TexFog.xy = tc.xy / tc.w; 48 | // 49 | // var_TexFogEnter.x = dot( u_fogMatrix[3], attr_Vertex ); 50 | // var_TexFogEnter.y = 0.5; 51 | 52 | // Optimized version: 53 | // 54 | var_TexFog = vec2(dot( u_fogMatrix[0], attr_Vertex ), dot( u_fogMatrix[1], attr_Vertex )) / dot( u_fogMatrix[2], attr_Vertex ); 55 | var_TexFogEnter = vec2( dot( u_fogMatrix[3], attr_Vertex ), 0.5 ); 56 | } 57 | )"; -------------------------------------------------------------------------------- /neo/renderer/glsl/cubeMapShaderFP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const cubeMapShaderFP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | varying vec3 var_TexCoord; 26 | varying lowp vec4 var_Color; 27 | 28 | // Uniforms 29 | uniform samplerCube u_fragmentCubeMap0; 30 | uniform lowp vec4 u_glColor; 31 | 32 | // Out 33 | // gl_FragColor 34 | 35 | void main(void) 36 | { 37 | gl_FragColor = textureCube(u_fragmentCubeMap0, var_TexCoord) * u_glColor * var_Color; 38 | } 39 | )"; 40 | -------------------------------------------------------------------------------- /neo/renderer/glsl/diffuseCubeShaderVP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const diffuseCubeShaderVP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | attribute highp vec4 attr_Vertex; 26 | attribute lowp vec4 attr_Color; 27 | attribute vec3 attr_TexCoord; 28 | 29 | // Uniforms 30 | uniform highp mat4 u_modelViewProjectionMatrix; 31 | uniform mat4 u_textureMatrix; 32 | uniform lowp float u_colorAdd; 33 | uniform lowp float u_colorModulate; 34 | 35 | // Out 36 | // gl_Position 37 | varying vec3 var_TexCoord; 38 | varying lowp vec4 var_Color; 39 | 40 | void main(void) 41 | { 42 | var_TexCoord = (u_textureMatrix * vec4(attr_TexCoord, 0.0)).xyz; 43 | 44 | if (u_colorModulate == 0.0) { 45 | var_Color = vec4(u_colorAdd); 46 | } else { 47 | var_Color = (attr_Color * u_colorModulate) + vec4(u_colorAdd); 48 | } 49 | 50 | gl_Position = u_modelViewProjectionMatrix * attr_Vertex; 51 | } 52 | )"; 53 | -------------------------------------------------------------------------------- /neo/renderer/glsl/diffuseMapShaderFP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const diffuseMapShaderFP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | varying vec2 var_TexCoord; 26 | varying lowp vec4 var_Color; 27 | 28 | // Uniforms 29 | uniform sampler2D u_fragmentMap0; 30 | uniform lowp vec4 u_glColor; 31 | 32 | // Out 33 | // gl_FragCoord 34 | 35 | void main(void) 36 | { 37 | gl_FragColor = texture2D(u_fragmentMap0, var_TexCoord) * u_glColor * var_Color; 38 | } 39 | )"; 40 | -------------------------------------------------------------------------------- /neo/renderer/glsl/diffuseMapShaderVP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const diffuseMapShaderVP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | attribute highp vec4 attr_Vertex; 26 | attribute lowp vec4 attr_Color; 27 | attribute vec4 attr_TexCoord; 28 | 29 | // Uniforms 30 | uniform highp mat4 u_modelViewProjectionMatrix; 31 | uniform mat4 u_textureMatrix; 32 | uniform lowp float u_colorAdd; 33 | uniform lowp float u_colorModulate; 34 | 35 | // Out 36 | // gl_Position 37 | varying vec2 var_TexCoord; 38 | varying lowp vec4 var_Color; 39 | 40 | void main(void) 41 | { 42 | var_TexCoord = (u_textureMatrix * attr_TexCoord).xy; // Homogeneous coordinates of textureMatrix supposed to be 1 43 | 44 | if (u_colorModulate == 0.0) { 45 | var_Color = vec4(u_colorAdd); 46 | } else { 47 | var_Color = (attr_Color * u_colorModulate) + vec4(u_colorAdd); 48 | } 49 | 50 | gl_Position = u_modelViewProjectionMatrix * attr_Vertex; 51 | } 52 | )"; 53 | -------------------------------------------------------------------------------- /neo/renderer/glsl/fogShaderFP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const fogShaderFP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | varying vec2 var_TexFog; // input Fog TexCoord 26 | varying vec2 var_TexFogEnter; // input FogEnter TexCoord 27 | 28 | // Uniforms 29 | uniform sampler2D u_fragmentMap0; // Fog Image 30 | uniform sampler2D u_fragmentMap1; // Fog Enter Image 31 | uniform lowp vec4 u_fogColor; // Fog Color 32 | 33 | // Out 34 | // gl_FragCoord // output Fragment color 35 | 36 | void main(void) 37 | { 38 | gl_FragColor = texture2D( u_fragmentMap0, var_TexFog ) * texture2D( u_fragmentMap1, var_TexFogEnter ) * vec4(u_fogColor.rgb, 1.0); 39 | } 40 | )"; 41 | -------------------------------------------------------------------------------- /neo/renderer/glsl/fogShaderVP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const fogShaderVP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | attribute highp vec4 attr_Vertex; // input Vertex Coordinates 26 | 27 | // Uniforms 28 | uniform highp mat4 u_modelViewProjectionMatrix; 29 | uniform mat4 u_fogMatrix; // fogPlanes 0, 1, 3 (CATION: not 2!), 2 30 | 31 | // Out 32 | // gl_Position // output Vertex Coordinates 33 | varying vec2 var_TexFog; // output Fog TexCoord 34 | varying vec2 var_TexFogEnter; // output FogEnter TexCoord 35 | 36 | void main(void) 37 | { 38 | gl_Position = u_modelViewProjectionMatrix * attr_Vertex; 39 | 40 | // What will be computed: 41 | // 42 | // var_TexFog.x = dot(u_fogMatrix[0], attr_Vertex); 43 | // var_TexFog.y = dot(u_fogMatrix[1], attr_Vertex); 44 | // var_TexFogEnter.x = dot(u_fogMatrix[2], attr_Vertex); 45 | // var_TexFogEnter.y = dot(u_fogMatrix[3], attr_Vertex); 46 | 47 | // Optimized version: 48 | var_TexFog = vec2(dot(u_fogMatrix[0], attr_Vertex),dot(u_fogMatrix[1], attr_Vertex)); 49 | var_TexFogEnter = vec2(dot(u_fogMatrix[2], attr_Vertex),dot(u_fogMatrix[3], attr_Vertex)); 50 | } 51 | )"; 52 | -------------------------------------------------------------------------------- /neo/renderer/glsl/glsl_shaders.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef D3WASM_GLSL_SHADERS_H 19 | #define D3WASM_GLSL_SHADERS_H 20 | 21 | // Main Light Interaction 22 | // gouraud 23 | extern const char* const interactionShaderVP; 24 | extern const char* const interactionShaderFP; 25 | // phong 26 | extern const char* const interactionPhongShaderVP; 27 | extern const char* const interactionPhongShaderFP; 28 | // Fog 29 | extern const char* const fogShaderVP; 30 | extern const char* const blendLightShaderVP; 31 | extern const char* const fogShaderFP; 32 | // Depth Buffer 33 | // no clip planes 34 | extern const char* const zfillShaderVP; 35 | extern const char* const zfillShaderFP; 36 | // clip planes 37 | extern const char* const zfillClipShaderVP; 38 | extern const char* const zfillClipShaderFP; 39 | // Ambient Surfaces 40 | // diffuse mapping (default diffuse surfaces) 41 | extern const char* const diffuseMapShaderVP; 42 | extern const char* const diffuseMapShaderFP; 43 | // cube mapping (skybox/wobblesky, diffusecube, reflection) 44 | extern const char* const diffuseCubeShaderVP; 45 | extern const char* const skyboxCubeShaderVP; 46 | extern const char* const reflectionCubeShaderVP; 47 | extern const char* const cubeMapShaderFP; 48 | // Shadows 49 | extern const char* const stencilShadowShaderVP; 50 | extern const char* const stencilShadowShaderFP; 51 | 52 | #endif //D3WASM_GLSL_SHADERS_H 53 | -------------------------------------------------------------------------------- /neo/renderer/glsl/interactionPhongShaderFP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const interactionPhongShaderFP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | varying vec2 var_TexDiffuse; 26 | varying vec2 var_TexNormal; 27 | varying vec2 var_TexSpecular; 28 | varying vec4 var_TexLight; 29 | varying lowp vec4 var_Color; 30 | varying vec3 var_L; 31 | varying vec3 var_V; 32 | 33 | // Uniforms 34 | uniform lowp vec4 u_diffuseColor; 35 | uniform lowp vec4 u_specularColor; 36 | uniform float u_specularExponent; 37 | uniform sampler2D u_fragmentMap0; // u_bumpTexture 38 | uniform sampler2D u_fragmentMap1; // u_lightFalloffTexture 39 | uniform sampler2D u_fragmentMap2; // u_lightProjectionTexture 40 | uniform sampler2D u_fragmentMap3; // u_diffuseTexture 41 | uniform sampler2D u_fragmentMap4; // u_specularTexture 42 | 43 | // Out 44 | // gl_FragCoord 45 | 46 | void main(void) 47 | { 48 | vec3 L = normalize(var_L); 49 | vec3 V = normalize(var_V); 50 | vec3 N = normalize(2.0 * texture2D(u_fragmentMap0, var_TexNormal.st).agb - 1.0); 51 | 52 | float NdotL = clamp(dot(N, L), 0.0, 1.0); 53 | 54 | vec3 lightProjection = texture2DProj(u_fragmentMap2, var_TexLight.xyw).rgb; 55 | vec3 lightFalloff = texture2D(u_fragmentMap1, vec2(var_TexLight.z, 0.5)).rgb; 56 | vec3 diffuseColor = texture2D(u_fragmentMap3, var_TexDiffuse).rgb * u_diffuseColor.rgb; 57 | vec3 specularColor = 2.0 * texture2D(u_fragmentMap4, var_TexSpecular).rgb * u_specularColor.rgb; 58 | 59 | vec3 R = -reflect(L, N); 60 | float RdotV = clamp(dot(R, V), 0.0, 1.0); 61 | float specularFalloff = pow(RdotV, u_specularExponent); 62 | 63 | vec3 color; 64 | color = diffuseColor; 65 | color += specularFalloff * specularColor; 66 | color *= NdotL * lightProjection; 67 | color *= lightFalloff; 68 | 69 | gl_FragColor = vec4(color, 1.0) * var_Color; 70 | } 71 | )"; 72 | -------------------------------------------------------------------------------- /neo/renderer/glsl/interactionPhongShaderVP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const interactionPhongShaderVP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | attribute highp vec4 attr_Vertex; 26 | attribute lowp vec4 attr_Color; 27 | attribute vec4 attr_TexCoord; 28 | attribute vec3 attr_Tangent; 29 | attribute vec3 attr_Bitangent; 30 | attribute vec3 attr_Normal; 31 | 32 | // Uniforms 33 | uniform highp mat4 u_modelViewProjectionMatrix; 34 | uniform mat4 u_lightProjection; 35 | uniform lowp float u_colorModulate; 36 | uniform lowp float u_colorAdd; 37 | uniform vec4 u_lightOrigin; 38 | uniform vec4 u_viewOrigin; 39 | uniform vec4 u_bumpMatrixS; 40 | uniform vec4 u_bumpMatrixT; 41 | uniform vec4 u_diffuseMatrixS; 42 | uniform vec4 u_diffuseMatrixT; 43 | uniform vec4 u_specularMatrixS; 44 | uniform vec4 u_specularMatrixT; 45 | 46 | // Out 47 | // gl_Position 48 | varying vec2 var_TexDiffuse; 49 | varying vec2 var_TexNormal; 50 | varying vec2 var_TexSpecular; 51 | varying vec4 var_TexLight; 52 | varying lowp vec4 var_Color; 53 | varying vec3 var_L; 54 | varying vec3 var_V; 55 | 56 | void main(void) 57 | { 58 | mat3 M = mat3(attr_Tangent, attr_Bitangent, attr_Normal); 59 | 60 | var_TexNormal.x = dot(u_bumpMatrixS, attr_TexCoord); 61 | var_TexNormal.y = dot(u_bumpMatrixT, attr_TexCoord); 62 | 63 | var_TexDiffuse.x = dot(u_diffuseMatrixS, attr_TexCoord); 64 | var_TexDiffuse.y = dot(u_diffuseMatrixT, attr_TexCoord); 65 | 66 | var_TexSpecular.x = dot(u_specularMatrixS, attr_TexCoord); 67 | var_TexSpecular.y = dot(u_specularMatrixT, attr_TexCoord); 68 | 69 | var_TexLight.x = dot(u_lightProjection[0], attr_Vertex); 70 | var_TexLight.y = dot(u_lightProjection[1], attr_Vertex); 71 | var_TexLight.z = dot(u_lightProjection[2], attr_Vertex); 72 | var_TexLight.w = dot(u_lightProjection[3], attr_Vertex); 73 | 74 | vec3 L = u_lightOrigin.xyz - attr_Vertex.xyz; 75 | vec3 V = u_viewOrigin.xyz - attr_Vertex.xyz; 76 | 77 | var_L = L * M; 78 | var_V = V * M; 79 | 80 | if (u_colorModulate == 0.0) { 81 | var_Color = vec4(u_colorAdd); 82 | } else { 83 | var_Color = (attr_Color * u_colorModulate) + vec4(u_colorAdd); 84 | } 85 | 86 | gl_Position = u_modelViewProjectionMatrix * attr_Vertex; 87 | } 88 | )"; 89 | -------------------------------------------------------------------------------- /neo/renderer/glsl/interactionShaderFP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const interactionShaderFP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | varying vec2 var_TexDiffuse; 26 | varying vec2 var_TexNormal; 27 | varying vec2 var_TexSpecular; 28 | varying vec4 var_TexLight; 29 | varying lowp vec4 var_Color; 30 | varying vec3 var_L; 31 | varying vec3 var_H; 32 | 33 | // Uniforms 34 | uniform lowp vec4 u_diffuseColor; 35 | uniform lowp vec4 u_specularColor; 36 | //uniform float u_specularExponent; // Not used 37 | uniform sampler2D u_fragmentMap0; // u_bumpTexture 38 | uniform sampler2D u_fragmentMap1; // u_lightFalloffTexture 39 | uniform sampler2D u_fragmentMap2; // u_lightProjectionTexture 40 | uniform sampler2D u_fragmentMap3; // u_diffuseTexture 41 | uniform sampler2D u_fragmentMap4; // u_specularTexture 42 | 43 | // Out 44 | // gl_FragCoord 45 | 46 | void main(void) 47 | { 48 | vec3 L = normalize(var_L); 49 | vec3 H = normalize(var_H); 50 | vec3 N = 2.0 * texture2D(u_fragmentMap0, var_TexNormal.st).agb - 1.0; 51 | 52 | float NdotL = clamp(dot(N, L), 0.0, 1.0); 53 | float NdotH = clamp(dot(N, H), 0.0, 1.0); 54 | 55 | vec3 lightProjection = texture2DProj(u_fragmentMap2, var_TexLight.xyw).rgb; 56 | vec3 lightFalloff = texture2D(u_fragmentMap1, vec2(var_TexLight.z, 0.5)).rgb; 57 | vec3 diffuseColor = texture2D(u_fragmentMap3, var_TexDiffuse).rgb * u_diffuseColor.rgb; 58 | vec3 specularColor = 2.0 * texture2D(u_fragmentMap4, var_TexSpecular).rgb * u_specularColor.rgb; 59 | 60 | float specularFalloff = pow(NdotH, 12.0); // Hardcoded to try to match with original D3 look 61 | 62 | vec3 color; 63 | color = diffuseColor; 64 | color += specularFalloff * specularColor; 65 | color *= NdotL * lightProjection; 66 | color *= lightFalloff; 67 | 68 | gl_FragColor = vec4(color, 1.0) * var_Color; 69 | } 70 | )"; 71 | -------------------------------------------------------------------------------- /neo/renderer/glsl/interactionShaderVP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const interactionShaderVP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | attribute highp vec4 attr_Vertex; 26 | attribute lowp vec4 attr_Color; 27 | attribute vec4 attr_TexCoord; 28 | attribute vec3 attr_Tangent; 29 | attribute vec3 attr_Bitangent; 30 | attribute vec3 attr_Normal; 31 | 32 | // Uniforms 33 | uniform highp mat4 u_modelViewProjectionMatrix; 34 | uniform mat4 u_lightProjection; 35 | uniform lowp float u_colorModulate; 36 | uniform lowp float u_colorAdd; 37 | uniform vec4 u_lightOrigin; 38 | uniform vec4 u_viewOrigin; 39 | uniform vec4 u_bumpMatrixS; 40 | uniform vec4 u_bumpMatrixT; 41 | uniform vec4 u_diffuseMatrixS; 42 | uniform vec4 u_diffuseMatrixT; 43 | uniform vec4 u_specularMatrixS; 44 | uniform vec4 u_specularMatrixT; 45 | 46 | // Out 47 | // gl_Position 48 | varying vec2 var_TexDiffuse; 49 | varying vec2 var_TexNormal; 50 | varying vec2 var_TexSpecular; 51 | varying vec4 var_TexLight; 52 | varying lowp vec4 var_Color; 53 | varying vec3 var_L; 54 | varying vec3 var_H; 55 | 56 | void main(void) 57 | { 58 | mat3 M = mat3(attr_Tangent, attr_Bitangent, attr_Normal); 59 | 60 | var_TexNormal.x = dot(u_bumpMatrixS, attr_TexCoord); 61 | var_TexNormal.y = dot(u_bumpMatrixT, attr_TexCoord); 62 | 63 | var_TexDiffuse.x = dot(u_diffuseMatrixS, attr_TexCoord); 64 | var_TexDiffuse.y = dot(u_diffuseMatrixT, attr_TexCoord); 65 | 66 | var_TexSpecular.x = dot(u_specularMatrixS, attr_TexCoord); 67 | var_TexSpecular.y = dot(u_specularMatrixT, attr_TexCoord); 68 | 69 | var_TexLight.x = dot(u_lightProjection[0], attr_Vertex); 70 | var_TexLight.y = dot(u_lightProjection[1], attr_Vertex); 71 | var_TexLight.z = dot(u_lightProjection[2], attr_Vertex); 72 | var_TexLight.w = dot(u_lightProjection[3], attr_Vertex); 73 | 74 | vec3 L = u_lightOrigin.xyz - attr_Vertex.xyz; 75 | vec3 V = u_viewOrigin.xyz - attr_Vertex.xyz; 76 | vec3 H = normalize(L) + normalize(V); 77 | 78 | var_L = L * M; 79 | var_H = H * M; 80 | 81 | if (u_colorModulate == 0.0) { 82 | var_Color = vec4(u_colorAdd); 83 | } else { 84 | var_Color = (attr_Color * u_colorModulate) + vec4(u_colorAdd); 85 | } 86 | 87 | gl_Position = u_modelViewProjectionMatrix * attr_Vertex; 88 | } 89 | )"; 90 | -------------------------------------------------------------------------------- /neo/renderer/glsl/reflectionCubeShaderVP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const reflectionCubeShaderVP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | attribute highp vec4 attr_Vertex; 26 | attribute lowp vec4 attr_Color; 27 | attribute vec3 attr_TexCoord; 28 | 29 | // Uniforms 30 | uniform highp mat4 u_modelViewProjectionMatrix; 31 | uniform mat4 u_modelViewMatrix; 32 | uniform mat4 u_textureMatrix; 33 | uniform lowp float u_colorAdd; 34 | uniform lowp float u_colorModulate; 35 | 36 | // Out 37 | // gl_Position 38 | varying vec3 var_TexCoord; 39 | varying lowp vec4 var_Color; 40 | 41 | void main(void) 42 | { 43 | var_TexCoord = (u_textureMatrix * reflect( normalize( u_modelViewMatrix * attr_Vertex ), 44 | // This suppose the modelView matrix is orthogonal 45 | // Otherwise, we should use the inverse transpose 46 | u_modelViewMatrix * vec4(attr_TexCoord,0.0) )).xyz ; 47 | 48 | if (u_colorModulate == 0.0) { 49 | var_Color = vec4(u_colorAdd); 50 | } else { 51 | var_Color = (attr_Color * u_colorModulate) + vec4(u_colorAdd); 52 | } 53 | 54 | gl_Position = u_modelViewProjectionMatrix * attr_Vertex; 55 | } 56 | )"; 57 | -------------------------------------------------------------------------------- /neo/renderer/glsl/skyboxCubeShaderVP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const skyboxCubeShaderVP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | attribute highp vec4 attr_Vertex; 26 | attribute lowp vec4 attr_Color; 27 | 28 | // Uniforms 29 | uniform highp mat4 u_modelViewProjectionMatrix; 30 | uniform mat4 u_textureMatrix; 31 | uniform lowp float u_colorAdd; 32 | uniform lowp float u_colorModulate; 33 | uniform vec4 u_viewOrigin; 34 | 35 | // Out 36 | // gl_Position 37 | varying vec3 var_TexCoord; 38 | varying lowp vec4 var_Color; 39 | 40 | void main(void) 41 | { 42 | var_TexCoord = (u_textureMatrix * (attr_Vertex - u_viewOrigin)).xyz; 43 | 44 | if (u_colorModulate == 0.0) { 45 | var_Color = vec4(u_colorAdd); 46 | } else { 47 | var_Color = (attr_Color * u_colorModulate) + vec4(u_colorAdd); 48 | } 49 | 50 | gl_Position = u_modelViewProjectionMatrix * attr_Vertex; 51 | } 52 | )"; 53 | -------------------------------------------------------------------------------- /neo/renderer/glsl/stencilShadowShaderFP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const stencilShadowShaderFP = R"( 21 | #version 100 22 | precision lowp float; 23 | 24 | // Out 25 | // gl_FragColor 26 | 27 | void main(void) 28 | { 29 | gl_FragColor = vec4(0,0,0,1.0); 30 | } 31 | )"; 32 | -------------------------------------------------------------------------------- /neo/renderer/glsl/stencilShadowShaderVP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const stencilShadowShaderVP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | attribute highp vec4 attr_Vertex; 26 | 27 | // Uniforms 28 | uniform highp mat4 u_modelViewProjectionMatrix; 29 | uniform vec4 u_lightOrigin; 30 | 31 | // Out 32 | // gl_Position 33 | 34 | void main(void) 35 | { 36 | gl_Position = u_modelViewProjectionMatrix * (attr_Vertex.w * u_lightOrigin + attr_Vertex - u_lightOrigin); 37 | } 38 | )"; 39 | -------------------------------------------------------------------------------- /neo/renderer/glsl/zfillClipShaderFP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const zfillClipShaderFP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | varying vec2 var_TexDiffuse; 26 | varying vec2 var_TexClip; 27 | 28 | // Uniforms 29 | uniform sampler2D u_fragmentMap0; 30 | uniform sampler2D u_fragmentMap1; 31 | uniform lowp float u_alphaTest; 32 | uniform lowp vec4 u_glColor; 33 | 34 | // Out 35 | // gl_FragCoord 36 | 37 | void main(void) 38 | { 39 | if (u_alphaTest < 1.0) 40 | { 41 | if (u_alphaTest > (texture2D(u_fragmentMap0, var_TexDiffuse).a * texture2D(u_fragmentMap1, var_TexClip).a) ) { 42 | discard; 43 | } 44 | } 45 | 46 | gl_FragColor = u_glColor; 47 | } 48 | )"; 49 | -------------------------------------------------------------------------------- /neo/renderer/glsl/zfillClipShaderVP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const zfillClipShaderVP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | attribute highp vec4 attr_Vertex; 26 | attribute vec4 attr_TexCoord; 27 | 28 | // Uniforms 29 | uniform highp mat4 u_modelViewProjectionMatrix; 30 | uniform mat4 u_textureMatrix; 31 | uniform vec4 u_clipPlane; 32 | 33 | // Out 34 | // gl_Position 35 | varying vec2 var_TexDiffuse; 36 | varying vec2 var_TexClip; 37 | 38 | void main(void) 39 | { 40 | var_TexDiffuse = (u_textureMatrix * attr_TexCoord).xy; // Homogeneous coordinates of textureMatrix supposed to be 1 41 | 42 | var_TexClip = vec2( dot( u_clipPlane, attr_Vertex), 0.5 ); 43 | 44 | gl_Position = u_modelViewProjectionMatrix * attr_Vertex; 45 | } 46 | )"; 47 | -------------------------------------------------------------------------------- /neo/renderer/glsl/zfillShaderFP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const zfillShaderFP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | varying vec2 var_TexDiffuse; 26 | 27 | // Uniforms 28 | uniform sampler2D u_fragmentMap0; 29 | uniform lowp float u_alphaTest; 30 | uniform lowp vec4 u_glColor; 31 | 32 | // Out 33 | // gl_FragCoord 34 | 35 | void main(void) 36 | { 37 | if (u_alphaTest < 1.0) 38 | { 39 | if (u_alphaTest > texture2D(u_fragmentMap0, var_TexDiffuse).a) { 40 | discard; 41 | } 42 | } 43 | 44 | gl_FragColor = u_glColor; 45 | } 46 | )"; 47 | -------------------------------------------------------------------------------- /neo/renderer/glsl/zfillShaderVP.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the D3wasm project (http://www.continuation-labs.com/projects/d3wasm) 3 | * Copyright (c) 2019 Gabriel Cuvillier. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "glsl_shaders.h" 19 | 20 | const char * const zfillShaderVP = R"( 21 | #version 100 22 | precision mediump float; 23 | 24 | // In 25 | attribute highp vec4 attr_Vertex; 26 | attribute vec4 attr_TexCoord; 27 | 28 | // Uniforms 29 | uniform highp mat4 u_modelViewProjectionMatrix; 30 | uniform mat4 u_textureMatrix; 31 | 32 | // Out 33 | // gl_Position 34 | varying vec2 var_TexDiffuse; 35 | 36 | void main(void) 37 | { 38 | var_TexDiffuse = (u_textureMatrix * attr_TexCoord).xy; // Homogeneous coordinates of textureMatrix supposed to be 1 39 | 40 | gl_Position = u_modelViewProjectionMatrix * attr_Vertex; 41 | } 42 | )"; 43 | -------------------------------------------------------------------------------- /neo/renderer/qgl.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | /* 29 | ** QGL.H 30 | */ 31 | 32 | #ifndef __QGL_H__ 33 | #define __QGL_H__ 34 | 35 | #include 36 | #include 37 | 38 | typedef void (*GLExtension_t)(void); 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | GLExtension_t GLimp_ExtensionPointer( const char *name ); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | // declare qgl functions 51 | #define QGLPROC(name, rettype, args) extern rettype (GL_APIENTRYP q##name) args; 52 | #include "renderer/qgl_proc.h" 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /neo/sound/efxlib.h: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | 4 | #ifndef __EFXLIBH 5 | #define __EFXLIBH 6 | 7 | #include "idlib/containers/List.h" 8 | #include "idlib/Str.h" 9 | #include "idlib/Lexer.h" 10 | #include "idlib/Heap.h" 11 | #include "framework/Common.h" 12 | #include "sound/sound.h" 13 | 14 | #define EFX_VERBOSE 0 15 | 16 | #if EFX_VERBOSE 17 | #define EFXprintf(...) do { common->Printf(__VA_ARGS__); } while (false) 18 | #else 19 | #define EFXprintf(...) do { } while (false) 20 | #endif 21 | 22 | struct idSoundEffect { 23 | idSoundEffect(); 24 | ~idSoundEffect(); 25 | 26 | bool alloc(); 27 | 28 | idStr name; 29 | ALuint effect; 30 | }; 31 | 32 | class idEFXFile { 33 | public: 34 | idEFXFile(); 35 | ~idEFXFile(); 36 | 37 | bool FindEffect( idStr &name, ALuint *effect ); 38 | bool LoadFile( const char *filename, bool OSPath = false ); 39 | void Clear( void ); 40 | 41 | private: 42 | bool ReadEffect( idLexer &lexer, idSoundEffect *effect ); 43 | 44 | idListeffects; 45 | }; 46 | 47 | #endif // __EFXLIBH 48 | -------------------------------------------------------------------------------- /neo/sys/cmake/FindOGG.cmake: -------------------------------------------------------------------------------- 1 | # Locate OGG 2 | # This module defines XXX_FOUND, XXX_INCLUDE_DIRS and XXX_LIBRARIES standard variables 3 | # 4 | # $OGGDIR is an environment variable that would 5 | # correspond to the ./configure --prefix=$OGGDIR 6 | # used in building OGG. 7 | 8 | SET(OGG_SEARCH_PATHS 9 | ~/Library/Frameworks 10 | /Library/Frameworks 11 | /usr/local 12 | /usr 13 | /sw # Fink 14 | /opt/local # DarwinPorts 15 | /opt/csw # Blastwave 16 | /opt 17 | ) 18 | 19 | SET(MSVC_YEAR_NAME) 20 | IF (MSVC_VERSION GREATER 1599) # >= 1600 21 | SET(MSVC_YEAR_NAME VS2010) 22 | ELSEIF(MSVC_VERSION GREATER 1499) # >= 1500 23 | SET(MSVC_YEAR_NAME VS2008) 24 | ELSEIF(MSVC_VERSION GREATER 1399) # >= 1400 25 | SET(MSVC_YEAR_NAME VS2005) 26 | ELSEIF(MSVC_VERSION GREATER 1299) # >= 1300 27 | SET(MSVC_YEAR_NAME VS2003) 28 | ELSEIF(MSVC_VERSION GREATER 1199) # >= 1200 29 | SET(MSVC_YEAR_NAME VS6) 30 | ENDIF() 31 | 32 | FIND_PATH(OGG_INCLUDE_DIR 33 | NAMES ogg/ogg.h ogg/os_types.h 34 | HINTS 35 | $ENV{OGGDIR} 36 | $ENV{OGG_PATH} 37 | PATH_SUFFIXES include 38 | PATHS ${OGG_SEARCH_PATHS} 39 | ) 40 | 41 | FIND_LIBRARY(OGG_LIBRARY 42 | NAMES ogg libogg 43 | HINTS 44 | $ENV{OGGDIR} 45 | $ENV{OGG_PATH} 46 | PATH_SUFFIXES lib lib64 win32/Dynamic_Release "Win32/${MSVC_YEAR_NAME}/x64/Release" "Win32/${MSVC_YEAR_NAME}/Win32/Release" 47 | PATHS ${OGG_SEARCH_PATHS} 48 | ) 49 | 50 | # First search for d-suffixed libs 51 | FIND_LIBRARY(OGG_LIBRARY_DEBUG 52 | NAMES oggd ogg_d liboggd libogg_d 53 | HINTS 54 | $ENV{OGGDIR} 55 | $ENV{OGG_PATH} 56 | PATH_SUFFIXES lib lib64 win32/Dynamic_Debug "Win32/${MSVC_YEAR_NAME}/x64/Debug" "Win32/${MSVC_YEAR_NAME}/Win32/Debug" 57 | PATHS ${OGG_SEARCH_PATHS} 58 | ) 59 | 60 | IF(NOT OGG_LIBRARY_DEBUG) 61 | # Then search for non suffixed libs if necessary, but only in debug dirs 62 | FIND_LIBRARY(OGG_LIBRARY_DEBUG 63 | NAMES ogg libogg 64 | HINTS 65 | $ENV{OGGDIR} 66 | $ENV{OGG_PATH} 67 | PATH_SUFFIXES win32/Dynamic_Debug "Win32/${MSVC_YEAR_NAME}/x64/Debug" "Win32/${MSVC_YEAR_NAME}/Win32/Debug" 68 | PATHS ${OGG_SEARCH_PATHS} 69 | ) 70 | ENDIF() 71 | 72 | 73 | IF(OGG_LIBRARY) 74 | IF(OGG_LIBRARY_DEBUG) 75 | SET(OGG_LIBRARIES optimized "${OGG_LIBRARY}" debug "${OGG_LIBRARY_DEBUG}") 76 | ELSE() 77 | SET(OGG_LIBRARIES "${OGG_LIBRARY}") # Could add "general" keyword, but it is optional 78 | ENDIF() 79 | ENDIF() 80 | 81 | # handle the QUIETLY and REQUIRED arguments and set XXX_FOUND to TRUE if all listed variables are TRUE 82 | INCLUDE(FindPackageHandleStandardArgs) 83 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(OGG DEFAULT_MSG OGG_LIBRARIES OGG_INCLUDE_DIR) 84 | -------------------------------------------------------------------------------- /neo/sys/cmake/FindVorbis.cmake: -------------------------------------------------------------------------------- 1 | # Locate Vorbis 2 | # This module defines XXX_FOUND, XXX_INCLUDE_DIRS and XXX_LIBRARIES standard variables 3 | # 4 | # $VORBISDIR is an environment variable that would 5 | # correspond to the ./configure --prefix=$VORBISDIR 6 | # used in building Vorbis. 7 | 8 | SET(VORBIS_SEARCH_PATHS 9 | ~/Library/Frameworks 10 | /Library/Frameworks 11 | /usr/local 12 | /usr 13 | /sw # Fink 14 | /opt/local # DarwinPorts 15 | /opt/csw # Blastwave 16 | /opt 17 | ) 18 | 19 | SET(MSVC_YEAR_NAME) 20 | IF (MSVC_VERSION GREATER 1599) # >= 1600 21 | SET(MSVC_YEAR_NAME VS2010) 22 | ELSEIF(MSVC_VERSION GREATER 1499) # >= 1500 23 | SET(MSVC_YEAR_NAME VS2008) 24 | ELSEIF(MSVC_VERSION GREATER 1399) # >= 1400 25 | SET(MSVC_YEAR_NAME VS2005) 26 | ELSEIF(MSVC_VERSION GREATER 1299) # >= 1300 27 | SET(MSVC_YEAR_NAME VS2003) 28 | ELSEIF(MSVC_VERSION GREATER 1199) # >= 1200 29 | SET(MSVC_YEAR_NAME VS6) 30 | ENDIF() 31 | 32 | FIND_PATH(VORBIS_INCLUDE_DIR 33 | NAMES vorbis/codec.h 34 | HINTS 35 | $ENV{VORBISDIR} 36 | $ENV{VORBIS_PATH} 37 | PATH_SUFFIXES include 38 | PATHS ${VORBIS_SEARCH_PATHS} 39 | ) 40 | 41 | FIND_LIBRARY(VORBIS_LIBRARY 42 | NAMES vorbis libvorbis 43 | HINTS 44 | $ENV{VORBISDIR} 45 | $ENV{VORBIS_PATH} 46 | PATH_SUFFIXES lib lib64 win32/Vorbis_Dynamic_Release "Win32/${MSVC_YEAR_NAME}/x64/Release" "Win32/${MSVC_YEAR_NAME}/Win32/Release" 47 | PATHS ${VORBIS_SEARCH_PATHS} 48 | ) 49 | 50 | # First search for d-suffixed libs 51 | FIND_LIBRARY(VORBIS_LIBRARY_DEBUG 52 | NAMES vorbisd vorbis_d libvorbisd libvorbis_d 53 | HINTS 54 | $ENV{VORBISDIR} 55 | $ENV{VORBIS_PATH} 56 | PATH_SUFFIXES lib lib64 win32/Vorbis_Dynamic_Debug "Win32/${MSVC_YEAR_NAME}/x64/Debug" "Win32/${MSVC_YEAR_NAME}/Win32/Debug" 57 | PATHS ${VORBIS_SEARCH_PATHS} 58 | ) 59 | 60 | IF(NOT VORBIS_LIBRARY_DEBUG) 61 | # Then search for non suffixed libs if necessary, but only in debug dirs 62 | FIND_LIBRARY(VORBIS_LIBRARY_DEBUG 63 | NAMES vorbis libvorbis 64 | HINTS 65 | $ENV{VORBISDIR} 66 | $ENV{VORBIS_PATH} 67 | PATH_SUFFIXES win32/Vorbis_Dynamic_Debug "Win32/${MSVC_YEAR_NAME}/x64/Debug" "Win32/${MSVC_YEAR_NAME}/Win32/Debug" 68 | PATHS ${VORBIS_SEARCH_PATHS} 69 | ) 70 | ENDIF() 71 | 72 | 73 | IF(VORBIS_LIBRARY) 74 | IF(VORBIS_LIBRARY_DEBUG) 75 | SET(VORBIS_LIBRARIES optimized "${VORBIS_LIBRARY}" debug "${VORBIS_LIBRARY_DEBUG}") 76 | ELSE() 77 | SET(VORBIS_LIBRARIES "${VORBIS_LIBRARY}") # Could add "general" keyword, but it is optional 78 | ENDIF() 79 | ENDIF() 80 | 81 | # handle the QUIETLY and REQUIRED arguments and set XXX_FOUND to TRUE if all listed variables are TRUE 82 | INCLUDE(FindPackageHandleStandardArgs) 83 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(VORBIS DEFAULT_MSG VORBIS_LIBRARIES VORBIS_INCLUDE_DIR) 84 | -------------------------------------------------------------------------------- /neo/sys/cmake/FindVorbisFile.cmake: -------------------------------------------------------------------------------- 1 | # Locate VorbisFile 2 | # This module defines XXX_FOUND, XXX_INCLUDE_DIRS and XXX_LIBRARIES standard variables 3 | # 4 | # $VORBISDIR is an environment variable that would 5 | # correspond to the ./configure --prefix=$VORBISDIR 6 | # used in building Vorbis. 7 | 8 | SET(VORBISFILE_SEARCH_PATHS 9 | ~/Library/Frameworks 10 | /Library/Frameworks 11 | /usr/local 12 | /usr 13 | /sw # Fink 14 | /opt/local # DarwinPorts 15 | /opt/csw # Blastwave 16 | /opt 17 | ) 18 | 19 | SET(MSVC_YEAR_NAME) 20 | IF (MSVC_VERSION GREATER 1599) # >= 1600 21 | SET(MSVC_YEAR_NAME VS2010) 22 | ELSEIF(MSVC_VERSION GREATER 1499) # >= 1500 23 | SET(MSVC_YEAR_NAME VS2008) 24 | ELSEIF(MSVC_VERSION GREATER 1399) # >= 1400 25 | SET(MSVC_YEAR_NAME VS2005) 26 | ELSEIF(MSVC_VERSION GREATER 1299) # >= 1300 27 | SET(MSVC_YEAR_NAME VS2003) 28 | ELSEIF(MSVC_VERSION GREATER 1199) # >= 1200 29 | SET(MSVC_YEAR_NAME VS6) 30 | ENDIF() 31 | 32 | FIND_PATH(VORBISFILE_INCLUDE_DIR 33 | NAMES vorbis/vorbisfile.h 34 | HINTS 35 | $ENV{VORBISFILEDIR} 36 | $ENV{VORBISFILE_PATH} 37 | $ENV{VORBISDIR} 38 | $ENV{VORBIS_PATH} 39 | PATH_SUFFIXES include 40 | PATHS ${VORBISFILE_SEARCH_PATHS} 41 | ) 42 | 43 | FIND_LIBRARY(VORBISFILE_LIBRARY 44 | NAMES vorbisfile libvorbisfile 45 | HINTS 46 | $ENV{VORBISFILEDIR} 47 | $ENV{VORBISFILE_PATH} 48 | $ENV{VORBISDIR} 49 | $ENV{VORBIS_PATH} 50 | PATH_SUFFIXES lib lib64 win32/VorbisFile_Dynamic_Release "Win32/${MSVC_YEAR_NAME}/x64/Release" "Win32/${MSVC_YEAR_NAME}/Win32/Release" 51 | PATHS ${VORBISFILE_SEARCH_PATHS} 52 | ) 53 | 54 | # First search for d-suffixed libs 55 | FIND_LIBRARY(VORBISFILE_LIBRARY_DEBUG 56 | NAMES vorbisfiled vorbisfile_d libvorbisfiled libvorbisfile_d 57 | HINTS 58 | $ENV{VORBISFILEDIR} 59 | $ENV{VORBISFILE_PATH} 60 | $ENV{VORBISDIR} 61 | $ENV{VORBIS_PATH} 62 | PATH_SUFFIXES lib lib64 win32/VorbisFile_Dynamic_Debug "Win32/${MSVC_YEAR_NAME}/x64/Debug" "Win32/${MSVC_YEAR_NAME}/Win32/Debug" 63 | PATHS ${VORBISFILE_SEARCH_PATHS} 64 | ) 65 | 66 | IF(NOT VORBISFILE_LIBRARY_DEBUG) 67 | # Then search for non suffixed libs if necessary, but only in debug dirs 68 | FIND_LIBRARY(VORBISFILE_LIBRARY_DEBUG 69 | NAMES vorbisfile libvorbisfile 70 | HINTS 71 | $ENV{VORBISFILEDIR} 72 | $ENV{VORBISFILE_PATH} 73 | $ENV{VORBISDIR} 74 | $ENV{VORBIS_PATH} 75 | PATH_SUFFIXES win32/VorbisFile_Dynamic_Debug "Win32/${MSVC_YEAR_NAME}/x64/Debug" "Win32/${MSVC_YEAR_NAME}/Win32/Debug" 76 | PATHS ${VORBISFILE_SEARCH_PATHS} 77 | ) 78 | ENDIF() 79 | 80 | 81 | IF(VORBISFILE_LIBRARY) 82 | IF(VORBISFILE_LIBRARY_DEBUG) 83 | SET(VORBISFILE_LIBRARIES optimized "${VORBISFILE_LIBRARY}" debug "${VORBISFILE_LIBRARY_DEBUG}") 84 | ELSE() 85 | SET(VORBISFILE_LIBRARIES "${VORBISFILE_LIBRARY}") # Could add "general" keyword, but it is optional 86 | ENDIF() 87 | ENDIF() 88 | 89 | # handle the QUIETLY and REQUIRED arguments and set XXX_FOUND to TRUE if all listed variables are TRUE 90 | INCLUDE(FindPackageHandleStandardArgs) 91 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(VORBISFILE DEFAULT_MSG VORBISFILE_LIBRARIES VORBISFILE_INCLUDE_DIR) 92 | -------------------------------------------------------------------------------- /neo/sys/cpu.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include 30 | 31 | #include 32 | 33 | // MSVC header intrin.h uses strcmp and errors out when not set 34 | #define IDSTR_NO_REDIRECT 35 | 36 | #include "sys/platform.h" 37 | #include "framework/Common.h" 38 | 39 | #include "sys/sys_public.h" 40 | 41 | void Sys_FPU_SetDAZ(bool enable) { 42 | } 43 | 44 | void Sys_FPU_SetFTZ(bool enable) { 45 | } 46 | 47 | /* 48 | ================ 49 | Sys_GetProcessorId 50 | ================ 51 | */ 52 | int Sys_GetProcessorId(void) { 53 | int flags = CPUID_GENERIC; 54 | 55 | if ( SDL_HasMMX()) { 56 | flags |= CPUID_MMX; 57 | } 58 | 59 | if ( SDL_HasSSE()) { 60 | flags |= CPUID_SSE; 61 | } 62 | 63 | if ( SDL_HasSSE2()) { 64 | flags |= CPUID_SSE2; 65 | } 66 | 67 | if ( SDL_HasSSE3()) { 68 | flags |= CPUID_SSE3; 69 | } 70 | 71 | return flags; 72 | } 73 | 74 | /* 75 | =============== 76 | Sys_FPU_SetPrecision 77 | =============== 78 | */ 79 | void Sys_FPU_SetPrecision() { 80 | 81 | } 82 | -------------------------------------------------------------------------------- /neo/sys/posix/posix_public.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __SYS_POSIX__ 30 | #define __SYS_POSIX__ 31 | 32 | #include 33 | 34 | #include "sys/sys_public.h" 35 | 36 | const char* Posix_Cwd( void ); 37 | 38 | void Posix_Exit( int ret ); 39 | void Posix_SetExit(int ret); // override the exit code 40 | void Posix_SetExitSpawn( const char *exeName ); // set the process to be spawned when we quit 41 | 42 | //void Posix_InitSignalHandlers( void ); 43 | void Posix_InitConsoleInput( void ); 44 | void Posix_Shutdown( void ); 45 | 46 | void Sys_DoStartProcess( const char *exeName, bool dofork = true ); // if not forking, current process gets replaced 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /neo/sys/sys_local.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __SYS_LOCAL__ 30 | #define __SYS_LOCAL__ 31 | 32 | #include "renderer/RenderSystem.h" 33 | #include "sound/sound.h" 34 | #include "sys/sys_public.h" 35 | 36 | /* 37 | ============================================================== 38 | 39 | idSysLocal 40 | 41 | ============================================================== 42 | */ 43 | 44 | class idSysLocal : public idSys { 45 | public: 46 | virtual void DebugPrintf( const char *fmt, ... )id_attribute((format(printf,2,3))); 47 | virtual void DebugVPrintf( const char *fmt, va_list arg ); 48 | 49 | virtual unsigned int GetMilliseconds( void ); 50 | virtual int GetProcessorId( void ); 51 | virtual void FPU_SetFTZ( bool enable ); 52 | virtual void FPU_SetDAZ( bool enable ); 53 | 54 | virtual bool LockMemory( void *ptr, int bytes ); 55 | virtual bool UnlockMemory( void *ptr, int bytes ); 56 | 57 | virtual uintptr_t DLL_Load( const char *dllName ); 58 | virtual void * DLL_GetProcAddress( uintptr_t dllHandle, const char *procName ); 59 | virtual void DLL_Unload( uintptr_t dllHandle ); 60 | virtual void DLL_GetFileName( const char *baseName, char *dllName, int maxLength ); 61 | 62 | virtual sysEvent_t GenerateMouseButtonEvent( int button, bool down ); 63 | virtual sysEvent_t GenerateMouseMoveEvent( int deltax, int deltay ); 64 | 65 | virtual void OpenURL( const char *url, bool quit ); 66 | virtual void StartProcess( const char *exeName, bool quit ); 67 | }; 68 | 69 | #endif /* !__SYS_LOCAL__ */ 70 | -------------------------------------------------------------------------------- /neo/sys/wasm/asyncify.json: -------------------------------------------------------------------------------- 1 | ["Com_ReloadEngine_f(idCmdArgs const&)","dynCall_v","emloopcb","idAsyncClient::HandleDownloads()","idAsyncClient::RunFrame()","idCmdSystemLocal::ExecuteCommandBuffer()","idSessionLocal::UnloadMap()","idCmdSystemLocal::ExecuteTokenizedString(idCmdArgs const&)","idCommonLocal::Frame()","idCommonLocal::GUIFrame(bool, bool)","idCommonLocal::Init(int, char**)","idCommonLocal::InitGame()","idCommonLocal::InitRenderSystem()","idCommonLocal::PrintLoadingMessage(char const*)","idEventLoop::ProcessEvent(sysEvent_t)","idSessionLocal::ProcessEvent(sysEvent_t const*)","idEventLoop::RunEventLoop(bool)","idGameLocal::InitFromNewMap(char const*, idRenderWorld*, idSoundWorld*, bool, bool, int)","idGameLocal::LoadMap(char const*, int)","idGameLocal::MapPopulate()","idGameLocal::SpawnMapEntities()","idImageManager::EndLevelLoad()","idRenderModelManagerLocal::EndLevelLoad()","idRenderSystemLocal::EndLevelLoad()","idSessionLocal::AdvanceRenderDemo(bool)","idSessionLocal::CompleteWipe()","idSessionLocal::DispatchCommand(idUserInterface*, char const*, bool)","idSessionLocal::DownloadProgressBox(backgroundDownload_t*, char const*, int, int)","idSessionLocal::ExecuteMapChange(bool)","idSessionLocal::Frame()","idSessionLocal::GuiFrameEvents()","idSessionLocal::HandleMainMenuCommands(char const*)","idSessionLocal::HandleMsgCommands(char const*)","idSessionLocal::HandleRestartMenuCommands(char const*)","idSessionLocal::HandleSaveGameMenuCommand(idCmdArgs&, int&)","idSessionLocal::LoadGame(char const*)","idSessionLocal::MenuEvent(sysEvent_t const*)","idSessionLocal::MessageBox(msgBoxType_t, char const*, char const*, bool, char const*, char const*, bool)","idSessionLocal::MoveToNewMap(char const*)","idSessionLocal::ProcessEvent(sysEvent_t const*)","idSessionLocal::SaveGame(char const*, bool)","idSessionLocal::ShowLoadingGui()","idSessionLocal::StartMenu(bool)","idSessionLocal::StartNewGame(char const*, bool)","idSessionLocal::StartPlayingCmdDemo(char const*)","idSessionLocal::StartPlayingRenderDemo(idStr)","idSessionLocal::Stop()","idSessionLocal::StopBox()","idSessionLocal::StopPlayingRenderDemo()","idSessionLocal::TimeCmdDemo(char const*)","idSessionLocal::TimeRenderDemo(char const*, bool)","LoadGame_f(idCmdArgs const&)","main","Session_DevMap_f(idCmdArgs const&)","Session_Map_f(idCmdArgs const&)","Session_NextMap_f(idCmdArgs const&)","Session_PromptKey_f(idCmdArgs const&)","Session_TimeCmdDemo_f(idCmdArgs const&)","Session_TimeDemo_f(idCmdArgs const&)","Session_TimeDemoQuit_f(idCmdArgs const&)"] -------------------------------------------------------------------------------- /neo/sys/wasm/asyncify.win.json: -------------------------------------------------------------------------------- 1 | [\"Com_ReloadEngine_f(idCmdArgs const"&")\",\"dynCall_v\",\"emloopcb\",\"idAsyncClient::HandleDownloads()\",\"idAsyncClient::RunFrame()\",\"idCmdSystemLocal::ExecuteCommandBuffer()\",\"idSessionLocal::UnloadMap()\",\"idCmdSystemLocal::ExecuteTokenizedString(idCmdArgs const"&")\",\"idCommonLocal::Frame()\",\"idCommonLocal::GUIFrame(bool, bool)\",\"idCommonLocal::Init(int, char**)\",\"idCommonLocal::InitGame()\",\"idCommonLocal::InitRenderSystem()\",\"idCommonLocal::PrintLoadingMessage(char const*)\",\"idEventLoop::ProcessEvent(sysEvent_t)\",\"idSessionLocal::ProcessEvent(sysEvent_t const*)\",\"idEventLoop::RunEventLoop(bool)\",\"idGameLocal::InitFromNewMap(char const*, idRenderWorld*, idSoundWorld*, bool, bool, int)\",\"idGameLocal::LoadMap(char const*, int)\",\"idGameLocal::MapPopulate()\",\"idGameLocal::SpawnMapEntities()\",\"idImageManager::EndLevelLoad()\",\"idRenderModelManagerLocal::EndLevelLoad()\",\"idRenderSystemLocal::EndLevelLoad()\",\"idSessionLocal::AdvanceRenderDemo(bool)\",\"idSessionLocal::CompleteWipe()\",\"idSessionLocal::DispatchCommand(idUserInterface*, char const*, bool)\",\"idSessionLocal::DownloadProgressBox(backgroundDownload_t*, char const*, int, int)\",\"idSessionLocal::ExecuteMapChange(bool)\",\"idSessionLocal::Frame()\",\"idSessionLocal::GuiFrameEvents()\",\"idSessionLocal::HandleMainMenuCommands(char const*)\",\"idSessionLocal::HandleMsgCommands(char const*)\",\"idSessionLocal::HandleRestartMenuCommands(char const*)\",\"idSessionLocal::HandleSaveGameMenuCommand(idCmdArgs"&", int"&")\",\"idSessionLocal::LoadGame(char const*)\",\"idSessionLocal::MenuEvent(sysEvent_t const*)\",\"idSessionLocal::MessageBox(msgBoxType_t, char const*, char const*, bool, char const*, char const*, bool)\",\"idSessionLocal::MoveToNewMap(char const*)\",\"idSessionLocal::ProcessEvent(sysEvent_t const*)\",\"idSessionLocal::SaveGame(char const*, bool)\",\"idSessionLocal::ShowLoadingGui()\",\"idSessionLocal::StartMenu(bool)\",\"idSessionLocal::StartNewGame(char const*, bool)\",\"idSessionLocal::StartPlayingCmdDemo(char const*)\",\"idSessionLocal::StartPlayingRenderDemo(idStr)\",\"idSessionLocal::Stop()\",\"idSessionLocal::StopBox()\",\"idSessionLocal::StopPlayingRenderDemo()\",\"idSessionLocal::TimeCmdDemo(char const*)\",\"idSessionLocal::TimeRenderDemo(char const*, bool)\",\"LoadGame_f(idCmdArgs const"&")\",\"main\",\"Session_DevMap_f(idCmdArgs const"&")\",\"Session_Map_f(idCmdArgs const"&")\",\"Session_NextMap_f(idCmdArgs const"&")\",\"Session_PromptKey_f(idCmdArgs const"&")\",\"Session_TimeCmdDemo_f(idCmdArgs const"&")\",\"Session_TimeDemo_f(idCmdArgs const"&")\",\"Session_TimeDemoQuit_f(idCmdArgs const"&")\"] -------------------------------------------------------------------------------- /neo/sys/wasm/package_chunked_demo_data.bat: -------------------------------------------------------------------------------- 1 | python %EMSDK%/upstream/emscripten/tools/file_packager.py demo_bootstrap.data --preload %1/demo_bootstrap.pk4@/usr/local/share/d3wasm/base/demo_bootstrap.pk4 --js-output=demo_bootstrap.js --use-preload-cache --no-heap-copy 2 | python %EMSDK%/upstream/emscripten/tools/file_packager.py demo_game00.data --preload %1/demo_game00.pk4@/usr/local/share/d3wasm/base/demo_game00.pk4 --js-output=demo_game00.js --use-preload-cache --no-heap-copy 3 | python %EMSDK%/upstream/emscripten/tools/file_packager.py demo_game01.data --preload %1/demo_game01.pk4@/usr/local/share/d3wasm/base/demo_game01.pk4 --js-output=demo_game01.js --use-preload-cache --no-heap-copy 4 | -------------------------------------------------------------------------------- /neo/sys/wasm/package_chunked_demo_data.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | python $(dirname $(which emcc))/tools/file_packager.py demo_bootstrap.data --preload $1/demo_bootstrap.pk4@/usr/local/share/d3wasm/base/demo_bootstrap.pk4 --js-output=demo_bootstrap.js --use-preload-cache --no-heap-copy 3 | python $(dirname $(which emcc))/tools/file_packager.py demo_game00.data --preload $1/demo_game00.pk4@/usr/local/share/d3wasm/base/demo_game00.pk4 --js-output=demo_game00.js --use-preload-cache --no-heap-copy 4 | python $(dirname $(which emcc))/tools/file_packager.py demo_game01.data --preload $1/demo_game01.pk4@/usr/local/share/d3wasm/base/demo_game01.pk4 --js-output=demo_game01.js --use-preload-cache --no-heap-copy 5 | -------------------------------------------------------------------------------- /neo/sys/wasm/package_demo_data.bat: -------------------------------------------------------------------------------- 1 | python %EMSDK%/upstream/emscripten/tools/file_packager.py demo00.data --preload %1/demo00.pk4@/usr/local/share/d3wasm/base/demo00.pk4 --js-output=demo00.js --use-preload-cache --no-heap-copy 2 | -------------------------------------------------------------------------------- /neo/sys/wasm/package_demo_data.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | python $(dirname $(which emcc))/tools/file_packager.py demo00.data --preload $1/demo00.pk4@/usr/local/share/d3wasm/base/demo00.pk4 --js-output=demo00.js --use-preload-cache --no-heap-copy 3 | -------------------------------------------------------------------------------- /neo/sys/wasm/post-chunked.js: -------------------------------------------------------------------------------- 1 | (function(d, script) { 2 | script = d.createElement('script'); 3 | script.type = 'text/javascript'; 4 | script.async = true; 5 | script.onload = function(){ 6 | // remote script has loaded 7 | }; 8 | script.src = 'demo_game00.js'; 9 | d.getElementsByTagName('head')[0].appendChild(script); 10 | }(document)); 11 | 12 | (function(d, script) { 13 | script = d.createElement('script'); 14 | script.type = 'text/javascript'; 15 | script.async = true; 16 | script.onload = function(){ 17 | // remote script has loaded 18 | }; 19 | script.src = 'demo_game01.js'; 20 | d.getElementsByTagName('head')[0].appendChild(script); 21 | }(document)); 22 | -------------------------------------------------------------------------------- /neo/sys/wasm/pre-chunked.js: -------------------------------------------------------------------------------- 1 | var Module; 2 | if (Module['preRun'] instanceof Array) { 3 | Module['preRun'].push(setupD3memfs); 4 | } else { 5 | Module['preRun'] = [setupD3memfs]; 6 | } 7 | 8 | (function(d, script) { 9 | script = d.createElement('script'); 10 | script.type = 'text/javascript'; 11 | script.async = false; 12 | script.onload = function(){ 13 | // remote script has loaded 14 | }; 15 | script.src = 'demo_bootstrap.js'; 16 | d.getElementsByTagName('head')[0].appendChild(script); 17 | }(document)); 18 | 19 | function setupD3memfs() { 20 | console.info("Creating d3wasm data folder (/usr/local/share/d3wasm/base)"); 21 | FS.createPath('/', 'usr', true, true); 22 | FS.createPath('/usr', 'local', true, true); 23 | FS.createPath('/usr/local', 'share', true, true); 24 | FS.createPath('/usr/local/share', 'd3wasm', true, true); 25 | FS.createPath('/usr/local/share/d3wasm', 'base', true, true); 26 | 27 | console.info("Creating user home folder (/home/web_user)"); 28 | FS.createPath('/', 'home', true, true); 29 | FS.createPath('/home', 'web_user', true, true); 30 | 31 | console.info("Mounting user home to IDBFS"); 32 | FS.mount(IDBFS, {}, '/home/web_user'); 33 | 34 | FS.syncfs(true, function (err) { 35 | if (err) { 36 | console.error(err); 37 | } 38 | else { 39 | console.info("Mounting user home completed"); 40 | console.info("Creating user home config and local folders if necessary (~/.config, ~/.local/d3wasm/base)"); 41 | FS.createPath('/home/web_user', '.config', true, true); 42 | FS.createPath('/home/web_user/.config', 'd3wasm', true, true); 43 | FS.createPath('/home/web_user', '.local', true, true); 44 | FS.createPath('/home/web_user/.local', 'd3wasm', true, true); 45 | FS.createPath('/home/web_user/.local/d3wasm', 'base', true, true); 46 | Module['removeRunDependency']("setupD3memfs"); 47 | } 48 | }); 49 | 50 | Module['addRunDependency']("setupD3memfs"); 51 | } 52 | -------------------------------------------------------------------------------- /neo/sys/wasm/pre.js: -------------------------------------------------------------------------------- 1 | var Module; 2 | if (Module['preRun'] instanceof Array) { 3 | Module['preRun'].push(setupD3memfs); 4 | } else { 5 | Module['preRun'] = [setupD3memfs]; 6 | } 7 | 8 | (function(d, script) { 9 | script = d.createElement('script'); 10 | script.type = 'text/javascript'; 11 | script.async = false; 12 | script.onload = function(){ 13 | // remote script has loaded 14 | }; 15 | script.src = 'demo00.js'; 16 | d.getElementsByTagName('head')[0].appendChild(script); 17 | }(document)); 18 | 19 | function setupD3memfs() { 20 | console.info("Creating d3wasm data folder (/usr/local/share/d3wasm/base)"); 21 | FS.createPath('/', 'usr', true, true); 22 | FS.createPath('/usr', 'local', true, true); 23 | FS.createPath('/usr/local', 'share', true, true); 24 | FS.createPath('/usr/local/share', 'd3wasm', true, true); 25 | FS.createPath('/usr/local/share/d3wasm', 'base', true, true); 26 | 27 | console.info("Creating user home folder (/home/web_user)"); 28 | FS.createPath('/', 'home', true, true); 29 | FS.createPath('/home', 'web_user', true, true); 30 | 31 | console.info("Mounting user home to IDBFS"); 32 | FS.mount(IDBFS, {}, '/home/web_user'); 33 | 34 | FS.syncfs(true, function (err) { 35 | if (err) { 36 | console.error(err); 37 | } 38 | else { 39 | console.info("Mounting user home completed"); 40 | console.info("Creating user home config and local folders if necessary (~/.config, ~/.local/d3wasm/base)"); 41 | FS.createPath('/home/web_user', '.config', true, true); 42 | FS.createPath('/home/web_user/.config', 'd3wasm', true, true); 43 | FS.createPath('/home/web_user', '.local', true, true); 44 | FS.createPath('/home/web_user/.local', 'd3wasm', true, true); 45 | FS.createPath('/home/web_user/.local/d3wasm', 'base', true, true); 46 | Module['removeRunDependency']("setupD3memfs"); 47 | } 48 | }); 49 | 50 | Module['addRunDependency']("setupD3memfs"); 51 | } 52 | -------------------------------------------------------------------------------- /neo/tools/compilers/aas/AASCluster.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __AASCLUSTER_H__ 30 | #define __AASCLUSTER_H__ 31 | 32 | #include "tools/compilers/aas/AASBuild_local.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | Area Clustering 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idAASCluster { 43 | 44 | public: 45 | bool Build( idAASFileLocal *file ); 46 | bool BuildSingleCluster( idAASFileLocal *file ); 47 | 48 | private: 49 | idAASFileLocal * file; 50 | bool noFaceFlood; 51 | 52 | private: 53 | bool UpdatePortal( int areaNum, int clusterNum ); 54 | bool FloodClusterAreas_r( int areaNum, int clusterNum ); 55 | void RemoveAreaClusterNumbers( void ); 56 | void NumberClusterAreas( int clusterNum ); 57 | bool FindClusters( void ); 58 | void CreatePortals( void ); 59 | bool TestPortals( void ); 60 | void ReportEfficiency( void ); 61 | void RemoveInvalidPortals( void ); 62 | }; 63 | 64 | #endif /* !__AASCLUSTER_H__ */ 65 | -------------------------------------------------------------------------------- /neo/tools/compilers/aas/AASFileManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | #include "tools/compilers/aas/AASFileManager.h" 31 | 32 | #include "tools/compilers/aas/AASFile_local.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | AAS File Manager 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idAASFileManagerLocal : public idAASFileManager { 43 | public: 44 | virtual ~idAASFileManagerLocal( void ) {} 45 | 46 | virtual idAASFile * LoadAAS( const char *fileName, unsigned int mapFileCRC ); 47 | virtual void FreeAAS( idAASFile *file ); 48 | }; 49 | 50 | idAASFileManagerLocal AASFileManagerLocal; 51 | idAASFileManager * AASFileManager = &AASFileManagerLocal; 52 | 53 | 54 | /* 55 | ================ 56 | idAASFileManagerLocal::LoadAAS 57 | ================ 58 | */ 59 | idAASFile *idAASFileManagerLocal::LoadAAS( const char *fileName, unsigned int mapFileCRC ) { 60 | idAASFileLocal *file = new idAASFileLocal(); 61 | if ( !file->Load( fileName, mapFileCRC ) ) { 62 | delete file; 63 | return NULL; 64 | } 65 | return file; 66 | } 67 | 68 | /* 69 | ================ 70 | idAASFileManagerLocal::FreeAAS 71 | ================ 72 | */ 73 | void idAASFileManagerLocal::FreeAAS( idAASFile *file ) { 74 | delete file; 75 | } 76 | -------------------------------------------------------------------------------- /neo/tools/compilers/aas/AASFileManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __AASFILEMANAGER_H__ 30 | #define __AASFILEMANAGER_H__ 31 | 32 | #include "tools/compilers/aas/AASFile.h" 33 | 34 | /* 35 | =============================================================================== 36 | 37 | AAS File Manager 38 | 39 | =============================================================================== 40 | */ 41 | 42 | class idAASFileManager { 43 | public: 44 | virtual ~idAASFileManager( void ) {} 45 | 46 | virtual idAASFile * LoadAAS( const char *fileName, unsigned int mapFileCRC ) = 0; 47 | virtual void FreeAAS( idAASFile *file ) = 0; 48 | }; 49 | 50 | extern idAASFileManager * AASFileManager; 51 | 52 | #endif /* !__AASFILEMANAGER_H__ */ 53 | -------------------------------------------------------------------------------- /neo/tools/compilers/aas/AASReach.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __AASREACH_H__ 30 | #define __AASREACH_H__ 31 | 32 | #include "idlib/MapFile.h" 33 | #include "tools/compilers/aas/AASFile_local.h" 34 | 35 | /* 36 | =============================================================================== 37 | 38 | Reachabilities 39 | 40 | =============================================================================== 41 | */ 42 | 43 | class idAASReach { 44 | 45 | public: 46 | bool Build( const idMapFile *mapFile, idAASFileLocal *file ); 47 | 48 | private: 49 | const idMapFile * mapFile; 50 | idAASFileLocal * file; 51 | int numReachabilities; 52 | bool allowSwimReachabilities; 53 | bool allowFlyReachabilities; 54 | 55 | private: // reachability 56 | void FlagReachableAreas( idAASFileLocal *file ); 57 | bool ReachabilityExists( int fromAreaNum, int toAreaNum ); 58 | bool CanSwimInArea( int areaNum ); 59 | bool AreaHasFloor( int areaNum ); 60 | bool AreaIsClusterPortal( int areaNum ); 61 | void AddReachabilityToArea( idReachability *reach, int areaNum ); 62 | void Reachability_Fly( int areaNum ); 63 | void Reachability_Swim( int areaNum ); 64 | void Reachability_EqualFloorHeight( int areaNum ); 65 | bool Reachability_Step_Barrier_WaterJump_WalkOffLedge( int fromAreaNum, int toAreaNum ); 66 | void Reachability_WalkOffLedge( int areaNum ); 67 | 68 | }; 69 | 70 | #endif /* !__AASREACH_H__ */ 71 | -------------------------------------------------------------------------------- /neo/ui/BindWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | #ifndef __BINDWINDOW_H 29 | #define __BINDWINDOW_H 30 | 31 | #include "ui/Window.h" 32 | 33 | class idUserInterfaceLocal; 34 | 35 | class idBindWindow : public idWindow { 36 | public: 37 | idBindWindow(idUserInterfaceLocal *gui); 38 | idBindWindow(idDeviceContext *d, idUserInterfaceLocal *gui); 39 | virtual ~idBindWindow(); 40 | 41 | virtual const char *HandleEvent(const sysEvent_t *event, bool *updateVisuals); 42 | virtual void PostParse(); 43 | virtual void Draw(int time, float x, float y); 44 | virtual size_t Allocated(){return idWindow::Allocated();}; 45 | // 46 | // 47 | virtual idWinVar *GetWinVarByName(const char *_name, bool winLookup = false, drawWin_t** owner = NULL ); 48 | // 49 | virtual void Activate( bool activate, idStr &act ); 50 | 51 | private: 52 | void CommonInit(); 53 | idWinStr bindName; 54 | bool waitingOnKey; 55 | }; 56 | 57 | #endif // __BINDWINDOW_H 58 | -------------------------------------------------------------------------------- /neo/ui/FieldWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | #ifndef __FIELDWINDOW_H 29 | #define __FIELDWINDOW_H 30 | 31 | #include "ui/Window.h" 32 | 33 | class idFieldWindow : public idWindow { 34 | public: 35 | idFieldWindow(idUserInterfaceLocal *gui); 36 | idFieldWindow(idDeviceContext *d, idUserInterfaceLocal *gui); 37 | virtual ~idFieldWindow(); 38 | 39 | virtual void Draw(int time, float x, float y); 40 | 41 | private: 42 | virtual bool ParseInternalVar(const char *name, idParser *src); 43 | void CommonInit(); 44 | void CalcPaintOffset(int len); 45 | int cursorPos; 46 | int lastTextLength; 47 | int lastCursorPos; 48 | int paintOffset; 49 | bool showCursor; 50 | idStr cursorVar; 51 | }; 52 | 53 | #endif // __FIELDWINDOW_H 54 | -------------------------------------------------------------------------------- /neo/ui/GameWindow.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | #include "ui/DeviceContext.h" 31 | #include "ui/Window.h" 32 | #include "ui/UserInterfaceLocal.h" 33 | 34 | #include "ui/GameWindow.h" 35 | 36 | /* 37 | ================ 38 | idGameWindowProxy::idGameWindowProxy 39 | ================ 40 | */ 41 | idGameWindowProxy::idGameWindowProxy( idDeviceContext *d, idUserInterfaceLocal *g ) : idWindow( d, g ) { } 42 | 43 | /* 44 | ================ 45 | idGameWindowProxy::Draw 46 | ================ 47 | */ 48 | void idGameWindowProxy::Draw( int time, float x, float y ) { 49 | common->Printf( "TODO: idGameWindowProxy::Draw\n" ); 50 | } 51 | -------------------------------------------------------------------------------- /neo/ui/GameWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __GAMEWINDOW_H__ 30 | #define __GAMEWINDOW_H__ 31 | 32 | #include "ui/Window.h" 33 | 34 | class idGameWindowProxy : public idWindow { 35 | public: 36 | idGameWindowProxy( idDeviceContext *d, idUserInterfaceLocal *gui ); 37 | void Draw( int time, float x, float y ); 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /neo/ui/ListGUI.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __LISTGUI_H__ 30 | #define __LISTGUI_H__ 31 | 32 | #include "idlib/Str.h" 33 | 34 | class idUserInterface; 35 | 36 | /* 37 | =============================================================================== 38 | 39 | feed data to a listDef 40 | each item has an id and a display string 41 | 42 | =============================================================================== 43 | */ 44 | 45 | class idListGUI { 46 | public: 47 | virtual ~idListGUI() { } 48 | 49 | virtual void Config( idUserInterface *pGUI, const char *name ) = 0; 50 | virtual void Add( int id, const idStr& s ) = 0; 51 | // use the element count as index for the ids 52 | virtual void Push( const idStr& s ) = 0; 53 | virtual bool Del( int id ) = 0; 54 | virtual void Clear( void ) = 0; 55 | virtual int Num( void ) = 0; 56 | virtual int GetSelection( char *s, int size, int sel = 0 ) const = 0; // returns the id, not the list index (or -1) 57 | virtual void SetSelection( int sel ) = 0; 58 | virtual int GetNumSelections() = 0; 59 | virtual bool IsConfigured( void ) const = 0; 60 | // by default, any modification to the list will trigger a full GUI refresh immediately 61 | virtual void SetStateChanges( bool enable ) = 0; 62 | virtual void Shutdown( void ) = 0; 63 | }; 64 | 65 | #endif /* !__LISTGUI_H__ */ 66 | -------------------------------------------------------------------------------- /neo/ui/ListGUILocal.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #ifndef __LISTGUILOCAL_H__ 30 | #define __LISTGUILOCAL_H__ 31 | 32 | #include "idlib/containers/List.h" 33 | #include "ui/ListGUI.h" 34 | 35 | /* 36 | =============================================================================== 37 | 38 | feed data to a listDef 39 | each item has an id and a display string 40 | 41 | =============================================================================== 42 | */ 43 | 44 | class idListGUILocal : protected idList, public idListGUI { 45 | public: 46 | idListGUILocal() { m_pGUI = NULL; m_water = 0; m_stateUpdates = true; } 47 | 48 | // idListGUI interface 49 | void Config( idUserInterface *pGUI, const char *name ) { m_pGUI = pGUI; m_name = name; } 50 | void Add( int id, const idStr& s ); 51 | // use the element count as index for the ids 52 | void Push( const idStr& s ); 53 | bool Del( int id ); 54 | void Clear( void ); 55 | int Num( void ) { return idList::Num(); } 56 | int GetSelection( char *s, int size, int sel = 0 ) const; // returns the id, not the list index (or -1) 57 | void SetSelection( int sel ); 58 | int GetNumSelections(); 59 | bool IsConfigured( void ) const; 60 | void SetStateChanges( bool enable ); 61 | void Shutdown( void ); 62 | 63 | private: 64 | idUserInterface * m_pGUI; 65 | idStr m_name; 66 | int m_water; 67 | idList m_ids; 68 | bool m_stateUpdates; 69 | 70 | void StateChanged(); 71 | }; 72 | 73 | #endif /* !__LISTGUILOCAL_H__ */ 74 | -------------------------------------------------------------------------------- /neo/ui/MarkerWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | #ifndef __MARKERWINDOW_H 29 | #define __MARKERWINDOW_H 30 | 31 | #include "framework/Session.h" 32 | #include "ui/Window.h" 33 | 34 | class idUserInterfaceLocal; 35 | 36 | typedef struct { 37 | int time; 38 | const idMaterial *mat; 39 | idRectangle rect; 40 | } markerData_t; 41 | 42 | class idMarkerWindow : public idWindow { 43 | public: 44 | idMarkerWindow(idUserInterfaceLocal *gui); 45 | idMarkerWindow(idDeviceContext *d, idUserInterfaceLocal *gui); 46 | virtual ~idMarkerWindow(); 47 | virtual size_t Allocated(){return idWindow::Allocated();}; 48 | 49 | virtual const char *HandleEvent(const sysEvent_t *event, bool *updateVisuals); 50 | virtual void PostParse(); 51 | virtual void Draw(int time, float x, float y); 52 | virtual const char *RouteMouseCoords(float xd, float yd); 53 | virtual void Activate(bool activate, idStr &act); 54 | virtual void MouseExit(); 55 | virtual void MouseEnter(); 56 | 57 | 58 | private: 59 | virtual bool ParseInternalVar(const char *name, idParser *src); 60 | void CommonInit(); 61 | void Line(int x1, int y1, int x2, int y2, dword* out, dword color); 62 | void Point(int x, int y, dword *out, dword color); 63 | logStats_t loggedStats[MAX_LOGGED_STATS]; 64 | idList markerTimes; 65 | idStr statData; 66 | int numStats; 67 | dword *imageBuff; 68 | const idMaterial *markerMat; 69 | const idMaterial *markerStop; 70 | idVec4 markerColor; 71 | int currentMarker; 72 | int currentTime; 73 | int stopTime; 74 | }; 75 | 76 | #endif // __MARKERWINDOW_H 77 | -------------------------------------------------------------------------------- /neo/ui/RegExp_old.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | #ifndef REGEXP_H_ 29 | #define REGEXP_H_ 30 | 31 | class idWindow; 32 | 33 | class idRegister { 34 | public: 35 | idRegister() {}; 36 | idRegister(const char *p, int t) { 37 | name = p; 38 | type = t; 39 | assert(t >= 0 && t < NUMTYPES); 40 | regCount = REGCOUNT[t]; 41 | enabled = (type == STRING) ? false : true; 42 | }; 43 | bool enabled; 44 | int type; 45 | int regCount; 46 | enum REGTYPE { VEC4 = 0, FLOAT, BOOL, INT, STRING, VEC2, VEC3, NUMTYPES } ; 47 | static int REGCOUNT[NUMTYPES]; 48 | idStr name; 49 | int regs[4]; 50 | void SetToRegs(float *registers, idTypedDict *state); 51 | void SetToRegList(idList *registers, idTypedDict *state); 52 | void GetFromRegs(float *registers, idTypedDict *state); 53 | void CopyRegs(idRegister *src) { 54 | regs[0] = src->regs[0]; 55 | regs[1] = src->regs[1]; 56 | regs[2] = src->regs[2]; 57 | regs[3] = src->regs[3]; 58 | } 59 | void Enable(bool b) { 60 | enabled = b; 61 | } 62 | void ReadFromDemoFile(idDemoFile *f); 63 | void WriteToDemoFile(idDemoFile *f); 64 | 65 | }; 66 | 67 | class idRegisterList { 68 | idList regs; 69 | public: 70 | 71 | // 72 | void RemoveReg ( const char* name ); 73 | // 74 | 75 | void AddReg(const char *name, int type, idParser *src, idWindow *win); 76 | void AddReg(const char *name, int type, idVec4 data, idWindow *win); 77 | idRegister *FindReg(const char *name); 78 | int FindRegIndex ( const char* name ); 79 | void SetToRegs(float *registers, idTypedDict *state); 80 | void GetFromRegs(float *registers, idTypedDict *state); 81 | void Reset(); 82 | void ReadFromDemoFile(idDemoFile *f); 83 | void WriteToDemoFile(idDemoFile *f); 84 | 85 | }; 86 | 87 | #endif -------------------------------------------------------------------------------- /neo/ui/RenderWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | #ifndef __RENDERWINDOW_H 29 | #define __RENDERWINDOW_H 30 | 31 | #include "renderer/RenderWorld.h" 32 | #include "ui/Window.h" 33 | 34 | class idUserInterfaceLocal; 35 | class idMD5Anim; 36 | 37 | class idRenderWindow : public idWindow { 38 | public: 39 | idRenderWindow(idUserInterfaceLocal *gui); 40 | idRenderWindow(idDeviceContext *d, idUserInterfaceLocal *gui); 41 | virtual ~idRenderWindow(); 42 | 43 | virtual void PostParse(); 44 | virtual void Draw(int time, float x, float y); 45 | virtual size_t Allocated(){return idWindow::Allocated();}; 46 | // 47 | // 48 | virtual idWinVar *GetWinVarByName(const char *_name, bool winLookup = false, drawWin_t** owner = NULL); 49 | // 50 | 51 | private: 52 | void CommonInit(); 53 | virtual bool ParseInternalVar(const char *name, idParser *src); 54 | void Render(int time); 55 | void PreRender(); 56 | void BuildAnimation(int time); 57 | renderView_t refdef; 58 | idRenderWorld *world; 59 | renderEntity_t worldEntity; 60 | renderLight_t rLight; 61 | const idMD5Anim *modelAnim; 62 | 63 | qhandle_t worldModelDef; 64 | qhandle_t lightDef; 65 | qhandle_t modelDef; 66 | idWinStr modelName; 67 | idWinStr animName; 68 | idStr animClass; 69 | idWinVec4 lightOrigin; 70 | idWinVec4 lightColor; 71 | idWinVec4 modelOrigin; 72 | idWinVec4 modelRotate; 73 | idWinVec4 viewOffset; 74 | idWinBool needsRender; 75 | int animLength; 76 | int animEndTime; 77 | bool updateAnimation; 78 | }; 79 | 80 | #endif // __RENDERWINDOW_H 81 | -------------------------------------------------------------------------------- /neo/ui/Winvar.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | =========================================================================== 3 | 4 | Doom 3 GPL Source Code 5 | Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 | 7 | This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 | 9 | Doom 3 Source Code is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Doom 3 Source Code is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Doom 3 Source Code. If not, see . 21 | 22 | In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 | 24 | If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 | 26 | =========================================================================== 27 | */ 28 | 29 | #include "sys/platform.h" 30 | #include "ui/Window.h" 31 | #include "ui/UserInterfaceLocal.h" 32 | 33 | #include "ui/Winvar.h" 34 | 35 | const char *VAR_GUIPREFIX = "gui::"; 36 | static const int VAR_GUIPREFIX_LEN = strlen(VAR_GUIPREFIX); 37 | 38 | idWinVar::idWinVar() { 39 | guiDict = NULL; 40 | name = NULL; 41 | eval = true; 42 | } 43 | 44 | idWinVar::~idWinVar() { 45 | delete[] name; 46 | name = NULL; 47 | } 48 | 49 | void idWinVar::SetGuiInfo(idDict *gd, const char *_name) { 50 | guiDict = gd; 51 | SetName(_name); 52 | } 53 | 54 | 55 | void idWinVar::Init(const char *_name, idWindow *win) { 56 | idStr key = _name; 57 | guiDict = NULL; 58 | int len = key.Length(); 59 | if (len > 5 && key[0] == 'g' && key[1] == 'u' && key[2] == 'i' && key[3] == ':') { 60 | key = key.Right(len - VAR_GUIPREFIX_LEN); 61 | SetGuiInfo( win->GetGui()->GetStateDict(), key ); 62 | win->AddUpdateVar(this); 63 | } else { 64 | Set(_name); 65 | } 66 | } 67 | 68 | void idMultiWinVar::Set( const char *val ) { 69 | for ( int i = 0; i < Num(); i++ ) { 70 | (*this)[i]->Set( val ); 71 | } 72 | } 73 | 74 | void idMultiWinVar::Update( void ) { 75 | for ( int i = 0; i < Num(); i++ ) { 76 | (*this)[i]->Update(); 77 | } 78 | } 79 | 80 | void idMultiWinVar::SetGuiInfo( idDict *dict ) { 81 | for ( int i = 0; i < Num(); i++ ) { 82 | (*this)[i]->SetGuiInfo( dict, (*this)[i]->c_str() ); 83 | } 84 | } 85 | --------------------------------------------------------------------------------