realXtend/naali — pull request #642 by cvetan5 (2013-03-25 12:30:00+00:00)
Title: Admino bugfixes pt. 5

General bugfixes and performance optimizations by Adminotech. Mostly of the commits are @Stinkfist0's core work on admino_tundra branch.
Some notable commits include:

_(note: commit messages copy-pasted)_
- EC_PlanarMirror: Null ptr crash fix if CreatePlane() function failedto create the ogre entity (it has lots of demands before it does so). Add setting visibility when plane is created.
- SceneInteract: Expose the latest mouse raycast to anyone who is interested. Using this we can reduce the amount of raycasts done each frame to the mouse position (now many places do this on their own, i did not port these things to use the new feature). Cache (optimize) internally so that only one raycast is done per frame with the same mouse coords.
- Disable math lib assume prints on optimized release builds.
- RenderWindow: Accept any string from config, dont try to assume value must be int/bool to begin with. Add @bug note about Ogre crashing if we use invalid values (for example for FSAA that is not supported by the grahipcs card). We should validate any start map values against Ogre::RenderSystem::getConfigOptions().
- Fix bug that caused Server::Start to use UDP even if otherwise was wanted by using the --protocol command line argument.
- TundraLogicModule: remove ugly bool hacks used for reading client/server command line arguments. Instead read the arguments when application's event loop is started by using QTimer::oneShot. Improve parsing and error/warning log output of the parameters while at it.
- AddSourceFolder CMake macro: make inl files also appear in the Solution Explorer as Header Files.
- Performance optimization: create Entities by using make_shared with the help of a workaround instantiation function (make_shared cannot be used to allocate objects with with private ctor directly).
- Rename/rebrand Entity::GetComponents -> ComponentsOfType
- Optimize template version of Entity::Component getters (use component type ID instead of component type name).
- Scene: RemoveAllEntities() crashes every time on certain machines if you have entities in the scene, eg. client disconnects from a scene. After investigating the problem it was clear that entities_.clear() was the reason for this. Unlike RemoveEntity() this functions iter loop did not reset the shared ptrs but used them as it from the iter. There was a todo to convert RemoveAllEntities() to use RemoveEntity(id) so that is what i did. Seems that this fixed the issue RemoveAllEntities() had. Note: i could not reproduce the bug on any machine that has the visual studio dev env, perhaps it has something to do with the end user runtimes memory management with boost::shared_ptrs.
- Expose EC_SkyX and EC_Hydrax symbols to external usage. Add new diffuse and specular color attributes to EC_SkyX. Fix bug that caused the light directions and visibility not to update when time attribute was modified when timeMultiplier was 0 (disabled). Also fix a bug that caused the light directions and visibility to be overwritten by SkyX even if timeMultiplier was 0.
- Properly fix the EC_SkyX time replication (#554).
- Fix bogus error print if server was started without --protocol.
- Add float3x4 EC_Placeable::WorldTransform() for convenience.
- Instantiate scenes using make_shared.
- Add ambientLightColor attribute to EC_SkyX.
- Enhance Entity::Clone function with changeType and cloneName parameters.
- Move invocation of QTimer::singleShot that reads the Client/Server command-line arguments from TundraLogicModule ctor to TundraLogicModule::Initialize in order to prevent (somewhat non-deterministic) apparently startup timing related issues that might cause ReadStartupParams to be executed too early while the Client/Server internals are not yet valid.
- Code cleanup (+minor perf improvement too most likely) by utilizing the new template functions in Scene and Entity.