7 Ref<Vivid::Shader> lightShader;
8 Ref<Vivid::Entity> plane;
9 Ref<Vivid::Entity> light;
10 Ref<Vivid::ModelComponent> planeModelComponent;
11 Ref<Vivid::TransformComponent> planeTransformComponent;
14 Ref<Vivid::DirectionalLightComponent> directionalLightComponent;
15 Ref<Vivid::Shader> shader;
21 Ref<Vivid::Entity> plane = Vivid::ECS::CreateEntity(
"Plane");
22 Ref<Vivid::Entity> light = Vivid::ECS::CreateEntity(
"DirectionalLight");
23 planeModelComponent = Vivid::ECS::CreateComponent<Vivid::ModelComponent>();
24 planeTransformComponent = Vivid::ECS::CreateComponent<Vivid::TransformComponent>();
28 shader = MakeRef<Vivid::Shader>(
"./../assets/shaders/phong.vertexShader.glsl",
29 "./../assets/shaders/phong.pixelShader.glsl");
31 planeMesh =
new Vivid::Mesh(
"./../assets/obj/plane.obj");
32 planeMesh->BindShader(shader);
34 planeModelComponent->AddMesh(planeMesh);
36 directionalLightComponent = Vivid::ECS::CreateComponent<Vivid::DirectionalLightComponent>();
42 Vivid::ECS::AddComponent(planeModelComponent->GetComponentID(), plane->GetEntityID());
43 Vivid::ECS::AddComponent(planeTransformComponent->GetComponentID(), plane->GetEntityID());
45 Vivid::ECS::AddComponent(directionalLightComponent->GetComponentID(), light->GetEntityID());
48 cam->SetPosition({ 0.0f, 0.0f, 100.0f });
51 planeMesh->AddTexture(
"./../assets/textures/brick_wall/diffuse.jpg");
52 planeMesh->AddTexture(
"./../assets/textures/brick_wall/displacement.jpg");
53 planeMesh->AddTexture(
"./../assets/textures/brick_wall/normal.jpg");
54 planeMesh->GetTexture(0)->SetName(
"DiffuseTexture");
55 planeMesh->GetTexture(1)->SetName(
"DepthMap");
56 planeMesh->GetTexture(2)->SetName(
"NormalMap");
61 Vector<Vivid::DirectionalLightComponent*> directionalLights;
62 Vivid::ECS::GetAllComponents(Vivid::ComponentType::DirectionalLightComponent, directionalLights);
64 float intensity = directionalLights[0]->GetIntensity();
67 planeMesh->BindShader(shader);
69 shader->SetUniform3f(
"LightDir", lightDir);
70 shader->SetUniform1f(
"LightIntensity", intensity);
71 shader->SetUniform3f(
"LightColor", lightColor);
76 ImGui::Begin(
"Debug");
78 ImGui::Text(
"Application average %.3f ms/frame (%.1f FPS)",
79 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
87 Application* app = Application::GetInstance(1920, 1080,
"Vivid: Bump Map Example");
96 return Vivid::main(0,
nullptr);
void Setup() override
Setup function.
void ImGuiRender() override
ImGuiRender function.
void Draw() override
Draw function.
A class for the MovableCamera's.
RenderingInterface class.