Commit Graph

9836 Commits

Author SHA1 Message Date
Lasse Öörni
ffe65cf885 Transition to xml-defined rendering path. Pass names changed. Likely caused a large number of regressions to postprocessing, texture rendering & multisampling, which need to be sorted out. The renderpath feature also needs to be documented. 2012-12-31 15:40:07 +00:00
Lasse Öörni
42f8b7854d Fixed raycasts. 2012-12-30 22:55:07 +00:00
Lasse Öörni
ec07e6c524 Started work toward renderpath programmability. 2012-12-30 17:49:12 +00:00
Lasse Öörni
d0bda4885a Load shaders for all passes regardless of render mode. The actual shader programs will not be compiled/created until actually used. 2012-12-29 22:25:48 +00:00
Lasse Öörni
1ce5a632bd Removed the PassType enum in favor of hashed pass names, to prepare for freeform/redefinable render pipeline. 2012-12-27 18:11:32 +00:00
Lasse Öörni
04774d851b Removed unintended hyperlink from documentation. 2012-12-26 16:15:05 +00:00
Lasse Öörni
2ae05de8ca Added elapsed time accumulation to Scene.
Added elapsed time shader uniform.
2012-12-26 00:26:23 +00:00
Lasse Öörni
7d8558a51f Applied massive patch from weitjong.
Changes:

I. Build environment
1. Added new cmake definition to disable/enable Log subsystem in main's CMakeLists.txt.
2. Added setting in main's CMakeLists.txt to pass the "-D_DEBUG" compiler flags for Debug configuration build on non-MSVC compiler. At least it is needed on XCode to get verbose debug log. I assume MSVC does not have this problem.
3. Added '../Engine. to include directories in Input's CMakeLists.txt to allow Input to reference Engine class for handling of SDL_QUIT event (see V.5 and VII.1).
4. Changed cmake_gcc.sh to sed Doxyfile to exclude Direct3D9 and include OpenGL variants of the classes, assuming gcc is only for Mac OS X and Linux.
5. Changed cmake_ios.sh to sed Doxyfile to exclude Direct3D9 and include OpenGL variants of the classes.
6. Added new cmake_macosx.sh shell script to prepare cmake for Xcode in Mac OS X environment.
7. Updated Docs/Reference.dox to correct the URL to AMD's Compressonator.
8. Updated Docs/ScriptAPI.dox to reflect API changes in UI.
9. Added *.sh scripts in the Bin folder to invoke the respective demos.

II. Audio
1. Minor refactoring on Audio class: removed redundant header include, removed redundant call.
2. Corrected minor documentation typo error in Sound.h.

III. Container
1. HashMap minor optimisation: operator [] implementation would not traverse the container twice before node insertion, refactored Clear() and Sort() implementation, changed to static_cast instead of reinterpret_cast, etc.
2. HashSet minor optimisation: refactored Clear() and Sort() implementation, changed to static_cast instead of reinterpret_cast, etc.
3. List minor optimisation: refactored Clear() implementation and changed to static_cast instead of reinterpret_cast.
4. Corrected documentation error for operator > in Pair class.
5. Added new Contains() methods and renamed Print()/PrintArgs() to AppendWithFormat()/AppendWithFormatArgs (while they are still new :-) in String class. Added ToString() global function in StringUtils class to take advantage of new append methods (useful in constructing a formatted string for logging in one liner; becomes no-ops when logging not enabled).
6. Added new Remove() method in Vector and PODVector classes.

IV. Core
1. Enhanced ProcessUtils class to add native approach to detect number of Physical and Logical CPUs for iOS platform.
   BUG FIX: Previous ParseArguments(int, char**) implementation assumed there were no space in the pathname which causes parsing error when it does. Fixed by enclosed the argument in quotes before appending into command line. With this fix, Ninja War demo is runable in iPhoneSimulator.
2. In StringUtils added new convenient global function to construct a formatted string, see III.6.
3. In Variant added MAX_VAR_TYPES enum for guarding a while loop.

V. Engine
1. Added pragma to suppress LLVM/Clang erroneous warnings on unused functions in APITemplates.h.
2. Minor refactoring on Console class: removed redundant call, renamed current_Row to currentRow_.
3. In CoreAPI refactored code to replace map's Find() method call with the newly added Contains() method, added call to reserve container capacity.
4. Refactored DebugHUD class to use the String's new append method instead of a series of strings concatenation.
5. Enhanced Engine class to make Logging an optional feature that can be turned on/off like Profiler subsystem (see I.1), only unpause the audio when it was pause by the Engine previously, no need to check for uninitialized graphics due to window was closed (see VII.1) as engine's exiting_ flag should be set when SDL quits (even by quitting the process externally).
6. GraphicsAPI minor optimisation: Add call to reserve vector to the required known size.
7. Enhanced IOAPI to add preprocessor directive to no-ops the logging functions when Logging not enabled, see I.1.
8. Enhanced UIAPI to reflect changes in UI: mainly, exposed nonFocusedMouseWheel property (see XV.12).

VI. Graphics
1. AnimatedModel optimisation: refactored ProcessRayQuery() implementation, added call to reserve container capacity, removed copy-pasta comment.
   BUG FIX: Infinite while loop in SetMorphsAttr() as the index was never incremented.
2. Changed Animation constructor to also initialize length_.
3. Refactored AnimationController class: only mark for network update when necessary, corrected minor documentation error, added call to reserve container capacity, prevent out-of-bound index access in SetAnimationAttr() implementation, use the StringHash instead of plain name to find the animation state.
4. Refactored AnimationState to avoid redundant call.
5. Refactored BillboardSet class: removed redundant class forward, changed to use the revised Drawable's constructor (see VI.9), added call to reserve container capacity.
6. Refactored Camera class to remove redundant construct. 
7. Refactored DebugRenderer to reuse code. 
8. Refactored DecalSet class: changed to use the revised Drawable's constructor (see VI.9), added call to reserve container capacity, added new flag to track the event subscription.
9. Refactored Drawable to change its constructor to take additional drawableFlags parameter.
10. Enhanced Light class: changed to use the revised Drawable's constructor (see VI.9), refactored ProcessRayQuery() implementation, added implementation to debug draw the directional light.
    BUG FIX: On mobile devices, the CSM only has two splits. Use preprocessor directive to define the attribute as VAR_VECTOR2 instead of VAR_VECTOR4, accordingly.
    BUG FIX: Previous implementation used local ray against world bounding box for RAY_OBB. Fixed by first transformed the world bounding box to local coordinate.
11. Refactored Material class to set or unset the specular_ flag without traversing the shader parameters each time.
12. Refactored Model class: added call to reserve container capacity, removed redundant call to set the number of vertex buffer to 1 (which is Geometry's default).
13. Modified OcclusionBuffer Clear() method to use post decrement.
14. Refactored Octant and Octree classes: changed to use the new PODVector Remove() method, added index_ instance variable to facilitate child octant deletion, simplified the conditional check in the Release() but still achieving the same result.
15. Refactored OctreeQuery class to reorder the condition and to use post increment.
16. Refactored ParticleEmitter class: removed redundant class forward, changed to use the other ColorFade constructor that inits both color and time, added call to reserve container capacity.
17. Refactored Renderer class: removed unused static constants, amended the documentation text for HandleGraphicsFeatures(), delayed event subscription until object is initialized, moved logic to validate the shadow cascades from getter to setter, changed to use String's Contains() method instead of Find(), and a few more code changes (that make no difference :-).
18. Refactored ShaderParser class to change the method signature of GetCombination() method, removed redundant include.
19. Refactored Skeleton class to add call to reserver container capacity.
20. Refactored StaticModel class: changed to use the revised Drawable's constructor (see VI.9), changed the ProcessRayQuery() implementation.
21. Enhanced Tangent class to use pointer arithmetic instead of array indexing.
22. Refactored Terrain class: reordered instance variable initialization in constructor to keep compiler happy, added call to reserve the container capacity.
23. Refactored TerrainPatch class: changed to use the revised Drawable's constructor (see VI.9), changed ProcessRayQuery() implementation.
24. Refactored View class: removed unused method declarations (did not have implementation), changed to reuse existing Vector3 constants, changed octree query base class to FrustumOctreeQuery instead (no additional penalty as the methods are already virtualized anyway), moved constant to outside the loop in CheckVisibilityWork() implementation, reordered logical statement to take advantage of short circuit evaluation, and more.
25. Refactored Viewport class to use the more common way to insert into container.
26. Refactored Zone class: changed to use the revised Drawable's constructor (see VI.9), reordered logical statement to take advantage of short circuit evaluation.
27. Enhanced OGLGraphics class: added code to prevent unnecessary call to get OGL extensions, changed to use new String's Contains() method, added flag to speed up the Release() method, removed redundant code.
28. Changed OGLGraphicsImpl to remove unused include.
29. Changed OGLIndexBuffer to remove unnecessary override. Probably it was copy pasta from Direct3D9 version.
30. Refactored OGLShader class to use the modified ShaderParser's GetCombination() method, see VI.18.
31. Refactored OGLShaderProgram class to use reuse the index for the second string Find() call.
32. Refactored OGLShaderVariation class to the string Insert() method instead to insert all the defines.
33. Refactored OGLTexture class to use the enum instead of hardcoded value.
34. Refactored OGLTexture2D class to simplify the boolean assignment.
35. Refactored OGLTextureCube class to simplify the boolean assignment.
36. Refactored OGLVertexBuffer class to remove unnecessary override and to simplify the for loop condition check in GetElementOffset() method.
37. Refactored CustomGeometry class: changed to use the revised Drawable's constructor (see VI.9), changed ProcessRayQuery() implementation.

VII. Input
1. Enhanced Input class: added call to Engine::Exit() to properly setting the exiting flag instead of just closing the graphics (see V.5), refactored constructor to initialize the mouse related instance variables, delayed event subscription until object is initialized, and other minor refactoring.

VIII. IO
1. Enhanced FileSystem class: added Mac OS X implementation for SystemOpen() method, changed to use new String's Contains() method instead of Find().
   BUG FIX: On non-Win32 platform, files (including dirs) having name starts with '.' were being returned in the result although SCAN_HIDDEN flag is not set. The fix now excludes them.
2. Enhanced Log class: added preprocessor directive to no-ops the logging macros when Logging not enabled (see I.1), removed "XCODE_DEBUG_CONFIGURATION" as it is not effective (at least on my Xcode). Also replaced "XCODE_DEBUG_CONFIGURATION" with "_DEBUG" in SDL_uikitappdelegate.m.
3. Minor changed in Serializer.cpp to suppress compiler warning.

IX. Math
1. Refactored BoundingBox class to reuse code.
2. Enhanced MathDefs.h: better PI, added new constant M_DEGTORAD_2 which is M_DEGTORAD / 2.f (same as M_PI_2, M_PI_4 convention used in math.h).
3. Refactored Frustum class to use the new M_DEGTORAD_2 constant.
4. Refactored Plane.h to reuse code.
   BUG FIX: Copy constructor did not initialize the absNormal_ properly.
5. Enhanced Quaternion class: added multiply-assign operator with a scalar, added Conjugate() method, refactored to reuse code as much as possible, returned conjugate as inverse for unit quaternion, refactored code to use the new M_DEGTORAD_2 constant.
6. Refactored Rect class to reuse code.
7. Refactored Sphere to use post increment.

X. Network
1. Refactored Connection class: changed to hide the detail of the message processing from the caller, added preprocessor directive to exclude statistics when logging is disabled, changed the code to reflect the change done in Node::CreateComponent() method signature (see XIII.2).
2. Refactored Controls class: removed redundant class forward, changed the way default constructor initialize the instance variables.
3. Refactored Network class: removed redundant class forward, changed to reflect changes done in X.1 to process messages, changed the GetConnection() implementation to avoid traversing of the clientConnections_ unnecessarily.

XI. Physics
1. Enhanced CollisionShape class to add preprocessor directive to no-ops the logging calls when Logging not enabled, see I.1. Refactored the HeightfieldData() method to eliminate if statement in the loop.
2. Minor changed in Constraint.cpp to suppress compiler warning.
3. Refactored PhysicsWorld class: removed redundant call in destructor, changed to use the new PODVector Remove() method.
4. Refactored RigidBody class to use the new PODVector Remove() method.

XII. Resource
1. Minor changed in Image.cpp to suppress compiler warning.
2. Enhanced ResourceCache class: changed code to subscribe to event only when auto reload is enabled, refactored to use HashMap's Find() instead of traversing through container manually, changed to use new String's Contains() method.
3. Minor changed in XMLElement class to define an EMPTY element constant.

XIII. Scene
1. Refactored Component class: removed redundant include, reordered logical evaluation.
2. Refactored Node class: changed the CreateComponent() to accept optional ID parameter (combined previously two methods into one), refactored to reuse code as much as possible, added new method to reset scene called by Scene class, moved protected section to correct place adhering to code convention, added new private convenient method to remove component. 
3. Refactored Scene class: changed destructor and in NodeAdded() method to use the new Node::ResetScene() method (see XIII.2), changed the GetVarNamesAttr() implementation to avoid if in the loop, instead of using XMLElement and String default constructor, changed to reference new EMPTY XMLElement constant (see XII.3) and String's Clear() method, respectively.
4. Enhanced SceneResolver class to add preprocessor directive to no-ops the logging calls when Logging not enabled, see I.1.
   BUG FIX: The missing 'else' statement in Resolve() method might cause component ID not resolved correctly. Fixed by adding the else statement.
5. Enhanced Serializable class: refactored code to suppress compiler warning, added new feature to read/write new optional "enum" XML element.

XIV. Script
1. Enhanced Addons class: removed redundant include, changed code to suppress compiler warning, exposed new String's Contains() methods to script enginei (see III.6).
   BUG FIX: The Find() and FindLast() were erroneously exposed as returning integer value. Changed it to returning unsigned instead.
2. Enhanced Script class: added preprocessor directive to no-ops the logging calls when Logging not enabled (see I.1), changed to use new String's Contains() method instead of Find(), removed redundant call in destructor.
   BUG FIX: The logMode_ instance variable was not initialized properly in the constructor (although documentation says it should be defaulted to immediate mode). Initialized it according to documentation.
3. Refactored ScriptFile class to remove redundant call.
   BUG FIX: Previous implementation in Load() assumed script log mode. The fix saves the old mode and use it to revert back the mode.
4. Enhanced ScriptInstance class: refactored ClearDelayedExecute() method to avoid unnecessary vector traversal, simplified code that tracks the execution of METHOD_DELAYEDSTART, refactored to code reuse.

XV. UI
1. Refactored UIQuad and UIBatch: Added new constructor that initialize instance variables, moved GetInterpolatedColor() method between the two, modified the UIBatch methods to take in const UIElement reference, changed the implementation to code reuse as much as possible.
2. Refactored BorderImage class to use the new UIBatch constructor, see XV.1.
3. Very minor changed in Button.cpp to simplify the logical statement.
4. Refactored DropDownList class: Changed to call Menu::GetBatches() instead of Button::GetBatches(), changed for code reuse.
5. Refactored FileSelector class: added call to reserve container capacity, changed for code reuse.
6. Refacotred Font class: added call to reserve container capacity, removed redundant call. 
   BUG FIX: Corrected a typo in GetKerning() implementation causing the kerning information not being applied correctly between adjacent characters.
7. Refactored LineEdit class: Changed to call BorderImage::ApplyAttributes() instead of UIElement::Attributes(), removed redundant construct, changed to reuse code as much as possible, initialized variable in the setter method instead of during update.
8. Enhanced ListView class: added optional index parameter for RemoveItem() method, subscribed to the defocused event only when it is needed, changed to reuse code as much as possible (page up/down and home/end now support additive multi-select as the positive side effect), removed redundant construct.
9. Very minor change in Menu.cpp to use Variant::EMPTY instead of constructing an empty Variant instance.
10. Refactored ScrollView class to reuse code.
11. Refactored Text class to use the new UIBatch constructor, see XV.1.
12. Enhanced UI class: Added support to enable non-focused mouse wheel behaviour similar to Mac OS X and Linux, delayed post-update and render-update event subscription until object is initialized, removed redundant construct.
13. Enhanced UIElement class: added optional index parameter for RemoveChild() method, refactor the code to use the right constness, renamed method from GetUintColor() to GetDerivedColor(), added new private Detach() method, added mutable keyword as necessary to support const getter, refactored destructor method, added call to reserve container capacity, and more.
14. Minor change in Window.cpp to suppress compiler warning.

XVI. Third Party
1. FreeType: Included zutil.c as source in the CMakeLists.txt and fixed the problem when compiling with _DEBUG set.
2. kNet: Removed std::cout statement in the UDPMessageConnection.cpp.
3. SDL: Changed XCODE_DEBUG_CONFIGURATION to _DEBUG in SDL_uikitappdelegate.m, see VIII.2.
   BUG FIX: The touch focus was always zero causing the touch event from touchpad in Mac OS X platform was not handled correctly by Input class because the GetInputInstance() method returns 0 when windowID is 0. Assign the touch's focus with current focus window ID. NOT SURE THIS IS THE CORRECT FIX THOUGH.

XVII. Demos
1. BUG FIX: TestScene.as and TestSceneOld.as assert in the btAlignedObjectArray.h. It was caused by the script trying to remove the RigidBody and/or CollisionShape while in the middle of physics collision event handling. The Bullet's assert could be observed when build using _DEBUG. Fixed by postponinig the removal to post step.
2. Enhanced the NinjaSnowWar to support no-background-music (nobgm) option.
   BUG FIX: BGM was purposely not played on multiplayer mode assuming testing is done on a same test machine, however, this has caused the BGM not to be played on the genuinue multiplayer mode using different machines. Re-enable BGM on multiplayer mode. Instead, added comments in the demo shell/batch script on how to avoid multiple BGM played on a same test machine.
2012-12-25 20:56:05 +00:00
Lasse Öörni
7c61b098bf Fixed forward lit spotlight shadows on OpenGL.
Removed the NVIDIA-specific INTZ depth path so that shaders don't need special cases for reading depth.
2012-12-25 17:55:10 +00:00
Lasse Öörni
5511528fac Added CMake .bat file for Visual Studio 2012. 2012-12-24 15:28:01 +00:00
Lasse Öörni
b650ff8eec Removed possibility from String::Print() to pass Urho3D strings, as it does not compile on GCC. 2012-12-24 14:17:01 +00:00
Lasse Öörni
771306cfd5 Removed unnecessary member variable. 2012-12-24 11:58:32 +00:00
Lasse Öörni
14b78585fc Added CustomGeometry component, which is similar to OGRE ManualObject.
Support also non-indexed geometry for raycasts, occlusion and decals.
2012-12-24 11:56:30 +00:00
Lasse Öörni
50d7b88899 Fixed double registration of the maxWidth property for Text. 2012-12-23 18:38:15 +00:00
Lasse Öörni
e2afe8db08 Formatting. 2012-12-23 17:55:51 +00:00
Lasse Öörni
c41de41381 Fixed point light shadows not working in OpenGL forward rendering. 2012-12-23 14:48:14 +00:00
Lasse Öörni
d6deaccd5a Added FlipVertical() to Image. 2012-12-23 12:13:28 +00:00
Lasse Öörni
680b3d0842 Remap OpenGL vertex attributes so that skinning attributes also fit into the first 8, to fix GLES2 skinning bug on devices that only support 8 attributes (thanks to Alex Fuller.)
Ensure that a script object's DelayedStart() function is always called during the scene variable timestep update.
Fixed animation glitch in NinjaSnowWar due to player animation not being initialized before first physics update.
2012-12-22 20:36:12 +00:00
Lasse Öörni
21811bc13f Explicitly mention that DirectX June 2010 SDK needs to be installed.
Moved the Log timestamp functionality to Time subsystem, so that it can also be called by the user.
2012-12-22 16:42:01 +00:00
Lasse Öörni
411ab13883 Applied jpeg save and system time patches from Alex Fuller. 2012-12-20 23:23:07 +00:00
Lasse Öörni
013e4dc833 Fixed camera viewmask not being used. 2012-12-18 21:33:52 +00:00
Lasse Öörni
21a2fee4a7 Added script API Object::SendEvent() patch from Magic.Lixin. 2012-12-17 11:00:41 +00:00
Lasse Öörni
b698506972 Applied MemoryBuffer::Write() bugfix from Jason Kinzer. 2012-12-14 09:17:12 +00:00
Lasse Öörni
bb8d2437fa Send a per-scene event when the threaded drawable update is done. This can be used for per-scene custom animation (eg. IK) instead of using the global PostRenderUpdate event. Furthermore this event is sent before nodes are reinserted to octree, so it is potentially more correct. 2012-12-09 23:12:54 +00:00
Lasse Öörni
289898d41a Added patch for printf-like functionality to String class from Jason Kinzer. 2012-12-09 22:56:43 +00:00
Lasse Öörni
2dd1c8b040 Moved UpdateGeometries() which actually performs animated model skinning into View::Render() to allow for custom animation control as a response to E_POSTRENDERUPDATE event. 2012-12-08 13:26:36 +00:00
Lasse Öörni
4cafb5c0d7 Added tiled BorderImage patch from primitivewaste.
Added foreachv macro from Jason Kinzer.
2012-12-04 22:25:44 +00:00
Lasse Öörni
3e229b083a Do not define IPHONE_TOUCH_EFFICIENT_DANGEROUS for consistent touch IDs. 2012-12-03 22:25:06 +00:00
Lasse Öörni
9b6607d9b1 Applied network code patch from Magic.Lixin. 2012-12-01 21:54:06 +00:00
Lasse Öörni
5be828da83 Added foreach implementation from Jason Kinzer. 2012-12-01 21:39:50 +00:00
Lasse Öörni
86887ed0c2 Applied LineEdit patch from Magic.Lixin. 2012-11-17 13:03:27 +00:00
Lasse Öörni
48da9e9093 Applied VS2012 / ShaderCompiler patch from Colin Barrett. 2012-11-01 19:46:37 +00:00
Lasse Öörni
b158fbe051 Fixed #ifdef. 2012-10-30 08:34:01 +00:00
Lasse Öörni
2c71349d16 Use identity projection when drawing full screen quads to eliminate float accuracy errors.
Fixed scene rendering crash with illegal camera projection parameters.
2012-10-30 08:26:24 +00:00
Lasse Öörni
e0e9487721 Fixed undefined behaviour in Light on iOS/Android. Fixed unused variable issues. 2012-10-29 08:13:20 +00:00
Lasse Öörni
040fd52eb3 Added hard normal generation mode. 2012-10-28 16:57:43 +00:00
Lasse Öörni
921d93a0da Fixed UV mapping on the builtin models. 2012-10-27 18:21:33 +00:00
Lasse Öörni
9db9049e72 Calculate environment map reflection per pixel. Perturb reflection with normal map.
Default to RelWithDebInfo build in CMakeLists.txt.
2012-10-27 10:23:59 +00:00
Lasse Öörni
7c9ca83a1f Converted skybox to DDS. 2012-10-26 19:54:43 +00:00
Lasse Öörni
e64d64034e Added cubic environment mapping shaders, techniques & example materials.
Fixed bug in loading cube map miplevel 0 if mips were skipped.
2012-10-26 19:45:38 +00:00
Lasse Öörni
5a30a43307 Fixed shadow mapping on iOS 6. 2012-10-25 21:28:57 +00:00
Lasse Öörni
208af3324d Fixed orientation issue on iOS 6 by applying code from new SDL and enabling resizable window. 2012-10-25 20:40:51 +00:00
Lasse Öörni
a8d1ecb9c9 Revert, as did not have effect. 2012-10-25 08:13:48 +00:00
Lasse Öörni
1025401e22 Left orientation added. 2012-10-25 07:33:52 +00:00
Lasse Öörni
5d6754917d Use custom Info.plist. 2012-10-25 07:21:50 +00:00
Lasse Öörni
5399f47582 Possible fix to extra delay during buffer swap on iOS. 2012-10-25 06:54:30 +00:00
Lasse Öörni
18079d3ac3 Reverted orientation fix partially. 2012-10-24 22:12:12 +00:00
Lasse Öörni
6c0c18aece Applied code from SDL trunk for iOS 6.0 orientation fix. 2012-10-24 21:22:49 +00:00
Lasse Öörni
c994be4c5b Fixed compile on OS X 10.8. 2012-10-24 19:40:07 +00:00
Lasse Öörni
d714b2c6e6 Removed unnecessary include. 2012-10-24 19:33:02 +00:00