mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-29 08:17:59 +03:00
Merge branch 'develop_60fps' into develop
This commit is contained in:
commit
1ba72e669c
8 changed files with 178 additions and 68 deletions
|
@ -122,11 +122,11 @@ pickups, and Lara herself (see also <a href="../2 classes/Objects.LaraObject.htm
|
||||||
<td class="summary">Shatter item.</td>
|
<td class="summary">Shatter item.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name" ><a href="#Moveable:SetEffect">Moveable:SetEffect(effect, timeout)</a></td>
|
<td class="name" ><a href="#Moveable:SetEffect">Moveable:SetEffect(effect[, timeout])</a></td>
|
||||||
<td class="summary">Set effect to moveable</td>
|
<td class="summary">Set effect to moveable</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name" ><a href="#Moveable:SetCustomEffect">Moveable:SetCustomEffect(Color1, Color2, timeout)</a></td>
|
<td class="name" ><a href="#Moveable:SetCustomEffect">Moveable:SetCustomEffect(Color1, Color2[, timeout])</a></td>
|
||||||
<td class="summary">Set custom colored burn effect to moveable</td>
|
<td class="summary">Set custom colored burn effect to moveable</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -227,10 +227,14 @@ pickups, and Lara herself (see also <a href="../2 classes/Objects.LaraObject.htm
|
||||||
<td class="summary">Determine whether the moveable is active or not</td>
|
<td class="summary">Determine whether the moveable is active or not</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name" ><a href="#Moveable:GetJointPosition">Moveable:GetJointPosition(index)</a></td>
|
<td class="name" ><a href="#Moveable:GetJointPosition">Moveable:GetJointPosition(index[, offset])</a></td>
|
||||||
<td class="summary">Get the object's joint position</td>
|
<td class="summary">Get the object's joint position</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td class="name" ><a href="#Moveable:GetJointRotation">Moveable:GetJointRotation(index)</a></td>
|
||||||
|
<td class="summary">Get the object's joint rotation</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<td class="name" ><a href="#Moveable:GetRotation">Moveable:GetRotation()</a></td>
|
<td class="name" ><a href="#Moveable:GetRotation">Moveable:GetRotation()</a></td>
|
||||||
<td class="summary">Get the moveable's rotation</td>
|
<td class="summary">Get the moveable's rotation</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -496,7 +500,7 @@ most can just be ignored (see usage).
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a name = "Moveable:SetEffect"></a>
|
<a name = "Moveable:SetEffect"></a>
|
||||||
<strong>Moveable:SetEffect(effect, timeout)</strong>
|
<strong>Moveable:SetEffect(effect[, timeout])</strong>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
Set effect to moveable
|
Set effect to moveable
|
||||||
|
@ -511,7 +515,8 @@ most can just be ignored (see usage).
|
||||||
</li>
|
</li>
|
||||||
<li><span class="parameter">timeout</span>
|
<li><span class="parameter">timeout</span>
|
||||||
<span class="types"><span class="type">float</span></span>
|
<span class="types"><span class="type">float</span></span>
|
||||||
time (in seconds) after which effect turns off (optional).
|
time (in seconds) after which effect turns off.
|
||||||
|
(<em>optional</em>)
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -522,7 +527,7 @@ most can just be ignored (see usage).
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a name = "Moveable:SetCustomEffect"></a>
|
<a name = "Moveable:SetCustomEffect"></a>
|
||||||
<strong>Moveable:SetCustomEffect(Color1, Color2, timeout)</strong>
|
<strong>Moveable:SetCustomEffect(Color1, Color2[, timeout])</strong>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
Set custom colored burn effect to moveable
|
Set custom colored burn effect to moveable
|
||||||
|
@ -541,7 +546,8 @@ most can just be ignored (see usage).
|
||||||
</li>
|
</li>
|
||||||
<li><span class="parameter">timeout</span>
|
<li><span class="parameter">timeout</span>
|
||||||
<span class="types"><span class="type">float</span></span>
|
<span class="types"><span class="type">float</span></span>
|
||||||
time (in seconds) after which effect turns off (optional).
|
time (in seconds) after which effect turns off.
|
||||||
|
(<em>optional</em>)
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -1098,7 +1104,7 @@ shiva:SetObjectID(TEN.Objects.ObjID.BIGMEDI_ITEM)</pre>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a name = "Moveable:GetJointPosition"></a>
|
<a name = "Moveable:GetJointPosition"></a>
|
||||||
<strong>Moveable:GetJointPosition(index)</strong>
|
<strong>Moveable:GetJointPosition(index[, offset])</strong>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
Get the object's joint position
|
Get the object's joint position
|
||||||
|
@ -1111,13 +1117,46 @@ shiva:SetObjectID(TEN.Objects.ObjID.BIGMEDI_ITEM)</pre>
|
||||||
<span class="types"><span class="type">int</span></span>
|
<span class="types"><span class="type">int</span></span>
|
||||||
of a joint to get position
|
of a joint to get position
|
||||||
</li>
|
</li>
|
||||||
|
<li><span class="parameter">offset</span>
|
||||||
|
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
|
||||||
|
a pre-rotation offset to the joint
|
||||||
|
(<em>optional</em>)
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3>Returns:</h3>
|
<h3>Returns:</h3>
|
||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
|
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
|
||||||
a copy of the moveable's position
|
a copy of the moveable's joint position
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<a name = "Moveable:GetJointRotation"></a>
|
||||||
|
<strong>Moveable:GetJointRotation(index)</strong>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Get the object's joint rotation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Parameters:</h3>
|
||||||
|
<ul>
|
||||||
|
<li><span class="parameter">index</span>
|
||||||
|
<span class="types"><span class="type">int</span></span>
|
||||||
|
of a joint to get rotation
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3>Returns:</h3>
|
||||||
|
<ol>
|
||||||
|
|
||||||
|
<span class="types"><a class="type" href="../3 primitive classes/Rotation.html#">Rotation</a></span>
|
||||||
|
a calculated copy of the moveable's joint rotation
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1361,7 +1400,10 @@ shiva:SetObjectID(TEN.Objects.ObjID.BIGMEDI_ITEM)</pre>
|
||||||
|
|
||||||
<h3>Usage:</h3>
|
<h3>Usage:</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<pre class="example">LevelFuncs.objCollided = <span class="keyword">function</span>(obj1, obj2)
|
<pre class="example"><span class="comment">-- obj1 is the collision moveable
|
||||||
|
</span><span class="comment">-- obj2 is the collider moveable
|
||||||
|
</span>
|
||||||
|
LevelFuncs.objCollided = <span class="keyword">function</span>(obj1, obj2)
|
||||||
<span class="global">print</span>(obj1:GetName() .. <span class="string">" collided with "</span> .. obj2:GetName())
|
<span class="global">print</span>(obj1:GetName() .. <span class="string">" collided with "</span> .. obj2:GetName())
|
||||||
<span class="keyword">end</span>
|
<span class="keyword">end</span>
|
||||||
baddy:SetOnCollidedWithObject(LevelFuncs.objCollided)</pre>
|
baddy:SetOnCollidedWithObject(LevelFuncs.objCollided)</pre>
|
||||||
|
|
|
@ -127,7 +127,7 @@ void DrawPhase(bool isTitle, float interpolationFactor)
|
||||||
g_Renderer.Lock();
|
g_Renderer.Lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
GameStatus ControlPhase()
|
GameStatus ControlPhase(bool insideMenu)
|
||||||
{
|
{
|
||||||
auto time1 = std::chrono::high_resolution_clock::now();
|
auto time1 = std::chrono::high_resolution_clock::now();
|
||||||
bool isTitle = (CurrentLevel == 0);
|
bool isTitle = (CurrentLevel == 0);
|
||||||
|
@ -226,6 +226,8 @@ GameStatus ControlPhase()
|
||||||
g_GameScript->OnLoop(DELTA_TIME, true);
|
g_GameScript->OnLoop(DELTA_TIME, true);
|
||||||
|
|
||||||
// Handle inventory, pause, load, save screens.
|
// Handle inventory, pause, load, save screens.
|
||||||
|
if (!insideMenu)
|
||||||
|
{
|
||||||
auto result = HandleMenuCalls(isTitle);
|
auto result = HandleMenuCalls(isTitle);
|
||||||
if (result != GameStatus::Normal)
|
if (result != GameStatus::Normal)
|
||||||
return result;
|
return result;
|
||||||
|
@ -234,6 +236,7 @@ GameStatus ControlPhase()
|
||||||
result = HandleGlobalInputEvents(isTitle);
|
result = HandleGlobalInputEvents(isTitle);
|
||||||
if (result != GameStatus::Normal)
|
if (result != GameStatus::Normal)
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// Clear savegame loaded flag.
|
// Clear savegame loaded flag.
|
||||||
JustLoaded = false;
|
JustLoaded = false;
|
||||||
|
@ -534,7 +537,7 @@ GameStatus DoGameLoop(int levelIndex)
|
||||||
|
|
||||||
// Before entering actual game loop, ControlPhase() must be
|
// Before entering actual game loop, ControlPhase() must be
|
||||||
// called once to sort out various runtime shenanigangs (e.g. hair).
|
// called once to sort out various runtime shenanigangs (e.g. hair).
|
||||||
status = ControlPhase();
|
status = ControlPhase(false);
|
||||||
|
|
||||||
g_Synchronizer.Init();
|
g_Synchronizer.Init();
|
||||||
bool legacy30FpsDoneDraw = false;
|
bool legacy30FpsDoneDraw = false;
|
||||||
|
@ -545,7 +548,7 @@ GameStatus DoGameLoop(int levelIndex)
|
||||||
|
|
||||||
while (g_Synchronizer.Synced())
|
while (g_Synchronizer.Synced())
|
||||||
{
|
{
|
||||||
status = ControlPhase();
|
status = ControlPhase(false);
|
||||||
g_Synchronizer.Step();
|
g_Synchronizer.Step();
|
||||||
|
|
||||||
legacy30FpsDoneDraw = false;
|
legacy30FpsDoneDraw = false;
|
||||||
|
|
|
@ -80,7 +80,7 @@ extern std::vector<short> OutsideRoomTable[OUTSIDE_SIZE][OUTSIDE_SIZE];
|
||||||
|
|
||||||
void DrawPhase(bool isTitle, float interpolationFactor);
|
void DrawPhase(bool isTitle, float interpolationFactor);
|
||||||
|
|
||||||
GameStatus ControlPhase();
|
GameStatus ControlPhase(bool insideMenu);
|
||||||
GameStatus DoLevel(int levelIndex, bool loadGame = false);
|
GameStatus DoLevel(int levelIndex, bool loadGame = false);
|
||||||
GameStatus DoGameLoop(int levelIndex);
|
GameStatus DoGameLoop(int levelIndex);
|
||||||
void EndGameLoop(int levelIndex, GameStatus reason);
|
void EndGameLoop(int levelIndex, GameStatus reason);
|
||||||
|
|
|
@ -627,6 +627,8 @@ namespace TEN::Gui
|
||||||
g_Renderer.ChangeScreenResolution(CurrentSettings.Configuration.ScreenWidth, CurrentSettings.Configuration.ScreenHeight,
|
g_Renderer.ChangeScreenResolution(CurrentSettings.Configuration.ScreenWidth, CurrentSettings.Configuration.ScreenHeight,
|
||||||
CurrentSettings.Configuration.EnableWindowedMode);
|
CurrentSettings.Configuration.EnableWindowedMode);
|
||||||
|
|
||||||
|
g_Renderer.SetGraphicsSettingsChanged();
|
||||||
|
|
||||||
MenuToDisplay = fromPauseMenu ? Menu::Pause : Menu::Options;
|
MenuToDisplay = fromPauseMenu ? Menu::Pause : Menu::Options;
|
||||||
SelectedOption = fromPauseMenu ? 1 : 0;
|
SelectedOption = fromPauseMenu ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
@ -684,12 +686,31 @@ namespace TEN::Gui
|
||||||
{
|
{
|
||||||
ClearAllActions();
|
ClearAllActions();
|
||||||
|
|
||||||
|
g_Synchronizer.Init();
|
||||||
|
|
||||||
|
bool legacy30FpsDoneDraw = false;
|
||||||
|
bool decreaseCounter = false;
|
||||||
|
|
||||||
while (CurrentSettings.NewKeyWaitTimer > 0.0f)
|
while (CurrentSettings.NewKeyWaitTimer > 0.0f)
|
||||||
|
{
|
||||||
|
g_Synchronizer.Sync();
|
||||||
|
|
||||||
|
while (g_Synchronizer.Synced())
|
||||||
{
|
{
|
||||||
CurrentSettings.NewKeyWaitTimer -= 1.0f;
|
CurrentSettings.NewKeyWaitTimer -= 1.0f;
|
||||||
if (CurrentSettings.NewKeyWaitTimer <= 0.0f)
|
if (CurrentSettings.NewKeyWaitTimer <= 0.0f)
|
||||||
CurrentSettings.NewKeyWaitTimer = 0.0f;
|
CurrentSettings.NewKeyWaitTimer = 0.0f;
|
||||||
|
|
||||||
|
if (!fromPauseMenu)
|
||||||
|
{
|
||||||
|
ControlPhase(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Just for updating blink time
|
||||||
|
g_Renderer.PrepareScene();
|
||||||
|
}
|
||||||
|
|
||||||
UpdateInputActions(item);
|
UpdateInputActions(item);
|
||||||
|
|
||||||
if (CurrentSettings.IgnoreInput)
|
if (CurrentSettings.IgnoreInput)
|
||||||
|
@ -739,22 +760,40 @@ namespace TEN::Gui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_Synchronizer.Step();
|
||||||
|
|
||||||
|
legacy30FpsDoneDraw = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!g_Configuration.EnableHighFramerate)
|
||||||
|
{
|
||||||
|
if (!legacy30FpsDoneDraw)
|
||||||
|
{
|
||||||
if (fromPauseMenu)
|
if (fromPauseMenu)
|
||||||
{
|
{
|
||||||
g_Renderer.RenderInventory();
|
g_Renderer.RenderInventory();
|
||||||
if (!g_Configuration.EnableHighFramerate)
|
|
||||||
{
|
|
||||||
g_Renderer.Synchronize();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_Renderer.RenderTitle(0);
|
g_Renderer.RenderTitle(0);
|
||||||
if (!g_Configuration.EnableHighFramerate)
|
|
||||||
{
|
|
||||||
g_Renderer.Synchronize();
|
|
||||||
}
|
}
|
||||||
ControlPhase();
|
g_Renderer.Lock();
|
||||||
|
legacy30FpsDoneDraw = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//g_Renderer.PrepareScene();
|
||||||
|
|
||||||
|
if (fromPauseMenu)
|
||||||
|
{
|
||||||
|
g_Renderer.RenderInventory();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_Renderer.RenderTitle(0);
|
||||||
|
}
|
||||||
|
g_Renderer.Lock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -419,4 +419,9 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
_context->RSSetScissorRects(1, rects);
|
_context->RSSetScissorRects(1, rects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Renderer::SetGraphicsSettingsChanged()
|
||||||
|
{
|
||||||
|
_graphicsSettingsChanged = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,6 +384,8 @@ namespace TEN::Renderer
|
||||||
// High framerate.
|
// High framerate.
|
||||||
float _interpolationFactor = 0.0f;
|
float _interpolationFactor = 0.0f;
|
||||||
|
|
||||||
|
bool _graphicsSettingsChanged = false;
|
||||||
|
|
||||||
// Private functions
|
// Private functions
|
||||||
void ApplySMAA(RenderTarget2D* renderTarget, RenderView& view);
|
void ApplySMAA(RenderTarget2D* renderTarget, RenderView& view);
|
||||||
void ApplyFXAA(RenderTarget2D* renderTarget, RenderView& view);
|
void ApplyFXAA(RenderTarget2D* renderTarget, RenderView& view);
|
||||||
|
@ -667,6 +669,8 @@ namespace TEN::Renderer
|
||||||
void SetPostProcessStrength(float strength);
|
void SetPostProcessStrength(float strength);
|
||||||
Vector3 GetPostProcessTint();
|
Vector3 GetPostProcessTint();
|
||||||
void SetPostProcessTint(Vector3 color);
|
void SetPostProcessTint(Vector3 color);
|
||||||
|
|
||||||
|
void SetGraphicsSettingsChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Renderer g_Renderer;
|
extern Renderer g_Renderer;
|
||||||
|
|
|
@ -2156,6 +2156,8 @@ namespace TEN::Renderer
|
||||||
void Renderer::DumpGameScene()
|
void Renderer::DumpGameScene()
|
||||||
{
|
{
|
||||||
RenderScene(&_dumpScreenRenderTarget, false, _gameCamera);
|
RenderScene(&_dumpScreenRenderTarget, false, _gameCamera);
|
||||||
|
|
||||||
|
_graphicsSettingsChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::DrawItems(RenderView& view, RendererPass rendererPass)
|
void Renderer::DrawItems(RenderView& view, RendererPass rendererPass)
|
||||||
|
|
|
@ -1138,9 +1138,24 @@ namespace TEN::Renderer
|
||||||
|
|
||||||
void Renderer::RenderInventory()
|
void Renderer::RenderInventory()
|
||||||
{
|
{
|
||||||
|
if (_graphicsSettingsChanged)
|
||||||
|
{
|
||||||
|
_currentGameCamera = RenderView(&Camera, Camera.Roll, Camera.Fov, 32, BLOCK(g_GameFlow->GetLevel(CurrentLevel)->GetFarView()), g_Configuration.ScreenWidth, g_Configuration.ScreenHeight);
|
||||||
|
_gameCamera = RenderView(&Camera, Camera.Roll, Camera.Fov, 32, BLOCK(g_GameFlow->GetLevel(CurrentLevel)->GetFarView()), g_Configuration.ScreenWidth, g_Configuration.ScreenHeight);
|
||||||
|
|
||||||
|
Camera.DisableInterpolation = true;
|
||||||
|
|
||||||
|
DumpGameScene();
|
||||||
|
}
|
||||||
|
|
||||||
_context->ClearDepthStencilView(_backBuffer.DepthStencilView.Get(), D3D11_CLEAR_STENCIL | D3D11_CLEAR_DEPTH, 1.0f, 0);
|
_context->ClearDepthStencilView(_backBuffer.DepthStencilView.Get(), D3D11_CLEAR_STENCIL | D3D11_CLEAR_DEPTH, 1.0f, 0);
|
||||||
_context->ClearRenderTargetView(_backBuffer.RenderTargetView.Get(), Colors::Black);
|
_context->ClearRenderTargetView(_backBuffer.RenderTargetView.Get(), Colors::Black);
|
||||||
|
|
||||||
|
// Reset GPU state.
|
||||||
|
SetBlendMode(BlendMode::Opaque, true);
|
||||||
|
SetDepthState(DepthState::Write, true);
|
||||||
|
SetCullMode(CullMode::CounterClockwise, true);
|
||||||
|
|
||||||
RenderInventoryScene(&_backBuffer, &_dumpScreenRenderTarget, 0.5f);
|
RenderInventoryScene(&_backBuffer, &_dumpScreenRenderTarget, 0.5f);
|
||||||
|
|
||||||
_swapChain->Present(1, 0);
|
_swapChain->Present(1, 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue