Commit Graph
779 Commits
Author SHA1 Message Date
kichikuou 803bb1a8a4 ReignEngine: Fix BackCG issues
- Enable both alpha map and alpha mod, using the new drawing function
  gfx_copy_stretch_blend_amap_alpha().
- Do not draw if `bcg->show` flag is false.
- Do not WARNING() for SetBackCGNum(0) as it's used to unload the CG.
2022-09-11 21:08:54 +09:00
kichikuou c30225d535 ReignEngine: Bind all vertex attributes to fixed locations
So that model_load() doesn't have to depend on RE_renderer.
2022-09-11 14:39:37 +09:00
kichikuou 2ceb727a66 ReignEngine: Instances with draw=false should not cast shadows 2022-09-11 14:35:50 +09:00
kichikuou 7bffaeffe6 ReignEngine: Fix projection matrix calculation
Now it makes the same angle of view as the original ReignEngine.
2022-09-11 14:33:43 +09:00
Nunuhara Cabbage 57525689a2 Merge pull request #69 from kichikuou/particle
ReignEngine: Add loader for particle effects
2022-09-04 15:21:41 -07: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
Nunuhara Cabbage 30b810b309 Merge pull request #68 from kichikuou/fog
ReignEngine: Implement Fog
2022-08-05 18:51:38 -07: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
Nunuhara Cabbage 3e536af09a Implement DG_ADD, DG_EXIST, DG_ERASE 2022-08-02 18:16:16 -07:00
Nunuhara Cabbage 62a2dc003c Merge pull request #67 from kichikuou/height
ReignEngine: Implement CalcInstanceHeightDetection
2022-07-30 12:55:59 -07: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
Nunuhara Cabbage be977bab46 Merge pull request #66 from kichikuou/shadow
ReignEngine: Implement shadow mapping
2022-07-24 14:04:50 -07:00
kichikuou 233b2a4f20 ReignEngine: Implement shadow mapping 2022-07-24 16:01:16 +09:00
kichikuou b0e540e67b gfx: Expose low level shader loading function
And use it in 3d/. This gives more flexibility on vertex attribute /
uniform variable configurations.
2022-07-24 16:01:16 +09:00
Nunuhara Cabbage 9675c8f256 Merge pull request #65 from kichikuou/3d
ReignEngine improvements
2022-07-23 11:27:15 -07: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 fc81d0ec4e ReignEngine: Do not ignore BuildModel() with elapsed time 0
It isn't no-op, because instance motion may be changed by
SetInstanceMotionFrame().
2022-07-23 21:23:13 +09:00
kichikuou e7c9410df4 ReignEngine: Implement two functions
GetInstanceBoneIndex and TransInstanceLocalPosToWorldPosByBone.
2022-07-18 13:01:49 +09:00
Nunuhara Cabbage feb2fc17f4 Merge pull request #64 from kichikuou/BuildModel
Implement ReignEngine.BuildModel
2022-07-17 16:29:23 -07:00
kichikuou 3343efbcb9 Implement ReignEngine.BuildModel
Instance motions are updated with this function.
2022-07-17 16:20:02 +09:00
Nunuhara Cabbage b1f3e85c4d Merge pull request #63 from kichikuou/lighting
ReignEngine: Implement bump mapping and light mapping
2022-07-16 11:15:01 -07:00
kichikuou af7127580c ReignEngine: Implement light mapping 2022-07-16 15:26:41 +09:00
kichikuou 84f55a55cd ReignEngine: Optimize vertex buffer layout
Now unused vertex attributes (e.g. bone weights) are not included in the
vertex buffer.
2022-07-16 15:26:38 +09:00
kichikuou c86ca5de87 ReignEngine: Implement bump mapping 2022-07-16 12:59:35 +09:00
Nunuhara Cabbage b98fff601f Merge pull request #62 from kichikuou/lighting
ReignEngine: Implement rim lighting and specular mapping
2022-07-10 21:47:49 -07:00
kichikuou 80c6b62074 ReignEngine: Implement specular map 2022-07-10 13:33:50 +09:00
kichikuou fe02c8f401 ReignEngine: Implement rim lighting
Lighting parameters are per-material and are stored in the .amt file.
2022-07-10 13:20:50 +09:00
Nunuhara Cabbage 2e23554162 Implement SACT2.Joypad_GetAnalogStickStatus 2022-07-09 17:35:07 -07:00
Nunuhara Cabbage 6ed2417612 Merge pull request #61 from kichikuou/billboard
ReignEngine: Fix billboard rendering issue
2022-07-09 17:22:40 -07:00
kichikuou 5e25dd4000 ReignEngine: Fix billboard rendering issue
This fixes an issue where billboard objects are not drawn in some
environments.

ReignEngine disables some vertex attributes when drawing billboards, but
AMD's driver doesn't draw anything if any of those attributes are
assigned to attribute index 0.

To avoid this, this explicitly binds "vertex_pos" attribute (which is
always enabled) to index 0.

References:
https://community.khronos.org/t/gldisablevertexattribarray-not-working/67077/4
https://stackoverflow.com/questions/28818997/how-to-use-glvertexattrib
2022-07-10 08:04:08 +09:00
Nunuhara Cabbage b39ad5fdc3 Merge pull request #60 from kichikuou/lighting
ReignEngine: Implement basic lighting
2022-07-09 08:28:34 -07: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 b23d05bcc2 ReignEngine: Load material parameters from .amt file 2022-07-09 14:36:40 +09:00
Nunuhara Cabbage 8b6d4943b3 Implement SH_A_FIND_SREF
Used in Rance 01.
2022-06-26 20:41:56 -07:00
Nunuhara Cabbage a78f5348f3 Fix memory leak in PassRegister 2022-06-26 20:15:52 -07:00
Nunuhara Cabbage 73b21210c2 Fix delegate memory management issues
Delegates should be ref'd in vm_copy and unref'd in variable_fini.

This also includes some improvements to the diagnostic reporting of
DEBUG_HEAP.
2022-06-26 17:55:05 -07:00
Nunuhara Cabbage be2b1421f1 Merge pull request #59 from kichikuou/Toushin3Loader
Toushin3Loader: Fix use-after-free after VM reset
2022-06-26 08:26:33 -07:00
kichikuou 60e9696a23 Toushin3Loader: Fix use-after-free after VM reset 2022-06-26 21:15:59 +09:00
Nunuhara Cabbage 9f42ee379d Improve performance of vm_image_to_json
Use a callback-based function to create the heap JSON array. This avoids
the O(n) insertion time of cJSON_AddItemToArray.
2022-06-25 10:00:24 -07:00
Nunuhara Cabbage 3a40542aab parts: fix bug with INT_MIN in numeral object
Use 64-bit integer to avoid overflow when creating numeral for INT_MIN.
2022-06-25 09:22:11 -07:00
Nunuhara Cabbage 841947d544 Fix delegate memory management and FT_ASSIGNS
Each delegate call needs to copy its arguments so that they aren't
double-freed by the next call.

Also fix a bug in FT_ASSIGNS where -1 was returned for non-existant
functions instead of 0.
2022-06-25 09:20:22 -07:00
Nunuhara Cabbage c14e7bd218 Ignore extension in asset_get_by_name
Fixes bug when starting battle in Rance 01.
2022-06-24 18:40:36 -07:00
Nunuhara Cabbage 96f307838f Merge branch 'master' of github.com:nunuhara/xsystem4 2022-06-24 18:02:14 -07:00
Nunuhara Cabbage fc42c42ef5 parts: refactor parent-child handling
Parent-child relationships are established by the UpdateComponent
function. Parts_SetParentPartsNumber does not establish the relationship
(and it does not create the parent object if it does not exist yet).

Render params are now computed recursively on children when they are set
on the parent (instead of recomputing them every time a child parts is
rendered).
2022-06-24 17:54:25 -07:00
Nunuhara Cabbage 8ee136b287 parts: various fixes and improvements
* SetAddColor and SetMultiplyColor implemented
* additive draw filter implemented
* GetPartsUpperLeftPos{X,Y} implemented
* various parameters are now applied from parent to child parts
* misc. bug fixes

The first dungeon screen in Rance 01 now renders correctly.
2022-06-21 19:57:36 -07:00
Nunuhara Cabbage 37cd4ac179 Fix save/resume issue with delegate pages 2022-06-19 16:52:08 -07:00
Nunuhara Cabbage 57b93839be parts: fix render order (again)
The render order is determined by the sum of the parts' z-value and the
z-values of its parents.
2022-06-19 15:42:00 -07:00
Nunuhara Cabbage ed31e25a38 Merge pull request #58 from kichikuou/billboard
ReignEngine: Support billboard instance type
2022-06-19 08:44:04 -07: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