mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Update conventions, formatting, docs
This commit is contained in:
parent
1d884a4d62
commit
1715fdb7b0
14 changed files with 205 additions and 101 deletions
|
@ -437,7 +437,7 @@
|
|||
</li>
|
||||
<li><span class="parameter">dir</span>
|
||||
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
|
||||
direction, or a point to which spotlight should be directed to
|
||||
normal which indicates light direction
|
||||
</li>
|
||||
<li><span class="parameter">color</span>
|
||||
<span class="types"><a class="type" href="../3 primitive classes/Color.html#">Color</a></span>
|
||||
|
|
|
@ -166,8 +166,16 @@
|
|||
<td class="summary">Sets the post-process tint.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#PlayFlyBy">PlayFlyBy(flyby)</a></td>
|
||||
<td class="summary">Enable FlyBy with specific ID</td>
|
||||
<td class="name" ><a href="#PlayFlyby">PlayFlyby(seqID)</a></td>
|
||||
<td class="summary">Play a flyby sequence.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#GetFlybyPosition">GetFlybyPosition(seqID, progress)</a></td>
|
||||
<td class="summary">Get a flyby sequence's position at a specified progress point in percent.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#GetFlybyRotation">GetFlybyRotation(seqID, progress)</a></td>
|
||||
<td class="summary">Get a flyby sequence's rotation at a specified progress point in percent.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#ResetObjCamera">ResetObjCamera()</a></td>
|
||||
|
@ -462,19 +470,19 @@
|
|||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "PlayFlyBy"></a>
|
||||
<strong>PlayFlyBy(flyby)</strong>
|
||||
<a name = "PlayFlyby"></a>
|
||||
<strong>PlayFlyby(seqID)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Enable FlyBy with specific ID
|
||||
Play a flyby sequence.
|
||||
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">flyby</span>
|
||||
<span class="types"><span class="type">short</span></span>
|
||||
(ID of flyby)
|
||||
<li><span class="parameter">seqID</span>
|
||||
<span class="types"><span class="type">int</span></span>
|
||||
Flyby sequence ID.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -482,6 +490,70 @@
|
|||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "GetFlybyPosition"></a>
|
||||
<strong>GetFlybyPosition(seqID, progress)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get a flyby sequence's position at a specified progress point in percent.
|
||||
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">seqID</span>
|
||||
<span class="types"><span class="type">int</span></span>
|
||||
Flyby sequence ID.
|
||||
</li>
|
||||
<li><span class="parameter">progress</span>
|
||||
<span class="types"><span class="type">float</span></span>
|
||||
Progress point in percent. Clamped to [0, 100].
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
|
||||
Position at the given progress point.
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "GetFlybyRotation"></a>
|
||||
<strong>GetFlybyRotation(seqID, progress)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get a flyby sequence's rotation at a specified progress point in percent.
|
||||
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">seqID</span>
|
||||
<span class="types"><span class="type">int</span></span>
|
||||
Flyby sequence ID.
|
||||
</li>
|
||||
<li><span class="parameter">progress</span>
|
||||
<span class="types"><span class="type">float</span></span>
|
||||
Progress point in percent. Clamped to [0, 100].
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../3 primitive classes/Rotation.html#">Rotation</a></span>
|
||||
Rotation at the given progress point.
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "ResetObjCamera"></a>
|
||||
|
|
|
@ -305,7 +305,7 @@
|
|||
<td class="summary">How should the application respond to script errors?</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#multiThreaded">multiThreaded</a></td>
|
||||
<td class="name" ><a href="#multithreaded">multithreaded</a></td>
|
||||
<td class="summary">Use multithreading in certain calculations.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -1259,8 +1259,8 @@
|
|||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "multiThreaded"></a>
|
||||
<strong>multiThreaded</strong>
|
||||
<a name = "multithreaded"></a>
|
||||
<strong>multithreaded</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Use multithreading in certain calculations. <br>
|
||||
|
@ -1270,7 +1270,7 @@
|
|||
|
||||
|
||||
<ul>
|
||||
<li><span class="parameter">multiThreaded</span>
|
||||
<li><span class="parameter">multithreaded</span>
|
||||
<span class="types"><span class="type">bool</span></span>
|
||||
determines whether to use multithreading or not. */
|
||||
</li>
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
<div id="content">
|
||||
|
||||
<h1>Primitive Class <code>Rotation</code></h1>
|
||||
<p>Represents a degree-based 3D rotation.</p>
|
||||
<p>Represents a 3D rotation.</p>
|
||||
<p> All angle components are in degrees clamped to the range [0.0, 360.0].</p>
|
||||
|
||||
|
||||
|
@ -135,6 +135,10 @@
|
|||
<td class="summary">Create a Rotation object.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#Lerp">Lerp(rot, alpha)</a></td>
|
||||
<td class="summary">Get the linearly interpolated Rotation between this Rotation and the input Rotation according to the input alpha.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#Direction">Direction()</a></td>
|
||||
<td class="summary">Get the normalized direction vector of this Rotation.</td>
|
||||
</tr>
|
||||
|
@ -237,6 +241,38 @@
|
|||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Lerp"></a>
|
||||
<strong>Lerp(rot, alpha)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get the linearly interpolated Rotation between this Rotation and the input Rotation according to the input alpha.
|
||||
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">rot</span>
|
||||
<span class="types"><a class="type" href="../3 primitive classes/Rotation.html#">Rotation</a></span>
|
||||
Interpolation target.
|
||||
</li>
|
||||
<li><span class="parameter">alpha</span>
|
||||
<span class="types"><span class="type">float</span></span>
|
||||
Interpolation alpha in the range [0, 1].
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../3 primitive classes/Rotation.html#">Rotation</a></span>
|
||||
Linearly interpolated rotation.
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Direction"></a>
|
||||
|
|
|
@ -469,7 +469,7 @@
|
|||
<ul>
|
||||
<li><span class="parameter">vector</span>
|
||||
<span class="types"><a class="type" href="../3 primitive classes/Vec2.html#">Vec2</a></span>
|
||||
Target interpolation vector.
|
||||
Interpolation target.
|
||||
</li>
|
||||
<li><span class="parameter">alpha</span>
|
||||
<span class="types"><span class="type">float</span></span>
|
||||
|
@ -481,7 +481,7 @@
|
|||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../3 primitive classes/Vec2.html#">Vec2</a></span>
|
||||
Linearly interpolated vector
|
||||
Linearly interpolated vector.
|
||||
</ol>
|
||||
|
||||
|
||||
|
|
|
@ -464,7 +464,7 @@
|
|||
<ul>
|
||||
<li><span class="parameter">vector</span>
|
||||
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
|
||||
Target interpolation vector.
|
||||
Interpolation target.
|
||||
</li>
|
||||
<li><span class="parameter">alpha</span>
|
||||
<span class="types"><span class="type">float</span></span>
|
||||
|
@ -476,7 +476,7 @@
|
|||
<ol>
|
||||
|
||||
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
|
||||
Linearly interpolated vector
|
||||
Linearly interpolated vector.
|
||||
</ol>
|
||||
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@
|
|||
</ul>
|
||||
<h2>5 Lua utility modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li> <a href="../5 lua utility modules/Diary.html">Diary</a></li>
|
||||
<li> <a href="../5 lua utility modules/EventSequence.html">EventSequence</a></li>
|
||||
<li> <a href="../5 lua utility modules/Timer.html">Timer</a></li>
|
||||
<li> <a href="../5 lua utility modules/Type.html">Type</a></li>
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
<li> <a href="../4 enums/Flow.GameStatus.html">Flow.GameStatus</a></li>
|
||||
<li> <a href="../4 enums/Input.ActionID.html">Input.ActionID</a></li>
|
||||
<li> <a href="../4 enums/Objects.AmmoType.html">Objects.AmmoType</a></li>
|
||||
<li> <a href="../4 enums/Objects.HandStatus.html">Objects.HandStatus</a></li>
|
||||
<li> <a href="../4 enums/Objects.WeaponType.html">Objects.WeaponType</a></li>
|
||||
<li> <a href="../4 enums/Objects.MoveableStatus.html">Objects.MoveableStatus</a></li>
|
||||
<li> <a href="../4 enums/Objects.ObjID.html">Objects.ObjID</a></li>
|
||||
|
|
|
@ -227,7 +227,7 @@ LevelFuncs.AddProp = <span class="keyword">function</span> (prop)
|
|||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the variable is a number, false if it isn't a number
|
||||
<em>true</em> if the variable is a number, <em>false</em> otherwise
|
||||
</ol>
|
||||
|
||||
|
||||
|
@ -263,7 +263,7 @@ LevelFuncs.AddProp = <span class="keyword">function</span> (prop)
|
|||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the variable is a string, false if it isn't a string
|
||||
<em>true</em> if the variable is a string, <em>false</em> otherwise
|
||||
</ol>
|
||||
|
||||
|
||||
|
@ -299,7 +299,7 @@ LevelFuncs.AddProp = <span class="keyword">function</span> (prop)
|
|||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the variable is a boolean, false if it isn't a boolean
|
||||
<em>true</em> if the variable is a boolean, <em>false</em> otherwise
|
||||
</ol>
|
||||
|
||||
|
||||
|
@ -338,7 +338,7 @@ LevelFuncs.AddProp = <span class="keyword">function</span> (prop)
|
|||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the variable is a table, false if it isn't a table
|
||||
<em>true</em> if the variable is a table, <em>false</em> otherwise
|
||||
</ol>
|
||||
|
||||
|
||||
|
@ -377,7 +377,7 @@ LevelFuncs.AddProp = <span class="keyword">function</span> (prop)
|
|||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the variable is a null, false if it isn't a null
|
||||
<em>true</em> if the variable is a null, <em>false</em> otherwise
|
||||
</ol>
|
||||
|
||||
|
||||
|
@ -416,7 +416,7 @@ LevelFuncs.AddProp = <span class="keyword">function</span> (prop)
|
|||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the variable is a function, false if it isn't a function
|
||||
<em>true</em> if the variable is a function, <em>false</em> otherwise
|
||||
</ol>
|
||||
|
||||
|
||||
|
@ -453,7 +453,7 @@ LevelFuncs.AddProp = <span class="keyword">function</span> (prop)
|
|||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the variable is a color, false if it isn't a color
|
||||
<em>true</em> if the variable is a Color, <em>false</em> otherwise
|
||||
</ol>
|
||||
|
||||
|
||||
|
@ -490,7 +490,7 @@ LevelFuncs.AddProp = <span class="keyword">function</span> (prop)
|
|||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the variable is a rotation, false if it isn't a rotation
|
||||
<em>true</em> if the variable is a Rotation, <em>false</em> otherwise
|
||||
</ol>
|
||||
|
||||
|
||||
|
@ -527,7 +527,7 @@ LevelFuncs.AddProp = <span class="keyword">function</span> (prop)
|
|||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the variable is a vec2, false if it isn't a vec2
|
||||
<em>true</em> if the variable is a Vec2, <em>false</em> otherwise
|
||||
</ol>
|
||||
|
||||
|
||||
|
@ -564,7 +564,7 @@ LevelFuncs.AddProp = <span class="keyword">function</span> (prop)
|
|||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the variable is a vec3, false if it isn't a vec3
|
||||
<em>true</em> if the variable is a Vec3, <em>false</em> otherwise
|
||||
</ol>
|
||||
|
||||
|
||||
|
@ -601,7 +601,7 @@ LevelFuncs.AddProp = <span class="keyword">function</span> (prop)
|
|||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the variable is a Time object, false if it isn't a Time object
|
||||
<em>true</em> if the variable is a Time object, <em>false</em> otherwise
|
||||
</ol>
|
||||
|
||||
|
||||
|
@ -638,7 +638,7 @@ LevelFuncs.AddProp = <span class="keyword">function</span> (prop)
|
|||
<ol>
|
||||
|
||||
<span class="types"><span class="type">boolean</span></span>
|
||||
true if the variable is a LevelFunc, false if it isn't a IsLevelFunc
|
||||
<em>true</em> if the variable is a LevelFunc, <em>false</em> otherwise
|
||||
</ol>
|
||||
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ local door = GetMoveableByName("door_type4_14")
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="3 primitive classes/Rotation.html">Rotation</a></td>
|
||||
<td class="summary">Represents a degree-based 3D rotation.</td>
|
||||
<td class="summary">Represents a 3D rotation.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="3 primitive classes/Time.html">Time</a></td>
|
||||
|
|
|
@ -823,6 +823,7 @@ void CalculateSpotCameras()
|
|||
}
|
||||
|
||||
// Core's version. Proper decompilation by ChocolateFan
|
||||
// TODO: Replace with float-based version.
|
||||
int Spline(int x, int* knots, int nk)
|
||||
{
|
||||
int span = x * (nk - 3) >> 16;
|
||||
|
@ -838,58 +839,51 @@ int Spline(int x, int* knots, int nk)
|
|||
return ((__int64)x * (((__int64)x * (((__int64)x * c1 >> 16) + c2) >> 16) + (k[2] >> 1) + ((-k[0] - 1) >> 1)) >> 16) + k[1];
|
||||
}
|
||||
|
||||
Pose GetCameraTransform(int sequence, float progress)
|
||||
Pose GetCameraTransform(int sequence, float alpha)
|
||||
{
|
||||
progress = std::clamp(progress, 0.0f, 1.0f);
|
||||
alpha = std::clamp(alpha, 0.0f, 1.0f);
|
||||
|
||||
// Retrieve total number of cameras in the sequence.
|
||||
int totalCameras = CameraCnt[SpotCamRemap[sequence]];
|
||||
if (totalCameras < 2)
|
||||
// Retrieve camera count in sequence.
|
||||
int cameraCount = CameraCnt[SpotCamRemap[sequence]];
|
||||
if (cameraCount < 2)
|
||||
return Pose::Zero; // Not enough cameras to interpolate.
|
||||
|
||||
// Find the starting index for the sequence.
|
||||
int firstIndex = 0;
|
||||
// Find first ID for sequence.
|
||||
int firstSeqID = 0;
|
||||
for (int i = 0; i < SpotCamRemap[sequence]; i++)
|
||||
firstIndex += CameraCnt[i];
|
||||
firstSeqID += CameraCnt[i];
|
||||
|
||||
// Determine number of spline points and spline position.
|
||||
int splinePoints = totalCameras + 2;
|
||||
int splinePosition = (int)(progress * (float)USHRT_MAX);
|
||||
|
||||
std::vector<int> posX, posY, posZ, tarX, tarY, tarZ, roll;
|
||||
int splinePoints = cameraCount + 2;
|
||||
int splineAlpha = int(alpha * (float)USHRT_MAX);
|
||||
|
||||
// Extract camera properties into separate vectors for interpolation.
|
||||
for (int i = -1; i < totalCameras + 1; i++)
|
||||
std::vector<int> xOrigins, yOrigins, zOrigins, xTargets, yTargets, zTargets, rolls;
|
||||
for (int i = -1; i < (cameraCount + 1); i++)
|
||||
{
|
||||
int idx = std::clamp(firstIndex + i, firstIndex, firstIndex + totalCameras - 1);
|
||||
int seqID = std::clamp(firstSeqID + i, firstSeqID, (firstSeqID + cameraCount) - 1);
|
||||
|
||||
posX.push_back(SpotCam[idx].x);
|
||||
posY.push_back(SpotCam[idx].y);
|
||||
posZ.push_back(SpotCam[idx].z);
|
||||
tarX.push_back(SpotCam[idx].tx);
|
||||
tarY.push_back(SpotCam[idx].ty);
|
||||
tarZ.push_back(SpotCam[idx].tz);
|
||||
roll.push_back(SpotCam[idx].roll);
|
||||
xOrigins.push_back(SpotCam[seqID].x);
|
||||
yOrigins.push_back(SpotCam[seqID].y);
|
||||
zOrigins.push_back(SpotCam[seqID].z);
|
||||
xTargets.push_back(SpotCam[seqID].tx);
|
||||
yTargets.push_back(SpotCam[seqID].ty);
|
||||
zTargets.push_back(SpotCam[seqID].tz);
|
||||
rolls.push_back(SpotCam[seqID].roll);
|
||||
}
|
||||
|
||||
// Compute spline interpolation of main flyby camera parameters.
|
||||
auto origin = Vector3(Spline(splineAlpha, xOrigins.data(), splinePoints),
|
||||
Spline(splineAlpha, yOrigins.data(), splinePoints),
|
||||
Spline(splineAlpha, zOrigins.data(), splinePoints));
|
||||
|
||||
auto position = Vector3(Spline(splinePosition, posX.data(), splinePoints),
|
||||
Spline(splinePosition, posY.data(), splinePoints),
|
||||
Spline(splinePosition, posZ.data(), splinePoints));
|
||||
auto target = Vector3(Spline(splineAlpha, xTargets.data(), splinePoints),
|
||||
Spline(splineAlpha, yTargets.data(), splinePoints),
|
||||
Spline(splineAlpha, zTargets.data(), splinePoints));
|
||||
|
||||
auto target = Vector3(Spline(splinePosition, tarX.data(), splinePoints),
|
||||
Spline(splinePosition, tarY.data(), splinePoints),
|
||||
Spline(splinePosition, tarZ.data(), splinePoints));
|
||||
short orientZ = Spline(splineAlpha, rolls.data(), splinePoints);
|
||||
|
||||
short orientZ = Spline(splinePosition, roll.data(), splinePoints);
|
||||
|
||||
Pose result;
|
||||
|
||||
result.Position = position;
|
||||
result.Orientation = EulerAngles(target - position);
|
||||
result.Orientation.z = orientZ;
|
||||
|
||||
return result;
|
||||
auto pose = Pose(origin, EulerAngles(target - origin));
|
||||
pose.Orientation.z = orientZ;
|
||||
return pose;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,4 +63,5 @@ void InitializeSpotCamSequences(bool startFirstSequence);
|
|||
void InitializeSpotCam(short sequence);
|
||||
void CalculateSpotCameras();
|
||||
int Spline(int x, int* knots, int nk);
|
||||
Pose GetCameraTransform(int sequence, float progress);
|
||||
|
||||
Pose GetCameraTransform(int sequence, float alpha);
|
||||
|
|
|
@ -347,9 +347,9 @@ static constexpr char ScriptReserved_KeyClearAll[] = "KeyClearAll";
|
|||
|
||||
static constexpr char ScriptReserved_FlipMap[] = "FlipMap";
|
||||
static constexpr char ScriptReserved_GetFlipMapStatus[] = "GetFlipMapStatus";
|
||||
static constexpr char ScriptReserved_PlayFlyBy[] = "PlayFlyBy";
|
||||
static constexpr char ScriptReserved_GetFlyByPosition[] = "GetFlyByPosition";
|
||||
static constexpr char ScriptReserved_GetFlyByRotation[] = "GetFlyByRotation";
|
||||
static constexpr char ScriptReserved_PlayFlyby[] = "PlayFlyby";
|
||||
static constexpr char ScriptReserved_GetFlybyPosition[] = "GetFlybyPosition";
|
||||
static constexpr char ScriptReserved_GetFlybyRotation[] = "GetFlybyRotation";
|
||||
|
||||
static constexpr char ScriptReserved_PlayCamera[] = "PlayCamera";
|
||||
static constexpr char ScriptReserved_ResetObjCamera[] = "ResetObjCamera";
|
||||
|
|
|
@ -105,28 +105,24 @@ namespace TEN::Scripting::View
|
|||
ObjCamera(LaraItem, 0, LaraItem, 0, false);
|
||||
}
|
||||
|
||||
static void PlayFlyBy(short flyby)
|
||||
static void PlayFlyby(int seqID)
|
||||
{
|
||||
UseSpotCam = true;
|
||||
InitializeSpotCam(flyby);
|
||||
InitializeSpotCam(seqID);
|
||||
}
|
||||
|
||||
static Vec3 GetFlyByPosition(short flyby, float progress)
|
||||
static Vec3 GetFlybyPosition(int seqID, float progress)
|
||||
{
|
||||
auto& result = GetCameraTransform(flyby, progress / 100.0f);
|
||||
return Vec3(result.Position);
|
||||
constexpr auto PROGRESS_MAX = 100.0f;
|
||||
|
||||
return Vec3(GetCameraTransform(seqID, progress / PROGRESS_MAX).Position);
|
||||
}
|
||||
|
||||
static Rotation GetFlyByRotation(short flyby, float progress)
|
||||
static Rotation GetFlybyRotation(int seqID, float progress)
|
||||
{
|
||||
auto& result = GetCameraTransform(flyby, progress / 100.0f);
|
||||
constexpr auto PROGRESS_MAX = 100.0f;
|
||||
|
||||
return
|
||||
{
|
||||
TO_DEGREES(result.Orientation.x),
|
||||
TO_DEGREES(result.Orientation.y),
|
||||
TO_DEGREES(result.Orientation.z)
|
||||
};
|
||||
return Rotation(GetCameraTransform(seqID, progress / PROGRESS_MAX).Orientation);
|
||||
}
|
||||
|
||||
static void FlashScreen(TypeOrNil<ScriptColor> col, TypeOrNil<float> speed)
|
||||
|
@ -239,24 +235,24 @@ namespace TEN::Scripting::View
|
|||
//@tparam Color tint value to use.
|
||||
tableView.set_function(ScriptReserved_SetPostProcessTint, &SetPostProcessTint);
|
||||
|
||||
///Play flyby sequence with specific ID
|
||||
//@function PlayFlyBy
|
||||
//@tparam short flyby (ID of flyby)
|
||||
tableView.set_function(ScriptReserved_PlayFlyBy, &PlayFlyBy);
|
||||
/// Play a flyby sequence.
|
||||
// @function PlayFlyby
|
||||
// @tparam int seqID Flyby sequence ID.
|
||||
tableView.set_function(ScriptReserved_PlayFlyby, &PlayFlyby);
|
||||
|
||||
///Get flyby sequence's position at a specified point in time
|
||||
//@function GetFlyByPosition
|
||||
//@tparam short flyby (ID of flyby)
|
||||
//@tparam float time point in time of a flyby in percent. Clamped to [0, 100].
|
||||
//@treturn Vec3 flyby position at a specified point in time
|
||||
tableView.set_function(ScriptReserved_GetFlyByPosition, &GetFlyByPosition);
|
||||
/// Get a flyby sequence's position at a specified progress point in percent.
|
||||
// @function GetFlybyPosition
|
||||
// @tparam int seqID Flyby sequence ID.
|
||||
// @tparam float progress Progress point in percent. Clamped to [0, 100].
|
||||
// @treturn Vec3 Position at the given progress point.
|
||||
tableView.set_function(ScriptReserved_GetFlybyPosition, &GetFlybyPosition);
|
||||
|
||||
///Get flyby sequence's rotation at a specified point in time
|
||||
//@function GetFlyByRotation
|
||||
//@tparam short flyby (ID of flyby)
|
||||
//@tparam float time point in time of a flyby in percent. Clamped to [0, 100].
|
||||
//@treturn Rotation flyby rotation at a specified point in time
|
||||
tableView.set_function(ScriptReserved_GetFlyByRotation, &GetFlyByRotation);
|
||||
/// Get a flyby sequence's rotation at a specified progress point in percent.
|
||||
// @function GetFlybyRotation
|
||||
// @tparam int seqID Flyby sequence ID.
|
||||
// @tparam float progress Progress point in percent. Clamped to [0, 100].
|
||||
// @treturn Rotation Rotation at the given progress point.
|
||||
tableView.set_function(ScriptReserved_GetFlybyRotation, &GetFlybyRotation);
|
||||
|
||||
/// Reset object camera back to Lara and deactivate object camera.
|
||||
//@function ResetObjCamera
|
||||
|
@ -273,6 +269,9 @@ namespace TEN::Scripting::View
|
|||
// @treturn float Display resolution's aspect ratio.
|
||||
tableView.set_function(ScriptReserved_GetAspectRatio, &GetAspectRatio);
|
||||
|
||||
// COMPATIBILITY
|
||||
tableView.set_function("PlayFlyBy", &PlayFlyby);
|
||||
|
||||
// Register types.
|
||||
ScriptDisplaySprite::Register(*state, parent);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue