summaryrefslogtreecommitdiff
path: root/src/engine/editor/Light.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/editor/Light.cpp')
-rw-r--r--src/engine/editor/Light.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/src/engine/editor/Light.cpp b/src/engine/editor/Light.cpp
index 594383bd3..c4a368421 100644
--- a/src/engine/editor/Light.cpp
+++ b/src/engine/editor/Light.cpp
@@ -30,55 +30,55 @@ namespace Editor {
size_t LightObject::NumLights = 0;
- LightObject::LightObject(const char* name, FVector* pos, s8* direction) : GameObject(nullptr, nullptr) {
- Name = name;
- Pos = &LightPos;
- Rot = &LightRot;
- Scale = &LightScale;
-
- DespawnFlag = &_despawnFlag;
- DespawnValue = -1;
-
- Direction = direction;
-
- Collision = CollisionType::BOUNDING_BOX;
- BoundingBoxSize = 4.0f;
-
- NumLights += 1;
- }
-
- void LightObject::Load() {
- }
-
- void LightObject::Tick() {
- SetDirectionFromRotator(*Rot, Direction);
- }
- void LightObject::Draw() {
- Mat4 mtx_sun;
- Editor_MatrixIdentity(mtx_sun);
- gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
- gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
-
-
- // Calculate camera-to-object distance
- FVector cameraDir = FVector(LightPos.x - cameras[0].pos[0], LightPos.y - cameras[0].pos[1], LightPos.z - cameras[0].pos[2]);
- cameraDir = cameraDir.Normalize();
-
- IRotator centerRot;
- SetRotatorFromDirection(cameraDir, &centerRot);
-
- // Account for object not facing the correct direction when exported
- centerRot.yaw += 0x4000;
- ApplyMatrixTransformations(mtx_sun, LightPos, centerRot, LightScale);
- Editor_AddMatrix(mtx_sun, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(gDisplayListHead++, sun_LightModel_mesh);
-
- // Draw Arrow
- Mat4 mtx_arrow;
- IRotator rot = LightRot;
- rot.yaw += 0x4000;
- ApplyMatrixTransformations(mtx_arrow, LightPos, rot, LightScale);
- Editor_AddMatrix(mtx_arrow, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(gDisplayListHead++, (Gfx*)"__OTR__editor/light/sun_arrow");
- }
+LightObject::LightObject(const char* name, FVector* pos, s8* direction) : GameObject(nullptr, nullptr) {
+ Name = name;
+ Pos = &LightPos;
+ Rot = &LightRot;
+ Scale = &LightScale;
+
+ DespawnFlag = &_despawnFlag;
+ DespawnValue = -1;
+
+ Direction = direction;
+
+ Collision = CollisionType::BOUNDING_BOX;
+ BoundingBoxSize = 4.0f;
+
+ NumLights += 1;
+}
+
+void LightObject::Load() {
+}
+
+void LightObject::Tick() {
+ SetDirectionFromRotator(*Rot, Direction);
+}
+void LightObject::Draw() {
+ Mat4 mtx_sun;
+ Editor_MatrixIdentity(mtx_sun);
+ gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
+ gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
+
+ // Calculate camera-to-object distance
+ FVector cameraDir =
+ FVector(LightPos.x - cameras[0].pos[0], LightPos.y - cameras[0].pos[1], LightPos.z - cameras[0].pos[2]);
+ cameraDir = cameraDir.Normalize();
+
+ IRotator centerRot;
+ SetRotatorFromDirection(cameraDir, &centerRot);
+
+ // Account for object not facing the correct direction when exported
+ centerRot.yaw += 0x4000;
+ ApplyMatrixTransformations(mtx_sun, LightPos, centerRot, LightScale);
+ Editor_AddMatrix(mtx_sun, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(gDisplayListHead++, sun_LightModel_mesh);
+
+ // Draw Arrow
+ Mat4 mtx_arrow;
+ IRotator rot = LightRot;
+ rot.yaw += 0x4000;
+ ApplyMatrixTransformations(mtx_arrow, LightPos, rot, LightScale);
+ Editor_AddMatrix(mtx_arrow, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(gDisplayListHead++, (Gfx*) "__OTR__editor/light/sun_arrow");
}
+} // namespace Editor