Commit graph

1355 commits

Author SHA1 Message Date
Vsevolod Kremianskii
5817ba0a79 Revert to reading bone map from MDL
Some models use more than 16 bones per node.
2021-05-15 10:14:59 +07:00
Vsevolod Kremianskii
4c7d588af9 Fix bump mapping
- Use tangent space normals from MDL
- Fix tangent space to world space transform
2021-05-15 09:52:14 +07:00
Vsevolod Kremianskii
5eefe157e7 Make bones influence normals in VS 2021-05-15 08:41:31 +07:00
Vsevolod Kremianskii
e1366255dc Fix loading Size Y emitter property 2021-05-15 07:52:35 +07:00
Vsevolod Kremianskii
bd41b81dc2 Fix CI build 2021-05-15 07:49:42 +07:00
Vsevolod Kremianskii
740440ca78 Major refactoring of the scene management system 2021-05-14 23:31:05 +07:00
Vsevolod Kremianskii
aeffc4b453 Rename ModelNodeSceneNode to MeshSceneNode 2021-05-13 15:16:49 +07:00
Vsevolod Kremianskii
366d8d739d Major graphics/model refactoring
- Decouple Model and ModelNode from MdlReader
- Make Emitter a nested struct under ModelNode
- Read all known controller types
2021-05-13 14:54:23 +07:00
Vsevolod Kremianskii
277a94bec7 Simplify materials
- Remove specular parameter (shininess is enough)
- Explicit default material is removed
- Default roughness is set to 0.5
2021-05-12 12:20:43 +07:00
Vsevolod Kremianskii
4a2c507c0f Swap bone indices and bone weights vertex attributes 2021-05-12 12:09:05 +07:00
Vsevolod Kremianskii
640b5a3c8e Improve grass lightmapping
- Read face materials from MDL
- Use AABB model node, not walkmesh, to create grass clusters
- Use barycentric coordinates to interpolate texture coordinates

While at it, add Mesh methods to draw a subset of triangles.
2021-05-12 12:05:04 +07:00
Vsevolod Kremianskii
d09b53b5c0 Cleanup Mesh class 2021-05-11 23:26:00 +07:00
Vsevolod Kremianskii
2843761be0 Add mesh and texture subdirectories to engine/graphics 2021-05-11 23:05:34 +07:00
Vsevolod Kremianskii
214aded7a4 Refactor ModelMesh
- Make it a struct, given how it doesn't have a behavior
- Place it under ModelNode
2021-05-11 22:25:52 +07:00
Vsevolod Kremianskii
f8ae6c8315 Implicitly calculate vertexCount in Mesh ctor 2021-05-11 20:19:46 +07:00
Vsevolod Kremianskii
854c72a16a Make Mesh independent of MdlReader
Remove friend class.
2021-05-11 20:07:02 +07:00
Vsevolod Kremianskii
0e2ffbee9d Refactor VertexOffsets
- Extract from Mesh
- Rename to VertexAttributes
- Move stride on top
2021-05-11 19:17:34 +07:00
Vsevolod Kremianskii
ebee8f36c6 Drop redundant buffer binding in Mesh 2021-05-11 18:59:28 +07:00
Vsevolod Kremianskii
ad399815b7 Refactor collision detection
- Drop CollisionDetector class as unnecessary abstraction
- Move collision detection code from area.cpp into area_collision.cpp
- Implement sliding along obstacle normals
- Temporarily disable collision between creatures
2021-05-10 21:57:21 +07:00
Vsevolod Kremianskii
235ed4a274 Cleanup collision detection 2021-05-10 16:12:17 +07:00
Vsevolod Kremianskii
e99822ae3c Refactor shadow casters 2021-05-10 12:07:44 +07:00
Vsevolod Kremianskii
200b1ad6d8 Select lights closest to the reference node, not per model
This makes dynamic lighting slighly more performant and improves area
lighting.
2021-05-10 11:55:13 +07:00
Vsevolod Kremianskii
563238fd92 Remove maximum number of lights setting
It is redundant, 8 is an optimal number.
2021-05-10 11:25:21 +07:00
Vsevolod Kremianskii
a902a92d34 Drop exposure setting
Exposure must not be something a user should adjust - proper
exposure must be selected for each scene by an algorithm.
2021-05-10 11:14:20 +07:00
Vsevolod Kremianskii
8f13fe5c84 Drop redundant transforms when rendering controls 2021-05-10 09:15:17 +07:00
Vsevolod Kremianskii
bf5b9c58c0 Refactor updating scene graph 2021-05-08 09:36:19 +07:00
Vsevolod Kremianskii
8bcdfc0e6e Tweak shaders
- Directional lights have constant attenuation
- Fix lightmap contribution to water
2021-05-08 09:22:38 +07:00
Vsevolod Kremianskii
4df4e189ee Fix water rendering in PBR mode 2021-05-08 01:49:57 +07:00
Vsevolod Kremianskii
e61250aa44 Do not use lightmaps in dynamic room lighting mode 2021-05-08 01:42:12 +07:00
Vsevolod Kremianskii
15b0424984 Refactor PBR shaders 2021-05-08 01:39:50 +07:00
Vsevolod Kremianskii
0e22dbfd47 Refactor Blinn-Phong shaders 2021-05-08 00:11:39 +07:00
Vsevolod Kremianskii
e6b70fe6e2 Use a separate (simplified) shader for diffuseless models 2021-05-07 19:39:40 +07:00
Vsevolod Kremianskii
e8ff1d9ece Revise PBR shaders
While at it, move GLSL sources into a separate folder. Also split them
into multiple files: common, Blinn-Phong and PBR.
2021-05-07 18:55:17 +07:00
Vsevolod Kremianskii
133949fe3e When prefiltering an envmap, take envmap resolution as uniform 2021-05-07 16:53:16 +07:00
Vsevolod Kremianskii
df7939de1a Fix unwanted model culling during character generation 2021-05-07 16:39:27 +07:00
Vsevolod Kremianskii
edabf403d3 Refactor the scene graph
Among other things, make it responsible for culling objects.
2021-05-06 13:22:34 +07:00
Vsevolod Kremianskii
4d8b298e3a Clear transition flag in SceneNodeAnimator
This fixes certain issues with animation blending.
2021-05-06 11:35:50 +07:00
Vsevolod Kremianskii
042d9be42f Properly blend particles with Lighten blending type
Also fix how particles interact with self-illuminated background.
2021-05-06 09:12:28 +07:00
Vsevolod Kremianskii
aab0bf33ca Refactor frustum culling
- Give more descriptive names to frustum planes
- Simplify AABB in frustum check (is also more accurate now?)
2021-05-06 08:31:52 +07:00
Vsevolod Kremianskii
a0e72164ed Convert stateutil into StateManager
Apparently, application-side caching of GL states improves performance.
2021-05-06 08:07:12 +07:00
Vsevolod Kremianskii
ae7dc8eb12 Move GLSL shaders into a separate CPP file 2021-05-06 07:42:28 +07:00
Vsevolod Kremianskii
c9a9e20a1f Make fog less prominent in HDR mode 2021-05-06 07:22:39 +07:00
Vsevolod Kremianskii
82c0398a24 Refactor heightmapped water rendering
This also fixes seams, although not completely.
2021-05-06 07:18:04 +07:00
Vsevolod Kremianskii
a89338d8cd Tweak tangent space calculations
Not to say it was incorrect before, but this version is closer to Learn
OpenGL.
2021-05-05 20:45:24 +07:00
Vsevolod Kremianskii
05ca0596e4 Implement external default party configuration
Default party configuration, used when loading a module from the
main menu, can now be configured from defaultparty.2da resource.
2021-05-05 14:52:24 +07:00
Vsevolod Kremianskii
5f99775c50 Treat lightmapped objects as not self-illuminated 2021-05-05 14:17:10 +07:00
Vsevolod Kremianskii
fc066f743d Add Python script to bootstrap modules from other modules
[ci skip]
2021-05-05 12:27:35 +07:00
Vsevolod Kremianskii
6386c5e61c Update models diagram
[ci skip]
2021-05-05 09:45:08 +07:00
Vsevolod Kremianskii
2288c5dac8 Remove .editorconfig
I'm not sure whether it's actual anymore, nor do I know if it ever worked
correctly.

[ci skip]
2021-05-05 08:10:40 +07:00
Vsevolod Kremianskii
62ed8f58e2 Move tools, launcher, external and tests under src directory 2021-05-05 08:08:12 +07:00