Have the original lighting system back and a little lightbulb model to show where the light is.
This commit is contained in:
parent
3231f747a9
commit
a29494325b
143 changed files with 16360 additions and 9 deletions
46
33-shadow-mapping/tests/config_tests.cpp
Normal file
46
33-shadow-mapping/tests/config_tests.cpp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#include <fuc2/testing.hpp>
|
||||
#include "components.hpp"
|
||||
#include <fstream>
|
||||
#include "json.hpp"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
using json = nlohmann::json;
|
||||
|
||||
using namespace fuc2;
|
||||
|
||||
/*
|
||||
* This also tests Mesh by using Model to load them.
|
||||
*/
|
||||
namespace config_tests {
|
||||
void test_json_components() {
|
||||
std::ifstream f{"tests/config.json"};
|
||||
auto j = json::parse(f);
|
||||
auto mat = j["material_test"].get<components::Material>();
|
||||
|
||||
CHECK(mat.ambient.x == 0.1f, "wrong value");
|
||||
|
||||
auto light = j["lighting_test"].get<components::Lighting>();
|
||||
|
||||
auto camera = j["camera_test"].get<components::Camera>();
|
||||
|
||||
auto model = j["model_test"].get<components::Model>();
|
||||
|
||||
auto thing = j["thing_test"].get<components::Thing>();
|
||||
}
|
||||
|
||||
|
||||
void test_load_json_config() {
|
||||
std::ifstream f{"config.json"};
|
||||
auto j = json::parse(f);
|
||||
auto scene = j["scene"].get<components::Scene>();
|
||||
}
|
||||
|
||||
fuc2::Set TESTS{
|
||||
.name="config",
|
||||
.options={ .fail_fast=false },
|
||||
.tests={
|
||||
TEST(test_json_components),
|
||||
TEST(test_load_json_config),
|
||||
}
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue