-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSceneEffect.cpp
More file actions
37 lines (30 loc) · 957 Bytes
/
Copy pathSceneEffect.cpp
File metadata and controls
37 lines (30 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "DXUT.h"
#include "SceneEffect.h"
SceneEffect::SceneEffect(Effect* effect) : m_effect(effect)
{
m_textureHandle = effect->GetParameterByName(0, "g_baseTexture");
m_wMatrix = effect->GetParameterByName(0, "g_worldMatrix");
m_vMatrix = effect->GetParameterByName(0, "g_viewMatrix");
m_pMatrix = effect->GetParameterByName(0, "g_projMatrix");
}
void SceneEffect::setWorldMatrix(const Matrix& worldMatrix)
{
m_effect->SetMatrix(m_wMatrix, &worldMatrix);
}
void SceneEffect::setViewMatrix(const Matrix& viewMatrix)
{
m_effect->SetMatrix(m_vMatrix, &viewMatrix);
}
void SceneEffect::setProjMatrix(const Matrix& projMatrix)
{
m_effect->SetMatrix(m_pMatrix, &projMatrix);
}
void SceneEffect::setBaseTexture(Texture* texture)
{
m_effect->SetTexture(m_textureHandle, texture);
}
void SceneEffect::applyCamera(const SceneCamera& camera)
{
setViewMatrix(camera.viewMatrix());
setProjMatrix(camera.projMatrix());
}