sead
Loading...
Searching...
No Matches
aglLightMapMgr.h
Go to the documentation of this file.
1#pragma once
2
3#include <common/aglTextureSampler.h>
4#include <container/seadBuffer.h>
5#include <container/seadPtrArray.h>
6#include <container/seadSafeArray.h>
7#include <environment/aglEnvObjMgr.h>
8#include <lighting/aglLightMap.h>
9#include <utility/aglDebugTexturePage.h>
10#include <utility/aglParameterObj.h>
11#include <utility/aglParameterCurve.h>
12#include <utility/aglParameterIO.h>
13#include <basis/seadAssert.h>
14
15namespace agl { namespace lght {
16
17class LightMapMgr : public utl::IParameterIO, public sead::hostio::Node
18{
19 static const s32 cLUTValueNum = 128;
20
30 static_assert(cLUT_Num == 32);
31
33 {
34 public:
35 CPUTexture();
36 ~CPUTexture();
37
38 private:
39 void* mPtr;
43
44 friend class LightMap;
45 friend class LightMapMgr;
46 };
47 static_assert(sizeof(CPUTexture) == 0x244);
48
49 class LUT // Real name unknown
50 {
51 private:
54
55 friend class LightMap;
56 friend class LightMapMgr;
57 };
58 static_assert(sizeof(LUT) == 0xD8);
59
60 typedef LightMap::GraphicsContext GraphicsContext;
61
62public:
64 {
65 public:
66 CreateArg();
67
68 virtual ~CreateArg()
69 {
70 }
71
72 void setViewMax(s32 view_max)
73 {
74 SEAD_ASSERT(0 < view_max);
75 mViewMax = view_max;
76 }
77
79 {
80 return mViewMax;
81 }
82
83 void setSizeSphere(s32 size_sphere)
84 {
85 SEAD_ASSERT(0 < size_sphere);
86 mSizeSphere = size_sphere;
87 }
88
90 {
91 return mSizeSphere;
92 }
93
94 void setSizeCube(s32 size_cube)
95 {
96 SEAD_ASSERT(0 < size_cube);
97 mSizeCube = size_cube;
98 }
99
101 {
102 return mSizeCube;
103 }
104
105 void setNum(s32 num)
106 {
107 SEAD_ASSERT(0 < num);
108 mNum = num;
109 }
110
111 s32 getNum() const
112 {
113 return mNum;
114 }
115
116 protected:
122 };
123 static_assert(sizeof(CreateArg) == 0x18);
124
125public:
126 LightMapMgr();
127 virtual ~LightMapMgr();
128
129 void initialize(const env::EnvObjBuffer::AllocateArg& alloc_arg, const CreateArg& create_arg, env::EnvObjMgr* p_env_mgr, sead::Heap* heap = nullptr);
130
131 void update();
132
133 void updateGPU(bool invalidate_gpu = false) const;
134 void updateViewGPU(s32 view_index, bool ignore_mapping_type, const sead::Matrix34f& view_mtx, bool invalidate_gpu = false) const;
135
136 ShaderMode draw(s32 view_index, bool ignore_mapping_type, ShaderMode mode) const;
137
139 {
140 if (index == -1)
141 return nullptr;
142
143 return &(mLightMap[index]);
144 }
145
146 const LightMap* getLightMap(s32 index) const
147 {
148 if (index == -1)
149 return nullptr;
150
151 return &(mLightMap[index]);
152 }
153
154 s32 searchIndex(const sead::SafeString& name) const;
155
156protected:
157 virtual void postRead_();
158
159private:
160 void updateLUT_();
161 void createNormalMap_(s32 size_sphere, s32 size_cube);
162 void constructList_();
163 void constructMemory_();
164
165private:
172 GraphicsContext mGraphicsContext;
177 u32 _2b88; // Unused
180
181 friend class LightMap;
182};
183static_assert(sizeof(LightMapMgr) == 0x2D6C, "agl::lght::LightMapMgr size mismatch");
184
185} }
Definition aglTextureData.h:11
Definition aglTextureSampler.h:12
Definition aglEnvObjBuffer.h:13
Definition aglEnvObjBuffer.h:10
Definition aglEnvObjMgr.h:16
Definition aglLightMapMgr.h:33
TextureData mTextureData
Definition aglLightMapMgr.h:41
void * mPtr
Definition aglLightMapMgr.h:39
u32 mSize
Definition aglLightMapMgr.h:40
CPUTexture()
Definition aglLightMapMgr.cpp:577
~CPUTexture()
Definition aglLightMapMgr.cpp:583
TextureSampler mTextureSampler
Definition aglLightMapMgr.h:42
Definition aglLightMapMgr.h:64
s32 getViewMax() const
Definition aglLightMapMgr.h:78
CreateArg()
Definition aglLightMapMgr.cpp:568
s32 getSizeSphere() const
Definition aglLightMapMgr.h:89
void setNum(s32 num)
Definition aglLightMapMgr.h:105
s32 mSizeCube
Definition aglLightMapMgr.h:119
s32 mNum
Definition aglLightMapMgr.h:120
s32 mSizeSphere
Definition aglLightMapMgr.h:118
void setSizeSphere(s32 size_sphere)
Definition aglLightMapMgr.h:83
s32 getNum() const
Definition aglLightMapMgr.h:111
void setViewMax(s32 view_max)
Definition aglLightMapMgr.h:72
s32 getSizeCube() const
Definition aglLightMapMgr.h:100
void setSizeCube(s32 size_cube)
Definition aglLightMapMgr.h:94
u32 _10
Definition aglLightMapMgr.h:121
s32 mViewMax
Definition aglLightMapMgr.h:117
virtual ~CreateArg()
Definition aglLightMapMgr.h:68
Definition aglLightMapMgr.h:50
utl::Parameter< sead::FixedSafeString< 32 > > mName
Definition aglLightMapMgr.h:52
utl::ParameterCurve1f mIntensity
Definition aglLightMapMgr.h:53
Definition aglLightMapMgr.h:18
GraphicsContext mGraphicsContext
Definition aglLightMapMgr.h:172
virtual void postRead_()
Definition aglLightMapMgr.cpp:552
void updateViewGPU(s32 view_index, bool ignore_mapping_type, const sead::Matrix34f &view_mtx, bool invalidate_gpu=false) const
Definition aglLightMapMgr.cpp:478
utl::IParameterObj mLUTParam
Definition aglLightMapMgr.h:175
virtual ~LightMapMgr()
Definition aglLightMapMgr.cpp:19
void updateLUT_()
Definition aglLightMapMgr.cpp:202
s32 searchIndex(const sead::SafeString &name) const
Definition aglLightMapMgr.cpp:537
LightMap * getLightMap(s32 index)
Definition aglLightMapMgr.h:138
const LightMap * getLightMap(s32 index) const
Definition aglLightMapMgr.h:146
void update()
Definition aglLightMapMgr.cpp:415
sead::PtrArray< LightMap > mLightMapCalc
Definition aglLightMapMgr.h:167
f32 _2b84
Definition aglLightMapMgr.h:176
u32 _2b88
Definition aglLightMapMgr.h:177
CPUTexture mCPUTextureSphereNormal
Definition aglLightMapMgr.h:169
void updateGPU(bool invalidate_gpu=false) const
Definition aglLightMapMgr.cpp:466
void createNormalMap_(s32 size_sphere, s32 size_cube)
Definition aglLightMapMgr.cpp:246
sead::Heap * mpLightMapHeap
Definition aglLightMapMgr.h:179
LightMapMgr()
Definition aglLightMapMgr.cpp:10
void constructList_()
Definition aglLightMapMgr.cpp:326
void constructMemory_()
Definition aglLightMapMgr.cpp:386
sead::Buffer< LightMap > mLightMap
Definition aglLightMapMgr.h:166
utl::IParameterObj mConfig
Definition aglLightMapMgr.h:173
sead::UnsafeArray< LUT, cLUT_Num > mLUT
Definition aglLightMapMgr.h:171
static const s32 cLUTValueNum
Definition aglLightMapMgr.h:19
utl::Parameter< sead::FixedSafeString< 32 > > mType
Definition aglLightMapMgr.h:174
void initialize(const env::EnvObjBuffer::AllocateArg &alloc_arg, const CreateArg &create_arg, env::EnvObjMgr *p_env_mgr, sead::Heap *heap=nullptr)
Definition aglLightMapMgr.cpp:25
LUTType
Definition aglLightMapMgr.h:22
@ cLUT_Hemisphere
Definition aglLightMapMgr.h:25
@ cLUT_Half_Lambert
Definition aglLightMapMgr.h:24
@ cLUT_Lambert
Definition aglLightMapMgr.h:23
@ cLUT_UserData_0
Definition aglLightMapMgr.h:26
@ cLUT_Num
Definition aglLightMapMgr.h:28
@ cLUT_UserData_Num
Definition aglLightMapMgr.h:27
utl::DebugTexturePage mDebugTexturePage
Definition aglLightMapMgr.h:178
CPUTexture mCPUTextureCubeNormal
Definition aglLightMapMgr.h:170
CPUTexture mCPUTextureLUT
Definition aglLightMapMgr.h:168
ShaderMode draw(s32 view_index, bool ignore_mapping_type, ShaderMode mode) const
Definition aglLightMapMgr.cpp:503
Definition aglLightMap.h:16
sead::UnsafeArray< sead::UnsafeArray< sead::GraphicsContextMRT, cBoolMax >, cMappingType_Num > GraphicsContext
Definition aglLightMap.h:138
Definition aglDebugTexturePage.h:11
Definition aglParameterIO.h:9
Definition aglParameterObj.h:13
Definition aglParameter.h:107
Definition seadBuffer.h:13
Definition seadSafeString.h:421
Definition seadHeap.h:23
Definition seadPtrArray.h:111
Definition seadSafeArray.h:257
Definition seadHostIODummy.h:25
Definition aglEnvObj.cpp:21
Definition aglLightMap.h:11
Definition aglImageFilter2D.h:11
ParameterCurve< 1 > ParameterCurve1f
Definition aglParameterCurve.hpp:17
Definition aglDisplayList.cpp:5
ShaderMode
Definition aglShaderEnum.h:27
Definition seadHeap.h:14
Definition seadAssert.h:44
SafeStringBase< char > SafeString
Definition seadSafeString.h:409
Matrix34< f32 > Matrix34f
Definition seadMatrix.h:342
#define SEAD_ASSERT(condition)
Definition seadAssert.h:24