generated from asmaloney/GDExtensionTemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
198 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include <godot_cpp/variant/utility_functions.hpp> | ||
|
||
#include "Native/Chunks/ConfigReader.hpp" | ||
#include "Native/Chunks/StreamReader.hpp" | ||
#include "Native/Chunks/LightChunk.hpp" | ||
#include "Native/SWBF2.hpp" | ||
|
||
namespace SWBF2::Native | ||
{ | ||
void LightChunk::ProcessChunk(StreamReader &streamReader) | ||
{ | ||
ConfigReader configReader{ streamReader }; | ||
|
||
for (auto const &[id, node] : configReader.m_data.getNodes()) | ||
{ | ||
Light light{}; | ||
light.m_name = node->m_string; | ||
|
||
for (auto const &[attr, val] : node->getNodes()) | ||
{ | ||
switch (attr) | ||
{ | ||
case "Position"_fnv: | ||
{ | ||
light.m_position = val->ToVector3(); | ||
break; | ||
} | ||
|
||
case "Rotation"_fnv: | ||
{ | ||
light.m_rotation = val->ToQuaternion(); | ||
break; | ||
} | ||
|
||
case "Color"_fnv: | ||
{ | ||
light.m_color = val->ToColor(); | ||
break; | ||
} | ||
|
||
case 0xe7e90aee: // CastShadow | ||
{ | ||
light.m_castShadow = true; | ||
break; | ||
} | ||
|
||
case 0x489162bb: // Specular | ||
{ | ||
light.m_castSpecular = (bool)val->m_float; | ||
break; | ||
} | ||
|
||
case 0xd290c23b: // Static | ||
{ | ||
light.m_static = true; | ||
break; | ||
} | ||
|
||
case 0x84e26526: // PS2BlendMode | ||
case 0xbfe60da6: // TileUV | ||
case 0x6ac627c1: // OffsetUV | ||
break; | ||
} | ||
} | ||
|
||
SWBF2::m_lights.emplace(light.m_name, light); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include "StreamReader.hpp" | ||
|
||
namespace SWBF2::Native | ||
{ | ||
class LightChunk { | ||
public: | ||
static void ProcessChunk(StreamReader &streamReader); | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
#pragma once | ||
|
||
#include "Models/Model.hpp" | ||
#include "Texture/Texture.hpp" | ||
|
||
#include "World.hpp" | ||
|
||
namespace SWBF2::Native | ||
{ | ||
class Light { | ||
public: | ||
std::string m_name; | ||
godot::Vector3 m_position; | ||
godot::Quaternion m_rotation; | ||
uint32_t m_type; | ||
godot::Color m_color; | ||
bool m_castShadow; | ||
bool m_static; | ||
bool m_castSpecular; | ||
float m_range; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters