Commit Graph

326 Commits

Author SHA1 Message Date
scrawl 30d06bfe0e Add comment 2016-03-01 17:27:54 +01:00
scrawl 64636bd85a Improve error reporting 2016-03-01 17:05:02 +01:00
scrawl cdccf03228 Fix mismatched delete 2016-02-25 21:32:42 +01:00
scrawl 5f4ace1bc2 Implement support for sphere map NiTextureEffects (Fixes #1827) 2016-02-24 21:06:41 +01:00
scrawl 90a99991d1 Use empty() instead of !size() 2016-02-22 19:06:12 +01:00
scrawl e647ee5424 Support RGB and RGBA embedded textures in NIF files (Fixes #2295) 2016-02-18 19:37:56 +01:00
scrawl 606758d72f NifLoader: create the BumpTexture slot, but don't use it yet 2016-02-18 19:37:56 +01:00
scrawl 4cd4131da9 NifLoader: assign a name to created textures
This name will tell the shader visitor how to handle that texture.
2016-02-18 19:37:56 +01:00
scrawl 50e92c8136 NifLoader: move texture property handling to a separate function 2016-02-18 19:37:56 +01:00
scrawl acf44fd9e5 NifLoader: handleTextureControllers outside of the NumTextures loop 2016-02-18 19:37:55 +01:00
scrawl 5824619a95 Clean up includes 2016-02-12 19:28:10 +01:00
scrawl 8b596dfcbe Remove support for OSG 3.2
Since commit e8662bea31, we're using OSG functionality that contains an unfixed crash bug in version 3.2. The bug is fixed in version 3.4 (OSG commit 6351e5020371b0b72b300088a5c6772f58379b84)
2016-02-12 14:46:45 +01:00
scrawl 9e53e12c70 More renaming of TextureManager -> ImageManager 2016-02-05 23:10:27 +01:00
scrawl f99f403dda Rename TextureManager to ImageManager 2016-02-05 23:03:53 +01:00
scrawl 6ef848b7c5 Remove TextureManager::getTexture2D
Instead use getImage and let the caller create the Texture. Sharing of textures is then handled in post by the SharedStateManager.

This is closer to what the OSG serializer does.

Streamlines the TextureManager and will make it easier to multithread.
2016-02-05 23:01:11 +01:00
scrawl 2eda495f89 Build fix for OSG 3.2 2016-02-03 19:05:15 +01:00
scrawl 06ed20abf8 Use the initial pose of a MorphGeometry for object placement (Fixes #3136) 2016-02-03 18:53:38 +01:00
scrawl 6b48acaf0e Don't optimize TriShapes with controllers (Fixes #3143) 2016-02-01 21:01:17 +01:00
scrawl 723c392a73 NifLoader: fall back to the first UV set when encountering invalid UV set references 2015-12-17 04:05:39 +01:00
scrawl 0731595c2b Wrap a Texture2D in a ref_ptr 2015-12-17 03:38:38 +01:00
scrawl 31c3324705 Don't assume the emitter node is a Group (Fixes #3082)
This would be a correct assumption by default, but is no longer true when the NifLoader::optimize() function optimizes the graph.
2015-12-17 03:38:26 +01:00
scrawl e3d3380c8c Remove return value for in-place toLowerStr 2015-12-07 22:43:08 +01:00
scrawl 1d5af3c9c8 Remove unneeded cast 2015-12-06 15:44:27 +01:00
scrawl ac366f1603 Fix the rig bounds being updated twice per frame
Unlike what I expected, the osgUtil::UpdateVisitor is set to traverse all children (not only active children). The FrameSwitch was thus traversing both RigGeometries part of the double-buffering scheme, rather than only the one active in the current frame.
2015-11-30 05:42:31 +01:00
scrawl 9b96fcc224 Set the particle scaleReferenceFrame to local space 2015-11-19 15:49:42 +01:00
scrawl 21e25f4756 Use the traversalNumber as frame number 2015-11-16 20:03:45 +01:00
scrawl 0965a9059d Handle NiLODNode using osg::LOD (Fixes #3008) 2015-11-12 19:52:36 +01:00
scrawl 1edcb219a7 Leak fix 2015-11-11 16:27:17 +01:00
scrawl 0409e5a043 Use OSG_VERSION_GREATER_EQUAL / LESS_THAN rather than MIN_VERSION_REQUIRED (cosmetic change) 2015-11-10 18:28:58 +01:00
scrawl f1ac408f35 Place Drawables directly in the scene graph when built with OSG 3.4
OSG 3.4 adds the ability to place Drawables directly in the scene graph, without a Geode decorating them. Leveraging this should give a small performance boost, because the redundant Geodes increase culling overhead.

There is still an oustanding issue with the RemoveDrawableVisitor no longer working correctly, because Drawables can have multiple parents.
2015-11-10 18:23:42 +01:00
scrawl 64abdbabe3 Small refactor of controllers handling, print warning messages for unhandled controllers 2015-11-09 17:42:35 +01:00
scrawl 35f5be680b Support for NiVisController on trishape nodes 2015-11-09 17:42:35 +01:00
scrawl 2ee6b41887 Handle NiAlphaProperty on a drawable basis
Removes the RenderBin nesting complication. Also results in leaner StateSets, so the cull phase should be a bit faster.
2015-10-19 15:46:53 +02:00
scrawl 8e69c80bf6 Add framenumber checks in various cull callbacks, so we don't update more than once per frame when multiple cameras are used 2015-09-26 01:21:33 +02:00
scrawl 76fb68a9c0 Handle particle systems that don't have emitters
Fixes a crash in the Magic Diversity mod.
2015-09-07 22:07:09 +02:00
Arthur Moore 2d93a6f6cb Be more verbose when dealing with unhandled nif texture properties 2015-07-28 18:46:11 -04:00
scrawl ac1f64b559 Fix StencilProperty front face mixup (Fixes #2802) 2015-07-28 03:20:18 +02:00
scrawl 7a5f220ac5 GlowTexture keeps the alpha channel from the previous texture stage 2015-06-19 17:43:13 +02:00
scrawl 39539603bf Re-enable a warning message 2015-06-18 03:03:30 +02:00
scrawl a7c5beb7c5 Remove redundant allocations for NIF meshes 2015-06-18 01:26:45 +02:00
scrawl 81a4a6da6b Make better use of the available texture units (Bug #2702)
Nvidia drivers only support a maximum of 4 fixed function texture units. To resolve this problem, bind texture units in order instead of binding to the NiTexturingProperty::TextureType unit.
2015-06-17 20:43:39 +02:00
scrawl 934166a853 Ignore the alpha value for particle materials (Bug #2699) 2015-06-17 18:04:33 +02:00
scrawl d7a4a9fd66 Create NIF root nodes as Group instead of Transform when possible 2015-06-15 15:25:45 +02:00
scrawl b79ab1a3b8 Fix InverseWorldMatrix bug introduced by last commit 2015-06-15 02:22:52 +02:00
scrawl ec25f1da95 Fix ParticleSystem bug introduced by last commit 2015-06-15 02:17:57 +02:00
scrawl ad46ff7a98 Remove redundant Transform nodes for TriShapes/ParticleSystems with an identity transform 2015-06-15 02:06:04 +02:00
scrawl ab597f672e State the filename in NIF loader warning messages 2015-06-15 01:49:46 +02:00
scrawl 6a788c3462 Minor cleanup 2015-06-15 01:29:32 +02:00
scrawl a5b72a358b Prune empty nodes in RemoveDrawableVisitor
Gets rid of 28 useless transform nodes in base_anim.1st.nif.
2015-06-14 23:56:35 +02:00
scrawl 9e049894e8 Reduce the number of StateSets created for NIF scene graphs
The Material state is now set on the NiTriShape's node rather than the Geode, thus merged with other state like NiTexturingProperties, etc that are typically attached to the NiTriShape.

Effectively cuts in half the number of StatSets for a NIF file, resulting in big speedup (~10%) in the Cull and Draw phases.
2015-06-14 21:22:44 +02:00
scrawl 8d6620b074 Assign an initial bounding box to particle systems 2015-06-11 02:37:49 +02:00
scrawl b5099324d1 Enable ParticleSystem's FreezeOnCull, big speed-up in Vivec 2015-06-10 20:35:59 +02:00
scrawl 93ee11c5e7 Fix particlesystem nested RenderBin issue (Bug #2631) 2015-06-08 21:21:09 +02:00
scrawl 5edf457ab7 Build fix 2015-06-08 01:13:23 +02:00
scrawl 0a411cbd7c Enable particle lighting 2015-06-07 04:41:55 +02:00
scrawl 0f8f19958a NifLoader: Fix empty StateSets being created in some cases 2015-05-30 04:26:00 +02:00
scrawl 261ed1f4e5 Revert "Enable culling for particle emitters & programs"
This reverts commit 8b206e0aed.
2015-05-29 20:31:26 +02:00
scrawl 3dcb167066 Map rendering 2015-05-26 16:40:44 +02:00
scrawl 604580d75d Move toMatrix to Nif::Node 2015-05-07 21:17:15 +02:00
scrawl 63b69db617 Port skeleton based bounding boxes to the new skinning system
Not sure if going to keep this, there's a noticable performance impact.
2015-04-27 15:41:34 +02:00
scrawl 09742d5b95 Animation playback works, no movement accumulation yet 2015-04-23 20:41:31 +02:00
scrawl cd7808fc11 Cleanup in preparation for animation port
Scrapped previous idea for multiple animation sources, better approach incoming.
2015-04-22 23:16:08 +02:00
scrawl 148c041a43 Nif loader cleanup - forcing a skeleton is no longer needed 2015-04-22 19:16:49 +02:00
scrawl 28643660d3 Change triangle indices to unsigned 2015-04-21 20:56:16 +02:00
scrawl 10644544ab Dead code removal 2015-04-21 20:31:20 +02:00
scrawl eaa4316ff8 Move skinning code to SceneUtil 2015-04-21 20:30:48 +02:00
scrawl 111e3eb6db Slightly improve bounding box for skinned meshes 2015-04-21 18:29:28 +02:00
scrawl 4ea6d4aa01 Rewrite of skinning code
Goals:
- get rid of the mesh pre-transform (this requires supporting different bind matrices for each mesh)
- bounding box should be relative to the bone the mesh is attached to, ideally we can then get rid of the expensive skeleton-based bounding boxes
- update bone matrices in CullCallback instead of UpdateCallback

Works OK, though the bounding boxes are not correct yet.
2015-04-21 16:02:40 +02:00
scrawl c334a76a6f Fix skinning bug 2015-04-15 22:38:43 +02:00
scrawl f7da979669 Add FrameSwitch (geometry "double buffering") for efficient updates of RigGeometry & MorphGeometry 2015-04-14 18:56:11 +02:00
scrawl c516e897ee Move Controller base classes to SceneUtil, add visitor to assign ControllerSources 2015-04-14 17:51:46 +02:00
scrawl de2c85e0f8 Port nifloader to the more efficient StateSetController 2015-04-14 16:41:06 +02:00
scrawl a0b43f426e Avoid setting DYNAMIC DataVariance on StateSets 2015-04-11 23:01:37 +02:00
scrawl 591a35b8d7 *very* early version of the LightManager 2015-04-10 23:16:17 +02:00
scrawl 433e29f297 MorphGeometry optimizations: static bounding box and vertices updated during cull traversal 2015-04-10 14:35:37 +02:00
scrawl 8b206e0aed Enable culling for particle emitters & programs
Big speedup, though might cause timing inconsistencies that we should fix at some point.
2015-04-09 16:54:25 +02:00
scrawl 74c56556cc More fixes for scaled particle systems 2015-04-05 14:10:31 +02:00
scrawl 304d7e544f Optimize RigGeometry to update skinning in CullCallback 2015-04-04 19:19:01 +02:00
scrawl e5e1013c51 TextKeys attached to root node as user data, add .kf loading to scenemanager 2015-04-02 17:34:44 +02:00
scrawl 12f27123f2 Billboard scaling fix and culling bug fix 2015-03-30 17:11:27 +02:00
scrawl 9975ec1678 Missing clone function 2015-03-29 19:39:22 +02:00
scrawl bb32c761df *very* early texture manager, need a lot more thought to design this properly 2015-03-28 02:27:59 +01:00
scrawl 322fcdc2d3 Transform world space particles when attaching to a node 2015-03-28 00:30:49 +01:00
scrawl ac2612926e Disable unRefImageDataAfterApply 2015-03-27 23:25:15 +01:00
scrawl e91d9d0903 Fix for behaviour of scaled particle nodes
Not sure if used in vanilla assets so may be low priority, but couldn't help looking into this.
2015-03-27 17:00:10 +01:00
scrawl c10c146ad1 Skeleton based bounding box callback for RigGeometry (Bug #455) 2015-03-26 23:15:46 +01:00
scrawl 99c9907ff3 Fix emitter/particlesystem scene graph order problems 2015-03-26 17:38:17 +01:00
scrawl caa93f767b Skip creating meshes for hidden nodes with no VisControllers
There's quite a bit of garbage in base_anim.nif, so this change should result in a much leaner scene graph.
2015-03-25 18:46:55 +01:00
scrawl e938fa4a9d Implement extrapolation mode in ControllerFunction (Bug #1871) 2015-03-25 18:12:43 +01:00
scrawl 96d51f0bb7 NiParticleRotation seems to be unused 2015-03-25 16:34:51 +01:00
scrawl 46cbec9a4a Add skinning auto-detection in nifosg loader 2015-03-25 15:39:41 +01:00
scrawl 60ede8dede Stop warning about NiFogProperty (unused in MW) 2015-03-25 05:14:07 +01:00
scrawl 6d9deaa386 Implement planar collider for particles (Fixes #2149) 2015-03-25 04:57:01 +01:00
scrawl 20866b44f7 FlipController fix, DetailTexture & DarkTexture tested 2015-03-25 00:55:09 +01:00
scrawl b072e803ce Use correct ambient/diffuse default values when no NiMaterialProperty exists 2015-03-24 23:55:21 +01:00
scrawl 9ee99a751c Stop warning about NiDitherProperty, ignore NiShadeProperty (unused) 2015-03-24 23:40:37 +01:00
scrawl 9141a8d801 Fully implement NiStencilProperty (Feature #1057) 2015-03-24 23:05:20 +01:00
scrawl baa152328a Crash fix 2015-03-24 01:32:36 +01:00
scrawl 376f0f3ac1 Small cleanup 2015-03-23 17:49:06 +01:00
scrawl 018115601a Move particle emitter/affector handling to separate functions 2015-03-23 16:49:33 +01:00
scrawl 36ad40827b Move parent node attachment out of nifloader 2015-03-23 16:17:40 +01:00
scrawl ff9e2b03a0 Hide NIF loader details in the implementation file 2015-03-23 16:10:18 +01:00
scrawl 5a582e7eb7 Reintroduce showMarkers flag 2015-03-23 01:57:14 +01:00
scrawl 6d85444d26 Add text key loading 2015-03-23 01:51:44 +01:00
scrawl 6219a7bbfc Add .kf loader 2015-03-23 01:31:16 +01:00
scrawl 9242e6d256 Avoid copying keyframes in controller instances 2015-03-22 23:47:49 +01:00
scrawl 2db5df77f0 Change rotation/scale workaround in preparation for loading .kf controllers 2015-03-22 22:55:35 +01:00
scrawl 15f9c1ddcf NiBSPArrayController works 2015-03-21 23:10:52 +01:00
scrawl 71782462b7 Subclass ParticleSystem to support limit on the number of particles 2015-03-21 04:36:36 +01:00
scrawl 2e11642273 Fix BillboardNode overriding scale 2015-03-21 04:10:50 +01:00
scrawl a9aee389c0 Emitters attached to correct node, a bit ugly 2015-03-21 03:50:50 +01:00
scrawl 32bb202290 Implement BillboardNode 2015-03-20 23:14:01 +01:00
scrawl d486cde330 Fix broken VisControllers 2015-03-20 21:32:26 +01:00
scrawl 4957ceeb1d Refactor controllers, now part of the scene graph as UpdateCallbacks
Practical benefits:
- The controller update is now run automatically
- Creating an instance of a scene graph should now work properly using the defined copy constructors
2015-03-20 19:51:54 +01:00
scrawl 00ab474188 More work on copy constructors 2015-03-19 16:22:01 +01:00
scrawl f8422c3ed4 Particles mostly completed, still need to attach emitters to the correct node and handle NiBSPArrayController 2015-03-19 03:01:11 +01:00
scrawl 79c2138e53 Port ResourceHelpers to new VFS 2015-03-19 01:45:01 +01:00
scrawl f843e12538 Add world space particle systems, will need more changes when emitters are added 2015-03-17 22:34:30 +01:00
scrawl 510375aa63 Add virtual file system (VFS) replacing the low level parts of the old resource system 2015-03-17 22:02:56 +01:00
scrawl 8d64f2081e Add particle system state loading 2015-02-24 01:25:31 +01:00
scrawl 2a92fb57f7 Add FlipController 2015-02-24 00:02:10 +01:00
scrawl 6c8613ae35 Add DarkTexture and DetailTexture 2015-02-23 23:21:56 +01:00
scrawl c54ee16748 Add AlphaController and MaterialColorController 2015-02-23 21:55:32 +01:00
scrawl 3839d6f777 Simplify controller classes 2015-02-23 21:55:32 +01:00
scrawl 74dfb23e7b Handle material properties in trishapeToGeometry 2015-02-23 21:55:32 +01:00
scrawl 8e01d8cb19 Add OSG nifloader, currently supports geometry, materials, basic texturing, skinning, morphing, and most controllers. 2015-02-23 21:06:10 +01:00