Commit 28adde87 authored by AL's avatar AL

added ceiling hangers

parent b18792e8
#include "CeilingHangers.h"
#include "RandomUnit.h"
CeilingHangers::CeilingHangers(DXGraphics& gfx, Vec2 lowCorner, Vec2 highCorner, size_t numHangers) :
model(L"Media//Models//CeilingHanger0.obj",gfx,0.25f)
{
for (size_t i = 0; i < numHangers; i++)
{
posData.emplace_back(RU.GetFloat(lowCorner.x, highCorner.x), 1.81f, RU.GetFloat(lowCorner.y, highCorner.y), 0.0f, 3 * PI / 2, PI / 2);
}
model.BindPositionData(&posData);
}
void CeilingHangers::Submit(FrameCommander& fc)
{
model.SmartSubmit(fc, Techniques::CamFacing);
}
#pragma once
#include "Framework\PlaneTexNorm.h"
#include "Framework\Vec2.h"
class CeilingHangers
{
public:
CeilingHangers(DXGraphics& gfx, Vec2 lowCorner, Vec2 highCorner, size_t numHangers); //corners define a rectangle in which the hangers will be placed
void Submit(FrameCommander& fc);
private:
std::vector<PositionData> posData;
PlaneTexNorm model;
};
......@@ -185,6 +185,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="CameraManager.h" />
<ClInclude Include="CeilingHangers.h" />
<ClInclude Include="DepthStencil.h" />
<ClInclude Include="GraphicsResource.h" />
<ClInclude Include="HPBar.h" />
......@@ -367,6 +368,7 @@
<ClCompile Include="ActionBox.cpp" />
<ClCompile Include="BlurManager.cpp" />
<ClCompile Include="CameraManager.cpp" />
<ClCompile Include="CeilingHangers.cpp" />
<ClCompile Include="DepthStencil.cpp" />
<ClCompile Include="EffectHandler.cpp" />
<ClCompile Include="Framework\FrameCommander.cpp" />
......
......@@ -606,6 +606,9 @@
<ClInclude Include="HudOverlay.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CeilingHangers.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Game.cpp">
......@@ -932,6 +935,9 @@
<ClCompile Include="HudOverlay.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CeilingHangers.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<FxCompile Include="PhongVSNormalMap.hlsl">
......
......@@ -99,7 +99,12 @@ void LevelLayout::Enemy::Submit(FrameCommander& fc)
if (!idlePosData.empty()) planes[Model::GhoulIdle]-> SmartSubmit(fc, Techniques::CamFacing);
}
LevelLayout::LevelLayout(DXGraphics& gfx, FrameCommander& fc, const CombatManager& cm) : gfx(gfx), fc(fc), cm(cm), sl(gfx)
LevelLayout::LevelLayout(DXGraphics& gfx, FrameCommander& fc, const CombatManager& cm) :
hangers(gfx, {4.0f,-0.9f}, {7.0f,2.9f}, 8u),
gfx(gfx),
fc(fc),
cm(cm),
sl(gfx)
{
wallModels.emplace_back(L"Media\\Models\\stone_wall.obj", gfx);
wallModels.emplace_back(L"Media\\Models\\stone_floor.obj", gfx);
......@@ -213,8 +218,8 @@ void LevelLayout::AddWall(Wall::Model mod, Wall::Type type, DirectX::XMFLOAT2 po
void LevelLayout::AddEnemy(Enemy::Monster monster, DirectX::XMFLOAT2 pos, bool isDead) //right now only adds corpses
{
PositionData posData;
posData.rot = { 0.0f, 3 * PI / 2, PI / 2 }; //this rotation is used for the camera facing technique to work correctly
posData.pos = { pos.x,1.0f ,pos.y };
posData.rot = { 0.0f, 3 * PI / 2, PI / 2 }; //this rotation is used for the camera facing technique to work correctly
posData.pos = { pos.x,1.0f ,pos.y }; //collapse?
const auto model = isDead ? Enemy::Model::GhoulCorpse : Enemy::Model::GhoulRage;
enemiesForDrawing[static_cast<size_t>(monster)].first.push_back(std::move(posData));
enemiesForDrawing[static_cast<size_t>(monster)].second.push_back(model);
......@@ -283,6 +288,7 @@ void LevelLayout::SubmitDrawables()
for (auto& w : wallModels) w.Submit(fc);
enemies[0].Submit(fc);
sl.SubmitLightHolders(fc);
hangers.Submit(fc);
previousState = state;
}
......
......@@ -7,6 +7,7 @@
#include "../CombatManager.h"
#include "../SceneLight.h"
#include "../CameraManager.h"
#include "../CeilingHangers.h"
class LevelLayout
{
......@@ -137,4 +138,5 @@ private:
SceneLight sl;
CameraManager camMan;
EnemyCombat::State previousState;
CeilingHangers hangers;
};
\ No newline at end of file
......@@ -117,7 +117,7 @@ public:
Ghoul::Ghoul()
{
HP = 1u;
HP = 75u;
maxHP = 75u;
speed = 1.0f;
block = 0u;
......
......@@ -14,26 +14,23 @@ float4 main(float2 tc : Texcoord, float4 pos : SV_Position) : SV_Target
else
{
float nDiv = 6.0f;
int each = int((1.0f / nDiv) * 1000);
int tci = int(tc.y * 1000.0f);
uint each = uint((1.0f / nDiv) * 1000);
uint tci = uint(tc.y * 1000.0f);
float depth = 0.001 * (tci % each);
int ind = tci / each;
int mid = nDiv / 2;
uint ind = tci / each;
uint mid = nDiv / 2;
if (ind >= mid)
{
int dif = ind - mid;
uint dif = ind - mid;
ind -= 2 * dif;
}
else
{
int dif = mid - ind;
uint dif = mid - ind;
ind += 2 * dif;
}
tc.y = (0.001f * (float) each) * ind + depth;
float4 dtex = tex.Sample(splr, tc);
return float4(0.1f + dtex.b*0.9f, 0.1f, 0.1f, 1.0f);
}
}
\ No newline at end of file
# Blender MTL File: 'None'
# Material Count: 1
newmtl CeilingHanger0
Ns 200.300000
Ka 1.000000 1.000000 1.000000
Kd 0.600000 1.500000 4.000000
Ks 1.300000 0.700000 0.200000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd CeilingHanger0.png
map_Kn CeilingHanger0Normal.tif
\ No newline at end of file
# Blender v2.81 (sub 16) OBJ File: ''
# www.blender.org
mtllib CeilingHanger0.mtl
o Plane
v -1.000000 0.000000 0.850000
v 0.700000 0.000000 0.850000
v -1.000000 0.000000 -0.850000
v 0.700000 0.000000 -0.850000
vt 0.999900 0.999900
vt 0.000100 0.000100
vt 0.999900 0.000100
vt 0.000100 0.999900
vn 0.0000 1.0000 0.0000
usemtl CeilingHanger0
s off
f 2/1/1 3/2/1 1/3/1
f 2/1/1 4/4/1 3/2/1
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment