mirror of
https://github.com/mwpenny/portal64-still-alive.git
synced 2024-11-23 04:19:50 +00:00
Some more portal gun polish
This commit is contained in:
parent
3a1ddebb26
commit
403e0d1bb9
Binary file not shown.
@ -1 +1 @@
|
||||
--fixed-point-scale 512 -m assets/materials/objects.skm.yaml --sort-dir 0.029977,0.118112,0.030978 --model
|
||||
--fixed-point-scale 512 -m assets/materials/objects.skm.yaml --sort-dir 0,1,0 --model
|
@ -24,6 +24,8 @@
|
||||
|
||||
#define PORTAL_GUN_SCALE 512.0f
|
||||
|
||||
struct Quaternion gFlipAroundY = {0.0f, 1.0f, 0.0f, 0.0f};
|
||||
|
||||
struct Transform gGunTransform = {
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 1.0f, 0.0f, 0.0f},
|
||||
@ -43,6 +45,8 @@ void portalGunInit(struct PortalGun* portalGun, struct Transform* at, int isFres
|
||||
portalTrailInit(&portalGun->projectiles[0].trail);
|
||||
portalTrailInit(&portalGun->projectiles[1].trail);
|
||||
|
||||
portalGun->rotation = at->rotation;
|
||||
|
||||
if (isFreshStart) {
|
||||
skAnimatorRunClip(&portalGun->animator, &portal_gun_v_portalgun_Armature_draw_clip, 0.0f, 0);
|
||||
} else {
|
||||
@ -143,6 +147,13 @@ void portalGunRenderReal(struct PortalGun* portalGun, struct RenderState* render
|
||||
} else {
|
||||
gDPSetEnvColor(renderState->dl++, 128, 128, 128, 255);
|
||||
}
|
||||
|
||||
struct Quaternion relativeRotation;
|
||||
struct Quaternion inverseCameraRotation;
|
||||
quatConjugate(&fromCamera->transform.rotation, &inverseCameraRotation);
|
||||
quatMultiply(&inverseCameraRotation, &portalGun->rotation, &relativeRotation);
|
||||
|
||||
quatMultiply(&relativeRotation, &gFlipAroundY, &gGunTransform.rotation);
|
||||
|
||||
transformToMatrixL(&gGunTransform, &matrix[0], PORTAL_GUN_SCALE);
|
||||
gSPMatrix(renderState->dl++, &matrix[0], G_MTX_MODELVIEW | G_MTX_PUSH | G_MTX_MUL);
|
||||
@ -156,7 +167,7 @@ void portalGunRenderReal(struct PortalGun* portalGun, struct RenderState* render
|
||||
#define MAX_PROJECTILE_DISTANCE 100.0f
|
||||
|
||||
void portalGunUpdatePosition(struct PortalGun* portalGun, struct Player* player) {
|
||||
portalGun->rotation = player->lookTransform.rotation;
|
||||
quatLerp(&portalGun->rotation, &player->lookTransform.rotation, 0.45f, &portalGun->rotation);
|
||||
}
|
||||
|
||||
void portalGunUpdate(struct PortalGun* portalGun, struct Player* player) {
|
||||
|
Loading…
Reference in New Issue
Block a user