Commit Graph

387 Commits (master)

Author SHA1 Message Date
scrawl 9b8c56761b
Fix timing error 7 years ago
Alexander "Ananace" Olofsson 145b47a550
Fix Windows builds
`std::min`/`std::max` are part of algorithm, which is not implicitly included in Windows builds
7 years ago
scrawl 123f7b83d5
Make the CompositeMapRenderer use available time and add related setting 7 years ago
AnyOldName3 112ade2a3f Ensure TerrainDrawables affect the computed near/far planes. 7 years ago
AnyOldName3 1a30a917af Merge upstream/master 7 years ago
scrawl 7b4add2ae4 Fall back to non-shader material if creating the shader fails
Also fixes an uncaught exception that will break the whole game.
7 years ago
scrawl ceaf0ee409 Enable shadow casting for terrain
Add a check to TerrainDrawable to make sure shadows are only drawn once, not once per blending pass
7 years ago
Marc Zinnschlag dd17f70068 Merge remote-tracking branch 'aesylwinn/landrecords' 7 years ago
Chris Robinson 021627bdf8 Mark some functions with override
Fixes some Clang warnings about overriding a virtual function without the
override keyword.
7 years ago
Kyle Cooley 2abf7f1752 Remove unnecessary cache dump 7 years ago
Kyle Cooley 2eacc2f093 Changes to land creation, add ability to specifically clear terrain cache 7 years ago
scrawl 4fba157d3b Implement releaseGLObjects for cached resources 7 years ago
Kyle Cooley 979b0d7211 Code cleanup and more cache clearing 7 years ago
Kyle Cooley 3b9326d238 Clear terrain cache and reload terrain 7 years ago
scrawl 3e03a0d7bd Terrain: remove ref argument that is now always true 8 years ago
scrawl ac78d01b2b Terrain: use the main camera's viewpoint for intersection tests
Fixes lag spikes caused by intersection tests loading/unloading terrain pages.
8 years ago
Ewan Higgs 38a2de3c51 convert std::autor_ptr to std::unique_ptr, originally by Ewan Higgs and updated by Bret Curtis 8 years ago
scrawl c992cb6e82 Fix texture not being applied on rendering the composite map (Fixes #3791) 8 years ago
scrawl a070551af3 Attempt to fix naming conflict on windows 8 years ago
scrawl 088d5604bf Use a shader if required to display the composite map
Fixes composited terrain not respecting the 'clamp lighting' setting.
8 years ago
scrawl 7f5beb3172 Remove unused includes 8 years ago
scrawl 5044816770 Remove unused code 8 years ago
scrawl b66c2abfe3 Build the bounding sphere in the loading thread (only relevant for TerrainGrid) 8 years ago
scrawl 9e9c028f1d Skip light collection for far away terrain 8 years ago
scrawl 0782839a42 Avoid redundant culling tests on the transform/drawable 8 years ago
scrawl fb8ac06524 Reduce the minSize of quad tree nodes for better performance 8 years ago
scrawl a041546b54 Use the quad tree's minSize in the LodCallback 8 years ago
scrawl e4e8821902 Refactor update of lodFlags 8 years ago
scrawl 2aa09639a9 Re-enable terrain intersections 8 years ago
scrawl db00d47ca2 Hold a ref to the intersection visitor's view if possible 8 years ago
scrawl 11bee6ee35 Avoid compiling composite maps that are no longer referenced 8 years ago
scrawl 9eed7fa6f5 Fix composite map when force shaders is enabled 8 years ago
scrawl d055dc25bf Add custom traversal for local map camera to avoid loading terrain nodes that are exactly outside the border to another cell 8 years ago
scrawl 7d50b6c2e2 Add QuadTreeWorld::cacheCell to preload cells at max LOD for local maps 8 years ago
scrawl 6ccb6009ee Use the View-based preloading for TerrainGrid as well 8 years ago
scrawl 3c29e2dbeb Refactor ownership of terrain views 8 years ago
scrawl 28fd492711 Don't use terrain LOD for the map camera 8 years ago
scrawl e7a0878c10 Add CompositeMapRenderer info to the stats panel 8 years ago
scrawl c921620ef3 Compile the drawables of a composite map one by one to avoid frame drops for larger maps 8 years ago
scrawl 47ca8aeee5 Use the time elapsed instead of # compiled as limit 8 years ago
scrawl 8a6d909b22 Fix composite map being compiled twice 8 years ago
scrawl 683e625c6c Rewrite CompositeMapRenderer to be based on Drawable and share the FBO 8 years ago
scrawl 4baa795152 Add preloading implementation to QuadTreeWorld 8 years ago
scrawl 9db71e3f62 Recompute the LOD stitching when the view changes 8 years ago
scrawl ef704db877 Fix reset of changed flag 8 years ago
scrawl 1c15686353 Remove non required use of WorkQueue 8 years ago
scrawl 433900fca5 Fix waiting on initial quad tree build 8 years ago
scrawl 4dbd224249 Hide the terrain in non-exterior cells 8 years ago
scrawl 2580de11a4 Refactor ownership of ViewDataMap 8 years ago
scrawl 5a3c645c89 Enable lazy compiling of composite maps 8 years ago
scrawl 99e18f0d68 Clear the ViewData on exit 8 years ago
scrawl bb991850da Add LOD stitches 8 years ago
scrawl 6bd286d924 Fix unnecessary resizing in ViewData 8 years ago
scrawl 8c151364df Add special handling for CullVisitor to QuadTreeWorld.
- Cull only against bounding box, not bounding sphere, as this appears to perform better.
- Also traverse into non visible nodes to compute their LOD, this is to avoid nodes having to be loaded in when the player turns the view around, and will avoid unnecessary refs/unrefs of rendering data in the View. This should probably be turned off at some point for static cameras, such as the local maps.
8 years ago
scrawl f19a88be9d Reject QuadTreeNodes with invalid bounds 8 years ago
scrawl 7d004bf757 Preliminary rendering of QuadTreeWorld 8 years ago
scrawl e36bdb490e Add view data structure for efficient collection of LOD nodes to use for a given camera/intersection 8 years ago
scrawl 0efc54c749 Subdivide the composite maps 8 years ago
scrawl 819860081f Remove custom bounding box 8 years ago
scrawl ce8c4ad4f5 Add quad tree implementation (no rendering yet) 8 years ago
scrawl 14225a42c6 Remove unused pointer to IncrementalCompileOperation 8 years ago
scrawl c487df0abb Move updateTextureFiltering and material into the base class 8 years ago
scrawl 5eff286c71 Use separate node mask and parent for CompositeMapRenderer to allow the loading screen to pre compile composite maps. 8 years ago
scrawl 7e4450da55 Change the renderOrder of composite maps to ensure they are updated before water reflections or other cameras that may be using it. 8 years ago
scrawl b1d4bb5708 Add CompositeMapRenderer
Temporarily render all terrain using composite maps for testing purposes
8 years ago
scrawl e323b2fa7b Use the SceneManager's ShaderManager 8 years ago
scrawl 051c17a184 Make reportStats const 8 years ago
scrawl 16b5cadd9e Fix order of operations w.r.t clearing cache 8 years ago
scrawl 2c68ed4fb4 Remove no longer required use of UnrefQueue as the new resource manager will naturally clear the cache from the worker thread 8 years ago
scrawl 35d53acc65 Factor out terrain chunk loading/caching into a new resource manager 8 years ago
scrawl 274690f790 Refactor BufferCache to allow caching buffers of different sizes 8 years ago
scrawl 804f873649 terrain: factor out texture caching into a separate class 8 years ago
scrawl eef63a880a terrain: use a custom drawable for multi-pass render instead of osgFX::Effect
osgFX::Effect is awkward to use because of the lazy-definition of passes, no support for compileGLObjects, useless 'Technique' abstraction and having to define silly methods like 'effectAuthor()'

Handling the multi-pass rendering inside the Drawable also avoids redundant culling tests against the same bounding box for each pass.
8 years ago
scrawl 62cc091414 Fix incorrect setting of TexMat in terrain material 8 years ago
scrawl 8f79fa3d72 Add resource statistics panel opened with F4 8 years ago
scrawl c5f8ff6e0e Add names to several nodes for debugging purposes 8 years ago
Allofich 0f20312012 Fix MSVC warnings 8 years ago
scrawl 4322e76cb6 Fix shadowing warnings 8 years ago
scrawl 157c11398d Add terrain parallax mapping 9 years ago
scrawl 3f08cbff71 Share the state attributes for terrain techniques
Reduces the total amount of GL calls / frame by about 14% - 50% depending on the scene.
9 years ago
scrawl f898bf493f Don't use Geodes 9 years ago
scrawl 8f81df2bd3 Cleanup 9 years ago
scrawl 0db7163363 Add specular mapping for terrain 9 years ago
scrawl 6a0ac824bd Fix terrain error in OpenCS 9 years ago
scrawl 7071d286e8 Fix inverted check for 16-bit indices 9 years ago
scrawl ca0e1fe0e0 Set the osg::Material on the terrain root node 9 years ago
scrawl 6000e48bba Add terrain shaders and normal map support
Textures with _n filename suffix are automatically recognized as terrain normal maps.
9 years ago
scrawl e05d975020 Change the way that texture filtering settings are applied at runtime 9 years ago
scrawl 5824619a95 Clean up includes 9 years ago
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)
9 years ago
scrawl 5e876b1379 Add missing include 9 years ago
scrawl 98c5e072f2 Swap the terrain cache update order to make more sense 9 years ago
scrawl 0865cea211 Preload terrain 9 years ago
scrawl 8aba74e6ee Remove GridElement 9 years ago
scrawl d11c2864df Introduce UnrefQueue to handle the deleting of no longer needed objects in the background thread 9 years ago
scrawl c3ad4dad75 Fix applying of filter settings on terrain textures 9 years ago
scrawl 9e5225bb6f Do not unref a Texture's image data after applying it 9 years ago
scrawl 9e53e12c70 More renaming of TextureManager -> ImageManager 9 years ago
scrawl f99f403dda Rename TextureManager to ImageManager 9 years ago
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.
9 years ago
scrawl fbd4ad9b0c Flip terrain textures 9 years ago
scrawl 31988ca4cc Add a dont_override_filter description for textures that should be left alone 9 years ago
scrawl b06730ac61 Fix terrain textureCompileDummy 9 years ago
scrawl 62169a7039 Use a single-precision PositionAttitudeTransform in speed critical places 9 years ago
scrawl 52901ec10c Do not create terrain geodes when built with OSG 3.4 9 years ago
scrawl 72252d4f32 Terrain: restore IncrementalCompileOperation 9 years ago
scrawl 7ca8e45d5d Terrain: remove debug code 9 years ago
scrawl ef18f4217f Terrain: create 4x4 terrain chunks per ESM::Cell to improve performance
Improves performance because the number of splatting layers per chunk is reduced, and finer grained frustum culling can be done.
9 years ago
scrawl 95cf13e3f2 Terrain: make the blendmapSize and layerTileSize in FixedFunctionTechnique configurable 9 years ago
scrawl b3f5ac5dbb Include cleanup 10 years ago
scrawl 98571148b0 Remove custom license for terrain code
Now that it's no longer a stand-alone component, there's not much point in custom licensing it.
10 years ago
scrawl db16cdad02 Add a comment 10 years ago
scrawl 5921e70625 Build a kdtree for terrain geometry
Improves intersection testing performance, shaving off ~2ms of frame time in exteriors.

Also increases terrain loading time by ~1ms per cell, so will have to look into background loading soon.
10 years ago
scrawl e046119487 Fix for unnecessary terrain texture coordinate arrays 10 years ago
scrawl cd47dff196 Minor cleanup 10 years ago
scrawl b978153edb Enable VBO sharing for terrain geometry 10 years ago
scrawl 5666e02546 Fix for dark terrain in some cases 10 years ago
scrawl cdd0623009 Terrain rendering 10 years ago
scrawl e1f4a7f647 Merge branch 'master' of https://github.com/OpenMW/openmw into osg
Conflicts:
	apps/openmw/engine.cpp
	apps/openmw/mwgui/mainmenu.cpp
	apps/openmw/mwgui/windowmanagerimp.cpp
	apps/openmw/mwinput/inputmanagerimp.cpp
	apps/openmw/mwrender/animation.cpp
	apps/openmw/mwrender/debugging.cpp
	apps/openmw/mwrender/npcanimation.cpp
	apps/openmw/mwrender/renderingmanager.cpp
	apps/openmw/mwrender/sky.cpp
	components/nif/nifkey.hpp
	components/nif/nifstream.hpp
	components/nifbullet/bulletnifloader.cpp
	components/nifogre/ogrenifloader.hpp
	libs/openengine/bullet/physic.cpp
	libs/openengine/gui/manager.cpp
10 years ago
Marc Zinnschlag 83a7eea2a9 Merge remote-tracking branch 'scrawl/master' 10 years ago
Rohit Nirmal 997347b01e Silence -Wreorder warnings. 10 years ago
scrawl 20af2b67a8 Change the triangle pattern used for terrain (Fixes #2459) 10 years ago
scrawl af67de73a5 Delete shiny 10 years ago
dteviot e197f5318b fixing MSVC 2013 warning C4244: & C4305
conversion from 'const float' to 'int', possible loss of data
conversion from 'double' to 'int', possible loss of data
conversion from 'float' to 'int', possible loss of data
10 years ago
dteviot 45b6538820 fixed MSVC 2013 warning C4800
forcing value to bool 'true' or 'false'
10 years ago
jacmoe ee574e08ef MIT License header added to all terrain component files. 10 years ago
scrawl f8b4ff3004 Documentation fix 10 years ago
scrawl 7b4665c623 Terrain: documentation update 10 years ago
scrawl 261da8dd0a Terrain: use 32-bit indices if necessary 10 years ago
scrawl f7bac58b39 Terrain: change index buffer flags to unsigned 10 years ago
scrawl ccab8b1a92 Fix bug in TerrainGrid::getWorldBoundingBox (Fixes #2075) 10 years ago
scrawl eda296f1e3 Remove workaround for Ogre 1.8 (no longer supported) 10 years ago
scrawl 7252cb63a6 Fix cppcheck issues 10 years ago
scrawl 8c26f802e6 Move terrain grid implementation to a component so the editor can use it (Feature #1597) 11 years ago
scrawl 2a510573b8 Remove unused implementation file 11 years ago
scrawl e25fa6c157 Refactor non-distant land terrain path to a grid based implementation (Fixes #1562) 11 years ago
slothlife 9ea22324f7 Fix some MSVC warnings.
Several fixes are warnings about truncations on 64-bit, while others are
complaints about mixed signed / unsigned integer operations.
11 years ago
scrawl c018319940 Addition to 7c9c0830a96: don't create useless BaseWhite clones 11 years ago
scrawl 7c9c0830a9 Fix errors due to BaseWhite material being removed 11 years ago
cc9cii 11ce093a9e Fix crashes caused when terrain materials don't get created (e.g. due to cg shader bug on Windows/D3D9). Should resolve Bug #1284. 11 years ago
slothlife f33559fead Fixes for MSVC warnings, less overall changes
Kept some fixes from the first round of review. Found out that several
targets weren't being built with the same basic warnings disabled.
Disabled a few warnings for external libraries specifically, rather than
applying them to all targets.
11 years ago
slothlife c160a04ede Revert "Fixes for warnings when building with MSVC"
This reverts commit 46eb20b98c.
11 years ago
slothlife 46eb20b98c Fixes for warnings when building with MSVC
Most warnings are innocuous (wrong type-specifier for forward
declarations, conversion of literals into unsigned integers, warnings
about methods optimized out), but I believe actual bugs were revealed in
vartypedelegate.cpp and combat.cpp.
11 years ago
scrawl 6f7fbc867f Fix several leaks 11 years ago
scrawl b0a1e1198a Yet another terrain fix 11 years ago
scrawl a9dcc90970 Another terrain fix 11 years ago
scrawl b8ca067730 Small fix for terrain 11 years ago
scrawl d0f98103e4 Terrain: re-added "distant land=off" path
Still a hack, but the overhead of building and traversing the quad tree appears negligible.
11 years ago
scrawl 1d926816b5 Terrain: background load blendmaps & layer textures. Refactor QuadTree update. 11 years ago
scrawl 4328e08162 Terrain: get rid of unneeded members 11 years ago
scrawl 6a002d19b3 Terrain: destroy no longer used materials 11 years ago
scrawl 97c3efb3ba Terrain: decoupled Chunk from QuadTreeNode. 11 years ago
scrawl edb5a54092 Include some more required Ogre headers explicitely. 11 years ago
scrawl 195071efc7 Terrain: geometry is now loaded in background threads.
TODO: background load layer textures and blendmaps.
"Distant land" setting has been removed for now (i.e. always enabled).
11 years ago
scrawl b3fed853ae Terrain: take cell world size into account for LOD selection 11 years ago
scrawl 6c863486e1 Terrain: fix an embarrassing copy&paste mistake. 11 years ago
scrawl 64c9932597 Terrain: remove hard dependency on shiny - can now be compiled without it (fixed function) 11 years ago
scrawl c9e349f60f Terrain: support alternate coordinate systems. Get rid of LoadingListener for now 11 years ago
scrawl 1fba5d1bb9 Terrain: change world bounds from AABB to 4 floats 11 years ago
scrawl 90f6cda4cc Moved includes to appropriate place 11 years ago
scrawl d4a755d1aa Fix some hardcoded literals 11 years ago
scrawl c6fb0f2d9b Removed terrain component's dependency on ESM 11 years ago
scrawl a1ac99463f Fix an uninitialized value 11 years ago
scrawl ce6aab89cf Fix a possible permutation issue 11 years ago
scrawl c64dc2c831 Terrain specular mapping: use a "_diffusespec" postfix to indicate specular information is present in the alpha channel. Use alpha directly instead of 1-alpha. 11 years ago
Lukasz Gromanowski 60fb75b03a Fixed valgrind warning about uninitialized variable:
==16814== Conditional jump or move depends on uninitialised value(s)
==16814==    at 0xA945B8: Terrain::QuadTreeNode::update(Ogre::Vector3 const&, Loading::Listener*) (quadtreenode.cpp:269)
==16814==    by 0xA94A77: Terrain::QuadTreeNode::update(Ogre::Vector3 const&, Loading::Listener*) (quadtreenode.cpp:354)
==16814==    by 0xA77541: Terrain::World::update(Ogre::Vector3 const&) (world.cpp:159)
==16814==    by 0x6EBA17: MWRender::RenderingManager::requestMap(MWWorld::CellStore*) (renderingmanager.cpp:649)
==16814==    by 0x8A25C4: MWWorld::Scene::loadCell(MWWorld::CellStore*, Loading::Listener*) (scene.cpp:157)
==16814==    by 0x8A2CEA: MWWorld::Scene::changeCell(int, int, ESM::Position const&, bool) (scene.cpp:296)
==16814==    by 0x8A2DE0: MWWorld::Scene::changeToExteriorCell(ESM::Position const&) (scene.cpp:440)
==16814==    by 0x85AC17: MWWorld::World::changeToExteriorCell(ESM::Position const&) (worldimp.cpp:761)
==16814==    by 0x927E38: OMW::Engine::prepareEngine(Settings::Manager&) (engine.cpp:436)
==16814==    by 0x92843D: OMW::Engine::go() (engine.cpp:483)
==16814==    by 0x6C6B3F: main (main.cpp:279)
==16814==  Uninitialised value was created by a heap allocation
==16814==    at 0x4C27CC2: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16814==    by 0xA93E60: Terrain::QuadTreeNode::createChild(Terrain::ChildDirection, float, Ogre::Vector2 const&) (quadtreenode.cpp:178)
==16814==    by 0xA7733E: Terrain::World::buildQuadTree(Terrain::QuadTreeNode*) (world.cpp:139)
==16814==    by 0xA76B18: Terrain::World::World(Loading::Listener*, Ogre::SceneManager*, Terrain::Storage*, int, bool, bool) (world.cpp:94)
==16814==    by 0x6EC6EB: MWRender::RenderingManager::enableTerrain(bool) (renderingmanager.cpp:1013)
==16814==    by 0x8A2A00: MWWorld::Scene::changeCell(int, int, ESM::Position const&, bool) (scene.cpp:206)
==16814==    by 0x8A2DE0: MWWorld::Scene::changeToExteriorCell(ESM::Position const&) (scene.cpp:440)
==16814==    by 0x85AC17: MWWorld::World::changeToExteriorCell(ESM::Position const&) (worldimp.cpp:761)
==16814==    by 0x927E38: OMW::Engine::prepareEngine(Settings::Manager&) (engine.cpp:436)
==16814==    by 0x92843D: OMW::Engine::go() (engine.cpp:483)
==16814==    by 0x6C6B3F: main (main.cpp:279)

Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
11 years ago
scrawl 5fd98d7c3a Add an assertion 11 years ago
scrawl 18c002a21d Fix an awful typo. 11 years ago
scrawl 69c0bb1723 Add normal, specular & parallax mapping for terrain 11 years ago
scrawl 188df341c3 Replaced log2 to make VC happy 12 years ago
scrawl 839d251cc5 Renamed Terrain::Terrain to Terrain::World to make VC happy 12 years ago
scrawl d3d6dfbde8 Refactored loading screen
- Add loading progress for data files, global map, terrain
 - Refactored and improved cell loading progress
12 years ago
Nikolay Kasyanov dc6e15f38e Replaced std::pow with shift since clang doesn't like int as a first argument
(reports that call is ambiguous)
12 years ago
scrawl 5f7e6f7b10 Fix a material issue, layers per pass wasn't entirely correct 12 years ago
scrawl 43313437dc Fix composite map for cells without land data 12 years ago
scrawl ce5ea6d7d2 Use a proper node hierarchy; disconnect the root when entering interior 12 years ago
scrawl fa76d1631b Some terrain fixes 12 years ago
scrawl 8c8653160d Crash fix, material fix 12 years ago
scrawl b92da9ae93 Neighbour fix 12 years ago
scrawl ebf9debb80 Enabled terrain self shadows, implemented getHeightAt, some optimizations 12 years ago
scrawl e27437f8ed New terrain renderer - improvements:
- Consistent triangle alignment, fixes a noticable crack near the census and excise office. Note that alignment is still not the same as vanilla. Vanilla uses a weird diagonal pattern. I hope there aren't more trouble spots that will force us to replicate vanilla, but at least we can do that now.
 - Fixes several blending issues and cell border seams
 - Fix map render to use the terrain bounding box instead of an arbitrary height
 - Different LODs are now properly connected instead of using skirts
 - Support self shadowing
 - Normals and colors are stored in the vertices instead of a texture, this enables per-vertex lighting which should improve performance, fix compatibility issues due to the PS getting too large and mimic vanilla better
 - Support a fixed function fallback (though the splatting shader usually performs better)
 - Designed for distant land support - test: https://www.youtube.com/watch?v=2wnd9EuPJIY - we can't really enable this yet due to depth precision issues when using a large view distance
12 years ago
scrawl a41a23c90a Deleted old code 12 years ago
greye 1339787863 remove underscores from filenames in esm 12 years ago
guidoj a021165d9f Changed standard C lib includes to C++ format 13 years ago
Chris Robinson bd68f7bd33 Remove final direct uses of Mangle::Stream 13 years ago
Jan-Peter Nilsson 4dd76ff36e Remove no longer needed local .gitignore 14 years ago
Nicolay Korslund 255b0d03a9 Started early work on terrain code (no rendering yet.) 14 years ago