mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-08 03:28:03 +03:00
Reduced Vertex Count for Bars from 9 to 5
Added define for PI for shaders Added Primes to Vertex Hash generation Fixed Debris
This commit is contained in:
parent
e013ed4e24
commit
915b438f5a
17 changed files with 100 additions and 77 deletions
|
@ -1,7 +1,10 @@
|
|||
#include "./../VertexInput.hlsli"
|
||||
#include "./../Math.hlsli"
|
||||
cbuffer HUDBarBuffer : register(b0)
|
||||
{
|
||||
float Percent;
|
||||
int Poisoned;
|
||||
int Frame;
|
||||
};
|
||||
|
||||
struct PixelShaderInput
|
||||
|
@ -29,7 +32,12 @@ half4 PSColored(PixelShaderInput input) : SV_TARGET
|
|||
if (input.UV.x > Percent) {
|
||||
discard;
|
||||
}
|
||||
return glassOverlay(input.UV,input.Color);
|
||||
half4 col = input.Color;
|
||||
if (Poisoned) {
|
||||
float factor = sin(((Frame % 30) / 30.0) * PI2)*0.5 + 0.5;
|
||||
col = lerp(col,half4(214 / 512.0, 241 / 512.0, 18 / 512.0, 1),factor);
|
||||
}
|
||||
return glassOverlay(input.UV,col);
|
||||
}
|
||||
|
||||
half4 PSTextured(PixelShaderInput input) : SV_TARGET
|
||||
|
|
|
@ -30,17 +30,20 @@ void ShatterObject(SHATTER_ITEM* item, MESH_INFO* mesh, int num,short roomNumber
|
|||
RendererMesh* fragmentsMesh;
|
||||
short yRot = 0;
|
||||
Vector3 pos;
|
||||
bool isStatic;
|
||||
if (mesh) {
|
||||
isStatic = false;
|
||||
meshPtr = &g_Level.Meshes[StaticObjects[mesh->staticNumber].meshNumber];
|
||||
yRot = mesh->yRot;
|
||||
pos = Vector3(mesh->x, mesh->y, mesh->z);
|
||||
}
|
||||
else {
|
||||
isStatic = true;
|
||||
meshPtr = item->meshp;
|
||||
yRot = item->yRot;
|
||||
pos = Vector3(item->sphere.x, item->sphere.y, item->sphere.z);
|
||||
}
|
||||
fragmentsMesh = g_Renderer.getMesh(0);
|
||||
fragmentsMesh = g_Renderer.getRendererMeshFromTrMesh(nullptr, meshPtr, num, 0, 0);
|
||||
for (auto& renderBucket : fragmentsMesh->buckets) {
|
||||
vector<RendererVertex>* meshVertices = &renderBucket.Vertices;
|
||||
for (int i = 0; i < renderBucket.Indices.size(); i += 3)
|
||||
|
@ -65,6 +68,8 @@ void ShatterObject(SHATTER_ITEM* item, MESH_INFO* mesh, int num,short roomNumber
|
|||
fragment->mesh.vertices[1] = vtx1;
|
||||
fragment->mesh.vertices[2] = vtx2;
|
||||
fragment->mesh.blendMode = renderBucket.blendMode;
|
||||
fragment->mesh.tex = renderBucket.texture;
|
||||
fragment->isStatic = isStatic;
|
||||
fragment->active = true;
|
||||
fragment->terminalVelocity = 1024;
|
||||
fragment->gravity = Vector3(0, 7, 0);
|
||||
|
@ -81,6 +86,7 @@ void ShatterObject(SHATTER_ITEM* item, MESH_INFO* mesh, int num,short roomNumber
|
|||
}
|
||||
}
|
||||
}
|
||||
delete fragmentsMesh;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ struct DebrisMesh
|
|||
{
|
||||
BLEND_MODES blendMode;
|
||||
std::array<T5M::Renderer::RendererVertex, 3> vertices;
|
||||
int tex;
|
||||
};
|
||||
|
||||
struct DebrisFragment
|
||||
|
@ -61,6 +62,7 @@ struct DebrisFragment
|
|||
uint32_t roomNumber;
|
||||
uint32_t numBounces;
|
||||
bool active;
|
||||
bool isStatic;
|
||||
};
|
||||
|
||||
struct DEBRIS_STRUCT
|
||||
|
|
|
@ -36,7 +36,7 @@ void DrawHealthBarOverlay(int value)
|
|||
color2 = 0xA0A000;
|
||||
else
|
||||
color2 = 0xA00000;
|
||||
g_Renderer.drawBar(value, ::g_HealthBar);
|
||||
g_Renderer.drawBar(value, ::g_HealthBar, GlobalCounter,Lara.poisoned || Lara.gassed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ void DrawHealthBar(float value)
|
|||
{
|
||||
if (CurrentLevel)
|
||||
{
|
||||
g_Renderer.drawBar(value, ::g_HealthBar);
|
||||
g_Renderer.drawBar(value, ::g_HealthBar,GlobalCounter,Lara.poisoned || Lara.gassed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ void UpdateHealthBar(int flash)
|
|||
HealthBarTimer = 0;
|
||||
|
||||
// Flash when at 1/4 capacity AND HP bar is not transitioning.
|
||||
if (HealthBar <= 1000 / 4 && MutateAmount == 0)
|
||||
if (HealthBar <= 1000 / 4)
|
||||
{
|
||||
if (!BinocularRange)
|
||||
{
|
||||
|
@ -137,7 +137,7 @@ void DrawAirBar(float value)
|
|||
{
|
||||
if (CurrentLevel)
|
||||
{
|
||||
g_Renderer.drawBar(value, ::g_AirBar);
|
||||
g_Renderer.drawBar(value, ::g_AirBar,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ void DrawDashBar(int value)
|
|||
{
|
||||
if (CurrentLevel)
|
||||
{
|
||||
g_Renderer.drawBar(value, ::g_DashBar);
|
||||
g_Renderer.drawBar(value, ::g_DashBar,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,4 +3,7 @@
|
|||
struct alignas(16) CHUDBarBuffer
|
||||
{
|
||||
float Percent;
|
||||
int Poisoned;
|
||||
int Frame;
|
||||
|
||||
};
|
||||
|
|
|
@ -88,16 +88,12 @@ namespace T5M::Renderer {
|
|||
}
|
||||
}
|
||||
|
||||
RendererHUDBar::RendererHUDBar(ID3D11Device* m_device, int x, int y, int w, int h, int borderSize, array<Vector4, 9> colors) {
|
||||
RendererHUDBar::RendererHUDBar(ID3D11Device* m_device, int x, int y, int w, int h, int borderSize, array<Vector4, 5> colors) {
|
||||
array<Vector3, 9> barVertices = {
|
||||
Vector3(x, HUD_ZERO_Y + y, 0.5),
|
||||
Vector3(x + (w / 2.0f), HUD_ZERO_Y + y, 0.5),
|
||||
Vector3(x + w, HUD_ZERO_Y + y, 0.5),
|
||||
Vector3(x, HUD_ZERO_Y + (y + h / 2.0f), 0.5),
|
||||
Vector3(x + (w / 2.0f), HUD_ZERO_Y + (y + h / 2.0f), 0.5),
|
||||
Vector3(x + w, HUD_ZERO_Y + (y + h / 2.0f), 0.5),
|
||||
Vector3(x, HUD_ZERO_Y + y + h, 0.5),
|
||||
Vector3(x + (w / 2.0f), HUD_ZERO_Y + y + h, 0.5),
|
||||
Vector3(x + w, HUD_ZERO_Y + y + h, 0.5),
|
||||
|
||||
};
|
||||
|
@ -126,15 +122,11 @@ namespace T5M::Renderer {
|
|||
Vector3(x - HUD_BORDER_WIDTH ,HUD_ZERO_Y + y + h + HUD_BORDER_HEIGT,0)
|
||||
};
|
||||
|
||||
array<Vector2, 9> barUVs = {
|
||||
array<Vector2, 5> barUVs = {
|
||||
Vector2(0,0),
|
||||
Vector2(0.5,0),
|
||||
Vector2(1,0),
|
||||
Vector2(0,0.5),
|
||||
Vector2(0.5,0.5),
|
||||
Vector2(1,0.5),
|
||||
Vector2(0,1),
|
||||
Vector2(0.5,1),
|
||||
Vector2(1,1),
|
||||
};
|
||||
array<Vector2, 16> barBorderUVs = {
|
||||
|
@ -160,14 +152,11 @@ namespace T5M::Renderer {
|
|||
Vector2(0,1),
|
||||
};
|
||||
|
||||
array<int, 24> barIndices = {
|
||||
0,1,3,1,4,3,
|
||||
//
|
||||
1,2,4,2,5,4,
|
||||
//
|
||||
3,4,6,4,7,6,
|
||||
//
|
||||
4,5,7,5,8,7
|
||||
array<int, 12> barIndices = {
|
||||
2,1,0,
|
||||
2,0,3,
|
||||
2,3,4,
|
||||
2,4,1
|
||||
};
|
||||
array<int, 56> barBorderIndices = {
|
||||
//top left
|
||||
|
@ -189,8 +178,8 @@ namespace T5M::Renderer {
|
|||
//center
|
||||
2,7,13,7,8,13
|
||||
};
|
||||
array<RendererVertex, 9> vertices;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
array<RendererVertex, 5> vertices;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
|
||||
vertices[i].Position = barVertices[i];
|
||||
vertices[i].Color = colors[i];
|
||||
|
|
|
@ -68,14 +68,14 @@ namespace T5M::Renderer
|
|||
IndexBuffer indexBuffer;
|
||||
/*
|
||||
Initialises a new Bar for rendering. the Coordinates are set in the Reference Resolution (default 800x600).
|
||||
The colors are setup like this
|
||||
0-----------1-----------2
|
||||
| | |
|
||||
3-----------4-----------5
|
||||
| | |
|
||||
6-----------7-----------8
|
||||
The colors are setup like this (4 triangles)
|
||||
0-------1
|
||||
| \ / |
|
||||
| >2< |
|
||||
| / \ |
|
||||
3-------4
|
||||
*/
|
||||
RendererHUDBar(ID3D11Device* m_device, int x, int y, int w, int h, int borderSize, std::array<DirectX::SimpleMath::Vector4, 9> colors);
|
||||
RendererHUDBar(ID3D11Device* m_device, int x, int y, int w, int h, int borderSize, std::array<DirectX::SimpleMath::Vector4, 5> colors);
|
||||
};
|
||||
|
||||
struct RendererStringToDraw
|
||||
|
@ -466,7 +466,6 @@ namespace T5M::Renderer
|
|||
// Private functions
|
||||
int getAnimatedTextureInfo(short textureId);
|
||||
void drawAllStrings();
|
||||
RendererMesh* getRendererMeshFromTrMesh(RendererObject* obj, MESH* meshPtr, short boneIndex, int isJoints, int isHairs);
|
||||
void fromTrAngle(DirectX::SimpleMath::Matrix* matrix, short* frameptr, int index);
|
||||
void buildHierarchy(RendererObject* obj);
|
||||
void buildHierarchyRecursive(RendererObject* obj, RendererBone* node, RendererBone* parentNode);
|
||||
|
@ -550,6 +549,8 @@ namespace T5M::Renderer
|
|||
void drawSimpleParticles(RenderView& view);
|
||||
void setBlendMode(BLEND_MODES blendMode);
|
||||
public:
|
||||
RendererMesh* getRendererMeshFromTrMesh(RendererObject* obj, MESH* meshPtr, short boneIndex, int isJoints, int isHairs);
|
||||
|
||||
DirectX::SimpleMath::Matrix View;
|
||||
DirectX::SimpleMath::Matrix Projection;
|
||||
DirectX::SimpleMath::Matrix ViewProjection;
|
||||
|
@ -592,7 +593,6 @@ namespace T5M::Renderer
|
|||
void addLine2D(int x1, int y1, int x2, int y2, byte r, byte g, byte b, byte a);
|
||||
void addLine3D(DirectX::SimpleMath::Vector3 start, DirectX::SimpleMath::Vector3 end, DirectX::SimpleMath::Vector4 color);
|
||||
void changeScreenResolution(int width, int height, int frequency, bool windowed);
|
||||
void drawBar(float percent, const RendererHUDBar* const bar);
|
||||
void flipRooms(short roomNumber1, short roomNumber2);
|
||||
void resetAnimations();
|
||||
void updateLaraAnimations(bool force);
|
||||
|
@ -602,6 +602,7 @@ namespace T5M::Renderer
|
|||
int getSpheres(short itemNumber, BoundingSphere* ptr, char worldSpace, DirectX::SimpleMath::Matrix local);
|
||||
void getBoneMatrix(short itemNumber, int joint, DirectX::SimpleMath::Matrix* outMatrix);
|
||||
void drawObjectOn2DPosition(short x, short y, short objectNum, short rotX, short rotY, short rotZ, float scale1);
|
||||
void drawBar(float percent, const RendererHUDBar * const bar, int frame, bool poison);
|
||||
|
||||
RendererMesh* getMesh(int meshIndex);
|
||||
private:
|
||||
|
|
|
@ -252,7 +252,9 @@ namespace T5M::Renderer
|
|||
vertex->IndexInPoly = k;
|
||||
vertex->OriginalIndex = v;
|
||||
vertex->Effects = room->effects[v];
|
||||
vertex->hash = std::hash<float>{}(vertex->Position.x) ^ std::hash<float>{}(vertex->Position.y) ^ std::hash<float>{}(vertex->Position.z);
|
||||
unsigned long long primes[]{ 73856093ULL ,19349663ULL ,83492791ULL };
|
||||
|
||||
vertex->hash = std::hash<float>{}((vertex->Position.x)* primes[0]) ^ (std::hash<float>{}(vertex->Position.y)* primes[1]) ^ std::hash<float>{}(vertex->Position.z) * primes[2];
|
||||
vertex->Bone = 0;
|
||||
|
||||
lastVertex++;
|
||||
|
|
|
@ -740,7 +740,7 @@ namespace T5M::Renderer
|
|||
drawString(200, y, g_GameFlow->GetString(STRING_MUSIC_VOLUME),
|
||||
PRINTSTRING_COLOR_ORANGE,
|
||||
PRINTSTRING_OUTLINE | ((title_selected_option & (1 << 2)) ? PRINTSTRING_BLINK : 0));
|
||||
drawBar(CurrentSettings.conf.MusicVolume / 100.0f, g_MusicVolumeBar);
|
||||
drawBar(CurrentSettings.conf.MusicVolume / 100.0f, g_MusicVolumeBar,0,false);
|
||||
|
||||
y += 25;
|
||||
|
||||
|
@ -748,7 +748,7 @@ namespace T5M::Renderer
|
|||
drawString(200, y, g_GameFlow->GetString(STRING_SFX_VOLUME),
|
||||
PRINTSTRING_COLOR_ORANGE,
|
||||
PRINTSTRING_OUTLINE | ((title_selected_option & (1 << 3)) ? PRINTSTRING_BLINK : 0));
|
||||
drawBar(CurrentSettings.conf.SfxVolume / 100.0f, g_SFXVolumeBar);
|
||||
drawBar(CurrentSettings.conf.SfxVolume / 100.0f, g_SFXVolumeBar,0,false);
|
||||
y += 25;
|
||||
|
||||
// Apply and cancel
|
||||
|
@ -976,7 +976,7 @@ namespace T5M::Renderer
|
|||
drawString(200, y, g_GameFlow->GetString(STRING_MUSIC_VOLUME),
|
||||
PRINTSTRING_COLOR_ORANGE,
|
||||
PRINTSTRING_OUTLINE | ((pause_selected_option & (1 << 2)) ? PRINTSTRING_BLINK : 0));
|
||||
drawBar(CurrentSettings.conf.MusicVolume / 100.0f, g_MusicVolumeBar);
|
||||
drawBar(CurrentSettings.conf.MusicVolume / 100.0f, g_MusicVolumeBar,0,0);
|
||||
|
||||
y += 25;
|
||||
|
||||
|
@ -984,7 +984,7 @@ namespace T5M::Renderer
|
|||
drawString(200, y, g_GameFlow->GetString(STRING_SFX_VOLUME),
|
||||
PRINTSTRING_COLOR_ORANGE,
|
||||
PRINTSTRING_OUTLINE | ((pause_selected_option & (1 << 3)) ? PRINTSTRING_BLINK : 0));
|
||||
drawBar(CurrentSettings.conf.SfxVolume / 100.0f, g_SFXVolumeBar);
|
||||
drawBar(CurrentSettings.conf.SfxVolume / 100.0f, g_SFXVolumeBar,0,0);
|
||||
y += 25;
|
||||
|
||||
// Apply and cancel
|
||||
|
@ -2650,7 +2650,7 @@ namespace T5M::Renderer
|
|||
// Bars
|
||||
int flash = FlashIt();
|
||||
if (DashTimer < 120)
|
||||
drawBar(DashTimer / 120.0f, g_DashBar);
|
||||
drawBar(DashTimer / 120.0f, g_DashBar,0,0);
|
||||
UpdateHealthBar(flash);
|
||||
UpdateAirBar(flash);
|
||||
DrawAllPickups();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "Renderer11.h"
|
||||
#include "camera.h"
|
||||
#include "spotcam.h"
|
||||
#include "lara.h"
|
||||
T5M::Renderer::RendererHUDBar* g_HealthBar;
|
||||
T5M::Renderer::RendererHUDBar* g_AirBar;
|
||||
T5M::Renderer::RendererHUDBar* g_DashBar;
|
||||
|
@ -11,63 +12,47 @@ namespace T5M::Renderer {
|
|||
|
||||
void Renderer11::initialiseBars()
|
||||
{
|
||||
std::array<Vector4, 9> healthColors = {
|
||||
std::array<Vector4, 5> healthColors = {
|
||||
//top
|
||||
Vector4(82 / 255.0f,0,0,1),
|
||||
Vector4(36 / 255.0f,46 / 255.0f,0,1),
|
||||
Vector4(0,82 / 255.0f,0,1),
|
||||
//center
|
||||
Vector4(159 / 255.0f,0,0,1),
|
||||
Vector4(78 / 255.0f,81 / 255.0f,0,1),
|
||||
Vector4(0,158 / 255.0f,0,1),
|
||||
//bottom
|
||||
Vector4(82 / 255.0f,0,0,1),
|
||||
Vector4(36 / 255.0f,46 / 255.0f,0,1),
|
||||
Vector4(0,82 / 255.0f,0,1),
|
||||
};
|
||||
|
||||
std::array<Vector4, 9> airColors = {
|
||||
std::array<Vector4, 5> airColors = {
|
||||
//top
|
||||
Vector4(0 ,0,90 / 255.0f,1),
|
||||
Vector4(0 / 255.0f,28 / 255.0f,84 / 255.0f,1),
|
||||
Vector4(0 ,47 / 255.0f,96 / 255.0f,1),
|
||||
//center
|
||||
Vector4(0,3 / 255,153 / 255.0f,1),
|
||||
Vector4(0,39 / 255,155 / 255.0f,1),
|
||||
Vector4(0,78 / 255.0f,159 / 255.0f,1),
|
||||
//bottom
|
||||
Vector4(0 ,0,90 / 255.0f,1),
|
||||
Vector4(0 / 255.0f,28 / 255.0f,84 / 255.0f,1),
|
||||
Vector4(0 ,47 / 255.0f,96 / 255.0f,1),
|
||||
};
|
||||
|
||||
std::array<Vector4, 9> dashColors = {
|
||||
std::array<Vector4, 5> dashColors = {
|
||||
//top
|
||||
Vector4(78 / 255.0f,4 / 255.0f,0,1),
|
||||
Vector4(161 / 255.0f,25 / 255.0f,84 / 255.0f,1),
|
||||
Vector4(136 / 255.0f,117 / 255.0f,5 / 255.0f,1),
|
||||
//center
|
||||
Vector4(211 / 255.0f,29 / 255.0f,23 / 255.0f,1),
|
||||
Vector4(245 / 255.0f,119 / 255,24 / 255.0f,1),
|
||||
Vector4(207 / 255.0f,183 / 255.0f,27 / 255.0f,1),
|
||||
//bottom
|
||||
Vector4(78 / 255.0f,4 / 255.0f,0,1),
|
||||
Vector4(161 / 255.0f,25 / 255.0f,84 / 255.0f,1),
|
||||
Vector4(136 / 255.0f,117 / 255.0f,5 / 255.0f,1),
|
||||
};
|
||||
std::array<Vector4, 9> soundSettingColors = {
|
||||
std::array<Vector4, 5> soundSettingColors = {
|
||||
//top
|
||||
Vector4(0.18f,0.3f,0.72f,1),
|
||||
Vector4(0.18f,0.3f,0.72f,1),
|
||||
Vector4(0.18f,0.3f,0.72f,1),
|
||||
//center
|
||||
Vector4(0.18f,0.3f,0.72f,1),
|
||||
Vector4(0.18f,0.3f,0.72f,1),
|
||||
Vector4(0.18f,0.3f,0.72f,1),
|
||||
//bottom
|
||||
Vector4(0.18f,0.3f,0.72f,1),
|
||||
Vector4(0.18f,0.3f,0.72f,1),
|
||||
Vector4(0.18f,0.3f,0.72f,1),
|
||||
};
|
||||
g_HealthBar = new RendererHUDBar(m_device.Get(), 20, 32, 150, 8, 1, healthColors);
|
||||
g_AirBar = new RendererHUDBar(m_device.Get(), 630, 32, 150, 8, 1, airColors);
|
||||
|
@ -75,7 +60,7 @@ namespace T5M::Renderer {
|
|||
g_MusicVolumeBar = new RendererHUDBar(m_device.Get(), 400, 212, 150, 8, 1, soundSettingColors);
|
||||
g_SFXVolumeBar = new RendererHUDBar(m_device.Get(), 400, 230, 150, 8, 1, soundSettingColors);
|
||||
}
|
||||
void Renderer11::drawBar(float percent, const RendererHUDBar* const bar) {
|
||||
void Renderer11::drawBar(float percent, const RendererHUDBar* const bar,int frame, bool poison) {
|
||||
UINT strides = sizeof(RendererVertex);
|
||||
UINT offset = 0;
|
||||
float color[] = { 0,0,0,1.0f };
|
||||
|
@ -102,6 +87,8 @@ namespace T5M::Renderer {
|
|||
m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||
m_context->IASetIndexBuffer(bar->indexBuffer.Buffer.Get(), DXGI_FORMAT_R32_UINT, 0);
|
||||
m_stHUDBar.Percent = percent;
|
||||
m_stHUDBar.Poisoned = poison;
|
||||
m_stHUDBar.Frame = frame;
|
||||
m_cbHUDBar.updateData(m_stHUDBar, m_context.Get());
|
||||
m_context->VSSetConstantBuffers(0, 1, m_cbHUD.get());
|
||||
m_context->PSSetConstantBuffers(0, 1, m_cbHUDBar.get());
|
||||
|
@ -110,7 +97,7 @@ namespace T5M::Renderer {
|
|||
m_context->OMSetBlendState(m_states->Opaque(), NULL, 0xFFFFFFFF);
|
||||
m_context->OMSetDepthStencilState(m_states->DepthNone(), NULL);
|
||||
m_context->RSSetState(m_states->CullNone());
|
||||
m_context->DrawIndexed(24, 0, 0);
|
||||
m_context->DrawIndexed(12, 0, 0);
|
||||
}
|
||||
|
||||
void Renderer11::addLine2D(int x1, int y1, int x2, int y2, byte r, byte g, byte b, byte a) {
|
||||
|
|
|
@ -950,8 +950,14 @@ namespace T5M::Renderer {
|
|||
m_primitiveBatch->Begin();
|
||||
m_context->VSSetShader(m_vsStatics.Get(), NULL, 0);
|
||||
m_context->PSSetShader(m_psStatics.Get(), NULL, 0);
|
||||
m_context->PSSetShaderResources(0, 1, (std::get<0>(m_staticsTextures[0])).ShaderResourceView.GetAddressOf());
|
||||
ID3D11SamplerState* sampler = m_states->AnisotropicClamp();
|
||||
if (!deb->isStatic) {
|
||||
m_context->PSSetShaderResources(0, 1, (std::get<0>(m_staticsTextures[deb->mesh.tex])).ShaderResourceView.GetAddressOf());
|
||||
|
||||
} else {
|
||||
m_context->PSSetShaderResources(0, 1, (std::get<0>(m_moveablesTextures[deb->mesh.tex])).ShaderResourceView.GetAddressOf());
|
||||
|
||||
}
|
||||
ID3D11SamplerState* sampler = m_states->LinearClamp();
|
||||
m_context->PSSetSamplers(0, 1, &sampler);
|
||||
//m_stCameraMatrices.View = View.Transpose();
|
||||
//m_stCameraMatrices.Projection = Projection.Transpose();
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include "./Math.hlsli"
|
||||
#define LT_SUN 0
|
||||
#define LT_POINT 1
|
||||
#define LT_SPOT 2
|
||||
|
@ -81,8 +82,7 @@ PixelShaderInput VS(VertexShaderInput input)
|
|||
// Wibble effect returns different value depending on vertex hash and frame number.
|
||||
// In theory, hash could be affected by WaterScheme value from room.
|
||||
|
||||
static const float PI = 3.14159265f;
|
||||
float wibble = sin((((Frame + input.Hash) % 64) / 64.0) * (PI*2)); // sin from -1 to 1 with a period of 64 frames
|
||||
float wibble = sin((((Frame + input.Hash) % 256) / 256.0) * (PI2)); // sin from -1 to 1 with a period of 64 frames
|
||||
|
||||
// Glow
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "CameraMatrixBuffer.hlsli"
|
||||
#include "./VertexInput.hlsli"
|
||||
#include "./Math.hlsli"
|
||||
struct RendererLight {
|
||||
float4 Position;
|
||||
float4 Color;
|
||||
|
@ -91,8 +92,7 @@ PixelShaderInput VS(VertexShaderInput input)
|
|||
// Wibble effect returns different value depending on vertex hash and frame number.
|
||||
// In theory, hash could be affected by WaterScheme value from room.
|
||||
|
||||
static const float PI = 3.14159265f;
|
||||
float wibble = sin((((Frame + input.Hash) % 64) / 64.0) * (PI*2)); // sin from -1 to 1 with a period of 64 frames
|
||||
float wibble = sin((((Frame + input.Hash) % 64) / 64.0) * (PI2)); // sin from -1 to 1 with a period of 64 frames
|
||||
|
||||
// Glow
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
#include "./../VertexInput.hlsli"
|
||||
#include "./../Math.hlsli"
|
||||
cbuffer HUDBarBuffer : register(b0)
|
||||
{
|
||||
float Percent;
|
||||
int Poisoned;
|
||||
int Frame;
|
||||
};
|
||||
|
||||
struct PixelShaderInput
|
||||
|
@ -29,7 +32,12 @@ half4 PSColored(PixelShaderInput input) : SV_TARGET
|
|||
if (input.UV.x > Percent) {
|
||||
discard;
|
||||
}
|
||||
return glassOverlay(input.UV,input.Color);
|
||||
half4 col = input.Color;
|
||||
if (Poisoned) {
|
||||
float factor = sin(((Frame % 30) / 30.0) * PI2)*0.5 + 0.5;
|
||||
col = lerp(col,half4(214 / 512.0, 241 / 512.0, 18 / 512.0, 1),factor);
|
||||
}
|
||||
return glassOverlay(input.UV,col);
|
||||
}
|
||||
|
||||
half4 PSTextured(PixelShaderInput input) : SV_TARGET
|
||||
|
|
3
TR5Main/Shaders/Math.hlsli
Normal file
3
TR5Main/Shaders/Math.hlsli
Normal file
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
#define PI 3.1415926535897932384626433832795028841971693993751058209749445923
|
||||
#define PI2 6.2831853071795864769252867665590057683943387987502116419498891846
|
|
@ -785,6 +785,7 @@ xcopy /Y "$(ProjectDir)Shaders\HUD\*.hlsl" "$(TargetDir)\Shaders\HUD\"</Command>
|
|||
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
|
||||
<FileType>Text</FileType>
|
||||
</None>
|
||||
<None Include="Shaders\Math.hlsli" />
|
||||
<None Include="Shaders\VertexInput.hlsli" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -829,7 +830,7 @@ xcopy /Y "$(ProjectDir)Shaders\HUD\*.hlsl" "$(TargetDir)\Shaders\HUD\"</Command>
|
|||
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
|
||||
<FileType>Document</FileType>
|
||||
</None>
|
||||
<None Include="Shaders\HUD\DX11_PS_HUDBar.hlsl">
|
||||
<FxCompile Include="Shaders\HUD\DX11_PS_HUDBar.hlsl">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
|
||||
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
|
||||
|
@ -837,9 +838,13 @@ xcopy /Y "$(ProjectDir)Shaders\HUD\*.hlsl" "$(TargetDir)\Shaders\HUD\"</Command>
|
|||
<FileType>Document</FileType>
|
||||
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">PSColored</EntryPointName>
|
||||
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">PSColored</EntryPointName>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">2.0</ShaderModel>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">2.0</ShaderModel>
|
||||
</None>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<AllResourcesBound Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</AllResourcesBound>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<AllResourcesBound Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</AllResourcesBound>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Shaders\HUD\DX11_VS_HUD.hlsl">
|
||||
|
|
|
@ -1917,7 +1917,6 @@
|
|||
<None Include="Shaders\DX11_Test.fx" />
|
||||
<None Include="RuleSet.ruleset" />
|
||||
<None Include="Shaders\HUD\DX11_PS_HUD.hlsl" />
|
||||
<None Include="Shaders\HUD\DX11_PS_HUDBar.hlsl" />
|
||||
<None Include="Shaders\CameraMatrixBuffer.hlsli" />
|
||||
<None Include="Shaders\HUD\DX11_VS_HUD.hlsl" />
|
||||
<None Include="Shaders\Fxaa3_11.fxh" />
|
||||
|
@ -1952,6 +1951,7 @@
|
|||
<None Include="Shaders\Transparent.fx" />
|
||||
<None Include="Resources.aps" />
|
||||
<None Include="Shaders\VertexInput.hlsli" />
|
||||
<None Include="Shaders\Math.hlsli" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Resources.rc">
|
||||
|
@ -1963,4 +1963,7 @@
|
|||
<Filter>File di risorse</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="Shaders\HUD\DX11_PS_HUDBar.hlsl" />
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Add table
Add a link
Reference in a new issue