kichikuou
33760da0fa
Implement Cursor.Set HLL function
...
In Toushin Toshi 3, it is used only to show / hide the mouse cursor.
2022-11-19 21:46:11 +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
Nunuhara Cabbage
a3e3232825
Update libsys4
2022-11-11 20:28:45 -08: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
581593f9b5
ReignEngine: Support (env) mesh attribute
...
If specified, the mesh should be rendered with environment mapping
using the material's COLOR_MAP as a matcap texture.
2022-11-05 20:56:26 +09:00
kichikuou
241f631d9d
ReignEngine: Set loop frame range for particle effects
...
Without this, update_motion cannot calculate current_frame correctly
when the effect is used with RE_MOTION_STATE_LOOP state.
2022-11-05 20:56:26 +09:00
kichikuou
814ebb7d3d
ReignEngine: Support (sprite) material attribute
...
If specified, alpha test is used instead of alpha blend.
2022-11-05 20:56:25 +09:00
kichikuou
1a9a2e9753
ReignEngine: Support (nolighting) mesh attribute
...
In ReignEngine, the mesh name field may contain keywords that change
rendering behavior. The "(nolighting)" keyword disables lighting and
fog.
2022-11-05 20:56:25 +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
88268b084c
Fix integer overflow in audio_mixer.c
...
This fixes a bug in Toushin Toshi 3 where the audio thread crashes when
battle ended, after exploring the second dungeon for (INT_MAX / 44100)
milliseconds (~= 50 secs).
2022-10-22 10:23:22 +09:00
kichikuou
2370052b54
ReignEngine: Fix bone mapping between model and motion
...
Some motion files (e.g. maidsan_ahoge_* and otokomae_*) have wrong bone
IDs, so bone names should be used to look up matching bones in the
model.
However, this does not always work because masokan.POL has multiple
bones with the same name. In that case ID matching must be used.
2022-10-10 14:20:20 +09:00
kichikuou
252f1b5464
Fix out-of-bounds access in MsgSkip HLL
...
Toushin Toshi 3 calls MsgSkip.{Get,Set}Flag with msgnum = -1.
2022-10-10 14:20:20 +09:00
kichikuou
5c288f87e5
Implement EFFECT_TV_SWITCH_OFF
...
Used in Toushin Toshi 3.
2022-10-10 14:20:20 +09:00
kichikuou
3f1d76cd9f
Fix text rendering issue in OpenGL ES
...
This fixes an issue where text is not rendered on Android.
In OpenGL ES3.0, GL_RED is not a valid value for the internalFormat
parameter of glTexImage2D.
2022-10-03 21:59:30 +09:00
Nunuhara Cabbage
bc852567f2
Merge pull request #73 from kichikuou/gles
...
Fix shader compilation errors in OpenGL ES
2022-10-01 10:37:52 -07:00
kichikuou
1ae812ff03
Fix shader compilation errors in OpenGL ES
2022-10-01 16:41:51 +09:00
kichikuou
3615223b52
ReignEngine: Implement alpha mapping
2022-10-01 16:24:20 +09:00
kichikuou
fbf74db7a4
ReignEngine: Fix rim lighting for very small rim_exponent values
2022-10-01 16:24:16 +09:00
kichikuou
773cce03eb
ReignEngine: Implement camera quake effect
2022-10-01 16:24:13 +09:00
kichikuou
97c65a33db
Add frame bounds check in render_polygon_particles()
2022-09-26 15:46:12 +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
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
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
Nunuhara Cabbage
3e536af09a
Implement DG_ADD, DG_EXIST, DG_ERASE
2022-08-02 18:16:16 -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
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
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
kichikuou
3343efbcb9
Implement ReignEngine.BuildModel
...
Instance motions are updated with this function.
2022-07-17 16:20:02 +09: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
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
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
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
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