Commit Graph
29 Commits
Author SHA1 Message Date
kichikuou 588d4f1024 Initial implementation of TapirEngine HLL
TapirEngine is the 3D rendering engine used in RanceQuest.

This implements the minimum functionality that is needed to render the
first battle scene. The lighting is still incorrect.
2023-07-08 08:05:07 +09:00
Nunuhara Cabbage 7392d74efe Replace debug_print with to_json
to_json and cJSON_Print are now used when displaying debug information.

The main reason for this change it to support sending objects over DAP.
2023-05-14 20:12:34 -07:00
kichikuou 10710e9908 ReignEngine: Cache parsed particle effects
Now parsed particle-effect definitions are cached in a hash map in the
plugin object. To make it possible, static part of `struct
particle_effect` and `struct particle_object` are factored out to
`struct pae` and `struct pae_object` respectively.
2022-12-28 13:18:41 +09:00
kichikuou defeb0ba17 ReignEngine: Cache loaded models
When there are multiple instances of a model, now they share a single
model object. Model objects are retained in a hash table until the
plugin is released, which is fine because Toushin Toshi 3 doesn't reuse
a plugin across scenes.
2022-12-28 13:18:41 +09:00
kichikuou 06b9da800c Implement ReignEngine.SetInstanceDebugDrawShadowVolume
It visualizes the bounding sphere of the instance. Although it is only
called from dead code in Toushin Toshi 3, it's useful for debugging
shadow mapping.
2022-12-24 16:54:37 +09:00
kichikuou fdd0af8dcf ReignEngine: Improve shadow view-frustum calculation
This fixes broken shadow rendering e.g. when Nacht climbs a ladder.

Now update_bones() calculates the instance's bounding sphere which
is the minimum sphere containing the AABB of current bone coordinates.
This corresponds to the sphere that is displayed when calling
SetInstanceDebugDrawShadowVolume on the original ReignEngine.dll.
2022-12-24 16:25:05 +09:00
kichikuou 3ef252c68b ReignEngine: Improve z-sorting
This fixes billboard rendering issue in some dungeons.

* For polygon models, use its AABB's center coordinates.
* Consider the camera angle, i.e. sort by view-space Z-coordinate
  instead of world-space Z-coordinate.
2022-12-17 10:59:16 +09:00
kichikuou 28f95bfe38 ReignEngine: Implement {Get,Set}InstanceDrawType
Billboards of draw type 1 are drawn with additive blending.
2022-11-20 09:47:10 +09:00
kichikuou 00d1d01353 ReignEngine: Per-mesh control of drawing order
Before this, the order of drawing was determined on an instance-by-
instance basis. Instances with even a single transparent material were
drawn after fully opaque instances.

After this, first the opaque meshes in all instances are drawn, and then
the transparent meshes are drawn from the nearest to the farthest.
2022-11-13 14:20:31 +09:00
kichikuou 5f17dafdf8 ReignEngine: Set correct initial value for fog parameters
This fixes rendering issue of the model viewer in Alice's Mansion.
2022-11-05 22:17:38 +09:00
kichikuou 31823f5731 ReignEngine: Draw instances in z-order
To get correct blending effect for overlapped transparent objects.
2022-11-05 20:56:25 +09:00
kichikuou 773cce03eb ReignEngine: Implement camera quake effect 2022-10-01 16:24:13 +09:00
kichikuou 909168acdb ReignEngine: Implement particle rendering
This completes the implementation of the particle effect system, except
for the camera quake effect.
2022-09-25 10:39:37 +09:00
kichikuou 0ff9c5a62c ReignEngine: Add loader for particle effects
This implements a parser for particle effect definition files (.pae)
and a set of field accessor functions for the RE_ITYPE_PARTICLE_EFFECT
instance type. Rendering of effects is not yet implemented.
2022-09-04 10:17:03 +09:00
kichikuou 06a630ea62 ReignEngine: Implement Fog
There are two types of fog, linear fog and atmospheric scattering. The
formula for light scattering is incorrect (see the comment in
reign.v.glsl) and therefore not physically correct.
2022-08-06 09:38:48 +09:00
kichikuou d185ae71bf ReignEngine: Implement CalcInstanceHeightDetection
This is used to compute Y-positions of map objects.

It is called quite often, so this implementation creates and caches a
height map of the instance by (re)using the shader for shadow mapping.
2022-07-30 15:17:08 +09:00
kichikuou 233b2a4f20 ReignEngine: Implement shadow mapping 2022-07-24 16:01:16 +09:00
kichikuou 2918a6310c ReignEngine: Remove hard limit on number of instances
Some maps in Toushin Toshi 3 have more than 32 instances.
2022-07-23 21:41:41 +09:00
kichikuou e7c9410df4 ReignEngine: Implement two functions
GetInstanceBoneIndex and TransInstanceLocalPosToWorldPosByBone.
2022-07-18 13:01:49 +09:00
kichikuou 3343efbcb9 Implement ReignEngine.BuildModel
Instance motions are updated with this function.
2022-07-17 16:20:02 +09:00
kichikuou c86ca5de87 ReignEngine: Implement bump mapping 2022-07-16 12:59:35 +09:00
kichikuou b42032c9f8 ReignEngine: Implement basic lighting
This implements a Phong shading with ambient, diffuse and specular
components, using up to three directional lights and one specular light.

The light calculation is made to match the "high quality" 3D mode of
Toushin Toshi 3.
2022-07-09 14:36:44 +09:00
kichikuou d11116f647 ReignEngine: Support billboard instance type
Used for 2D objects (e.g. NPCs in dungeons).
2022-06-19 12:19:41 +09:00
kichikuou 3851dc7c6a ReignEngine: Add RE_instance_type enum
This is in preparation for supporting non-polygon instance types.
2022-06-19 11:51:13 +09:00
kichikuou 1568d63117 ReignEngine: Implement background CG functions
This also moves debug print functions to a separate file.
2022-06-18 10:32:49 +09:00
kichikuou db97942393 Implement ReignEngine.SetInstanceAlpha 2022-06-12 21:27:49 +09:00
kichikuou 442ebce079 Add debug_print method to draw_plugin
Plugins can implement this so that scene_print will print additional
information for the sprite. RE_plugin implements this to dump the 3D
scene information.
2022-06-11 13:43:59 +09:00
kichikuou a2bbe15b20 ReignEngine: Implement skeletal animation 2022-06-11 13:28:02 +09:00
kichikuou dca30c3aab Initial implementation of ReignEngine HLL
ReignEngine is the 3D rendering engine used in Toushin Toshi III, and is
the predecessor of the 3D engines for Rance Quest, Rance 9, Evenicle,
etc.

This implements minimal functionality to be able to draw the first 3D
dungeon scene. Many important parts such as motion and lighting are not
implemented yet.
2022-06-04 11:29:07 +09:00