응애맘마조
가위바위보 본문
앞뒤좌우 방향으로 카메라를 4개 만들고 1, 2, 3 ,4 번호키를 눌러서 바꾸는 효과를 넣는 것이 과제였습니다.
#include "stdafx.h"
#include "Solar.h"
#include "Scene2.h"
Scene2::Scene2()
{
}
Scene2::~Scene2()
{
}
void Scene2::Init()
{
Cam = Camera::Create();
Cam->LoadFile("Cam.xml");
Camera::main = Cam;
Cam2 = Camera::Create();
Cam2->LoadFile("Cam.xml");
Cam3 = Camera::Create();
Cam3->LoadFile("Cam.xml");
Cam4 = Camera::Create();
Cam4->LoadFile("Cam.xml");
grid = Grid::Create();
actor = Actor::Create();
Cam->width = App.GetHalfWidth();
Cam->height = App.GetHalfHeight();
Cam->viewport.width = App.GetHalfWidth();
Cam->viewport.height = App.GetHalfHeight();
Cam->SetWorldPos(Vector3(0, 5, 10));
Cam2->width = App.GetHalfWidth();
Cam2->height = App.GetHalfHeight();
Cam2->viewport.width = App.GetHalfWidth();
Cam2->viewport.height = App.GetHalfHeight();
Cam2->viewport.x = App.GetHalfWidth();
Cam2->SetWorldPos(Vector3(0, 5, -10));
Cam2->rotation.y = 0;
Cam3->width = App.GetHalfWidth();
Cam3->height = App.GetHalfHeight();
Cam3->viewport.width = App.GetHalfWidth();
Cam3->viewport.height = App.GetHalfHeight();
Cam3->viewport.y = App.GetHalfHeight();
Cam3->SetWorldPos(Vector3(10, 5, 0));
Cam3->rotation.y = 4.71;
Cam4->width = App.GetHalfWidth();
Cam4->height = App.GetHalfHeight();
Cam4->viewport.width = App.GetHalfWidth();
Cam4->viewport.height = App.GetHalfHeight();
Cam4->viewport.x = App.GetHalfWidth();
Cam4->viewport.y = App.GetHalfHeight();
Cam4->SetWorldPos(Vector3(-10, 5, 0));
Cam4->rotation.y = -4.71;
}
void Scene2::Release()
{
Cam->Release();
Cam2->Release();
Cam3->Release();
Cam4->Release();
actor->Release();
}
void Scene2::Update()
{
Camera::ControlMainCam();
//debug
ImGui::Text("FPS: %d", TIMER->GetFramePerSecond());
//Hierarchy
ImGui::Begin("Hierarchy");
grid->RenderHierarchy();
Cam->RenderHierarchy();
Cam2->RenderHierarchy();
Cam3->RenderHierarchy();
Cam4->RenderHierarchy();
actor->RenderHierarchy();
ImGui::End();
Cam->Update();
Cam2->Update();
Cam3->Update();
Cam4->Update();
grid->Update();
actor->Update();
if (INPUT->KeyDown('1'))
{
actor->LoadFile("Rock.xml");
}
if (INPUT->KeyDown('2'))
{
actor->LoadFile("Sissors.xml");
}
if (INPUT->KeyDown('3'))
{
actor->LoadFile("Paper.xml");
}
if (INPUT->KeyDown('4'))
{
exit(0);
}
}
void Scene2::LateUpdate()
{
}
void Scene2::Render()
{
Camera::main->Set();
grid->Render();
actor->Render();
Cam2->Set();
grid->Render();
actor->Render();
Cam3->Set();
grid->Render();
actor->Render();
Cam4->Set();
grid->Render();
actor->Render();
}
void Scene2::PreRender()
{
}
void Scene2::ResizeScreen()
{
}
코드입니다.
실행 영상입니다.
읽어주셔서 감사합니다.
Comments