wavelength 1.0.0
Loading...
Searching...
No Matches
beam.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <memory>
5
6#include "gfx/beamparams.h"
7#include "gfx/ship.h"
8#include "math/color.h"
9#include "math/vector2.h"
10#include "math/vector3.h"
11#include "rnd/rndline.h"
12#include "rnd/rndmat.h"
14
20class Beam {
21public:
29
37
45 void Configure(const BeamParams *pParams);
46
57 void Start(Ship *pOwner, std::list<Ship::BeamData> *pOwnerList, float fStart, float fEnd);
58
65 void Stop();
66
77 bool Update(const Vector3 &direction, const Vector3 &side, const Color &color);
78
87 void SetEnd(int nEnd, const float *pPosition);
88
90 RndLine *GetLine() const {
91 return mLine.get();
92 }
93
95 RndMat *GetMat() const {
96 return mMat.get();
97 }
98
100 Beam *GetNextFree() const {
101 return mNextFree;
102 }
103
105 void SetNextFree(Beam *pNextFree) {
106 mNextFree = pNextFree;
107 }
108
110 float GetStartTime() const {
111 return mStartTime;
112 }
113
115 void SetOwner(Ship *pOwner) {
116 mOwner = pOwner;
117 }
118
120 std::list<Ship::BeamData> *GetOwnerList() const {
121 return mOwnerList;
122 }
123
125 void SetOwnerList(std::list<Ship::BeamData> *pOwnerList) {
126 mOwnerList = pOwnerList;
127 }
128
129private:
130 const BeamParams *mParams;
131 unsigned char mReserved04[0x0c]; // +0x04, not yet recovered.
132 float mEnds[2][kTransformRowFloatCount];
133 std::unique_ptr<RndLine> mLine;
134 std::unique_ptr<RndMat> mMat;
135 float mStartTime;
136 float mEndTime;
137 Ship *mOwner;
138 std::list<Ship::BeamData> *mOwnerList;
139 Vector2 mFrequencies;
140 Vector2 mTravelPeriods;
141 unsigned char mReserved58[0x08]; // +0x58, not yet recovered.
142 Beam *mNextFree;
143 unsigned char mReserved64[0x0c]; // +0x64, not yet recovered.
144};
Look of a family of beams, read from the configuration entry of its name.
Definition beamparams.h:15
Beam a ship fires at a gem, a line that two waves ripple along.
Definition beam.h:20
void SetEnd(int nEnd, const float *pPosition)
Move one end of the beam.
RndLine * GetLine() const
Definition beam.h:90
bool Update(const Vector3 &direction, const Vector3 &side, const Color &color)
Ripple the line of the beam between its ends and colour it.
void Start(Ship *pOwner, std::list< Ship::BeamData > *pOwnerList, float fStart, float fEnd)
Fire the beam for a ship, with waves of random frequencies and periods.
void SetNextFree(Beam *pNextFree)
Definition beam.h:105
void Stop()
Stop the beam and hide it.
void SetOwnerList(std::list< Ship::BeamData > *pOwnerList)
Definition beam.h:125
void Configure(const BeamParams *pParams)
Take the look of a family of beams.
void SetOwner(Ship *pOwner)
Definition beam.h:115
std::list< Ship::BeamData > * GetOwnerList() const
Definition beam.h:120
RndMat * GetMat() const
Definition beam.h:95
Beam()
Construct an idle beam, creating its line and its material.
float GetStartTime() const
Definition beam.h:110
~Beam()
Destroy the line and the material of the beam.
Beam * GetNextFree() const
Definition beam.h:100
Line through points, drawn as a ribbon of constant screen width that faces the camera.
Definition rndline.h:26
Surface description: blending, lighting colours, culling, and a list of texture stages.
Definition rndmat.h:20
Ship of one player, which rides the tracks of the tunnel and fires beams at the gems.
Definition ship.h:41
Linear colour with four float components.
Definition color.h:12
Two-component vector, used for texture coordinates.
Definition vector2.h:12
Three-component vector, padded to a PlayStation 2 quadword.
Definition vector3.h:14
constexpr int kTransformRowFloatCount
Floats in a row of a transform held as a bare array, x, y, z, and padding.
Definition transform.h:29