- lower the distance to the near plane of the frustum for Overworld
and change the other parameters accordingly
- this makes the following actors visible:
- background of directions to Pegnose Pete's house (issue #869)
- Murray in the murray_go easter egg
- the trophies during the diving contest (upper left corner)
- the screenshots for the save games (still with the wrong texture)
- all actors of the Overworld should cover any non-Overworld drawings
- Overworld actors need to use the depth buffer so that e.g. the
pause screen is drawn above the inventory
- this fixes issue #927 (inventory is drawn above background of pause
or menu screen)
This adds math classes for doing frustum culling in software. These could be used for optimizing performance in many other places as well. For example, if an actor is outside the view frustum, it may not be necessary to do expensive keyframe animation and vertex skinning calculations for that actor.
Lighting is done by calculating vertex colors in software, since the attenuation model used in EMI cannot be simulated with OpenGL fixed function lighting. The original game does the lighting this way as well. Ideally for the modern shader-based renderer a shader would be used for this instead.
If multiple faces of one model are referring to the same triangles, let
them overwrite each other so that the latest one will be visible. For
this purpose glDepthFunc is changed from GL_LESS to GL_LEQUAL so
that subsequent drawing attempts for the same triangle are not ignored by
the depth test.
This fixes the issue of the colored leg of the monkey bot in the end
scenes: the leg is drawn using color maps by the first face and using
textures by a following face.
Use matrix multiplications to fix the rotation for attached actors:
- calculate the final transformation matrix recursively for attached
actors (instead of using getWorldPos and getWorldRot)
- use a different order for building the quaternions out of the Euler
angles
- changed handling of camera position (just apply the rotation of the
camera, the (inverted) position of the camera and the position of the
actor
- no functional changes for GRIM
- no changes for drawing in overworld
Code simplification for GRIM:
- no need to use _currentPos in calculations for GRIM since it is
always (0, 0, 0)
This fixes:
- the rotation of any items Guybrush is holding in his hands
- the handling of the pole when using the raft in the swamps
- getting the bananas with the banana picker
When an actor which is drawn using sprites moved due to water float
effects and if that actor uses multiple sprites, then these sprites are
not aligned (e.g. in the very first scene, the ship in the background is
not shown as one piece).
That is because the sprites are first rotated and then moved to
the correct position. It is necessary to first move them to their
correct position on the actor and then rotate the whole actor.
Additionally, non-overworld sprites needs to be rotated by the Yaw axis.
Otherwise the ship did not rock but only moved vertically.
This changes fixes:
- the ship in the background in the first scene
- the clock hands in the swamp
When mapping a sprite to a GL polygon its dimensions are scaled by the ratio
between the current screen resolution and the native game resolution. When
the polygon is rendered it is scaled again, causing sprites to be displayed
unproportionally big when using larger screen resolutions.
The MakeScreenTextures() opcode is used to create texture tiles from the
current screen content for use with an overworld actor, e.g. when fading over
the slides in the intro. With OpenGL the created textures were mirrorered in
y direction because OpenGL uses a different coordinate system where (0, 0)
is the bottom left corner.