OpenGL/개발 일지 10

[OpenGL] 게임 엔진 개발 (10) - Terrain Collision

플레이어가 이동할 수 있게 되었으므로, 터레인 위에서 자연스럽게 움직일 수 있도록 플레이어와 터레인 간 콜리전을 구현해볼 것이다. 사실 Player 클래스에는 이미 관련 코드가 짜여져 있다.bool Player::Move(float deltaTime, Terrain* terrain){ // 회전 GLfloat* currRot = model->GetRotate(); float rotation = currTurnSpeed * deltaTime; float newRotY = currRot[1] + rotation; // new rotY if(newRotY > 180) newRotY -= 360.f; if (newRotY SetRotate(newRot); // 이동 GLfloat* currPos = model..

[OpenGL] 게임 엔진 개발 (9) - 플레이어 이동

참조 : https://www.youtube.com/watch?v=d-kuzyCkjoQ&pp=ygURb3BlbmdsIHBsYWVyIG1vdmU%3D 지금까지 플레이어 모델이 항상 A포즈로 서있기만 했는데, 이제 조작을 통해 맵 위로 다닐 수 있도록 할 것이다. 우선 Player 클래스를 새로 만들었다. Player.h#pragma once#include "glm/glm.hpp"class Model;class Terrain;class Player{public: Player(Model* model); void HandleInput(bool* keys, float deltaTime); bool Move(float deltaTime, Terrain* terrain); float GetRotY(); Model*..

[OpenGL] 게임 엔진 개발 (8) - Terrain

참조 : https://learnopengl.com/Guest-Articles/2021/Tessellation/Tessellation LearnOpenGL - TessellationTessellation Guest-Articles/2021/Tessellation/Tessellation Tessellation Chapter II: Rendering Terrain using Tessellation Shaders & Dynamic Levels of Detail In order to complete this chapter, you will need to be able to create an OpenGL 4.0+ context. This slearnopengl.comlearnopengl.com에 테셀레이션을 활용..

[OpenGL] 게임 엔진 개발 (7) - Normal Mapping

이번엔 Normal Mapping을 추가해보았다. Normal Mapping이란, 버텍스를 늘리지 않으면서 표면의 복잡성을 취하는 기술이다. 생각해보면, 우리가 처음 텍스쳐를 쓴 이유도 물체 표면의 컬러의 복잡함을 구현하기 위해 버텍스를 여러개 쓰기보다는, 그걸 텍스쳐라는 독립적인 자료구조에 저장하기 위한 것이었다. Normal Map도 이와 똑같다. 다만, 텍스쳐라는 자료구조에 저장하는 것이 컬러 정보가 아닌 normal 정보인 것이다. Normal Mapping의 가장 대표적인 예시이다. 고전적인 방식대로 우측의 결과물을 구현하고자 한다면, 벽돌이 들어가고 나오는 부분마다 버텍스를 포지션을 달리해서 왕창 심어줘야 했겠지만, normal map의 사용을 통해 기존과 마찬가지로 버텍스 4개만 사용하고도 ..

[OpenGL] 게임 엔진 개발 (6) - Scene Hierarchy

전체 소스코드:https://github.com/sys010611/YsEngine  씬에 배치될 게 더 많아지기 전에 Scene Hierarchy 창을 간단하게 만들어보았다. UI 작업에 들어가기 전, 게임 오브젝트들(Model, Light 등)을 한꺼번에 다루는 클래스가 있어야겠다는 생각이 들었다.게임 오브젝트들을 다루는 다른 클래스들은 최대한 해당 클래스에만 의존하도록 하고 싶다. (DIP) DIP에 대한 자세한 내용은https://ciel45.tistory.com/22 [UE5] 블루아카이브 TPS게임 개발일지 (10) - 사격 기능 구현 준비 작업 + DIP사격 애니메이션까지는 만들어 두었으므로, 실제로 총이 발사되는 메커니즘을 만들고자 한다. 우선 발사를 구현하는 데에는 두가지 방법이 있다. 라..

[OpenGL] 게임 엔진 개발 (5) - Skeletal Animation (3)

이제 애니메이션을 프로젝트에 적용해볼 시간이다. 이번에도 애니메이션은 프로젝트할 때마다 항상 덕을 많이 보고있는 mixamo에서 구했다.https://www.mixamo.com/#/ Mixamo www.mixamo.com 그리고 모델링은 니어: 오토마타의 캐릭터 데볼의 모델링을 사용하였다.https://sketchfab.com/3d-models/devola-nier-automata-27271403970d417cab3e8cb1715e1769 Devola - Nier: Automata - Download Free 3D model by Banof - SketchfabOpen with QR Code: Scan this code to open the model on your device, then, tap on ..

[OpenGL] 게임 엔진 개발 (4) - Skeletal Animation (2)

앞선 과정을 통해 각 버텍스가 자신에게 영향을 주는 bone들의 정보를 모두 갖추게 되었다.(몇번 index의 bone이 나에게 얼마만큼의 영향을 주고, 그 bone의 offset matrix는 어떻게 되는지) 이제 모든 키프레임 데이터를 가지며, 그 사이를 선형 보간하는 클래스 Bone을 만들 차례이다. Bone.h:#pragma once#include #include #include #include #include #include "assimp/anim.h"struct KeyPosition{ glm::vec3 position; float timeStamp;};struct KeyRotation{ glm::quat orientation; float timeStamp;};struct KeyScale{ gl..

[OpenGL] 게임 엔진 개발 (3) - Skeletal Animation (1)

전적으로 learnopengl.com의 글의 도움을 받았다.https://learnopengl.com/Guest-Articles/2020/Skeletal-Animation LearnOpenGL - Skeletal AnimationSkeletal Animation Guest-Articles/2020/Skeletal-Animation 3D Animations can bring our games to life. Objects in 3D world like humans and animals feel more organic when they move their limbs to do certain things like walking, running & attacking. This tutorlearnopengl.co..

[OpenGL] 게임 엔진 개발 (2) - GUI + Skybox

현재까지 진행 상황:  사실 개발 과정을 다 공부 카테고리에 적어놓아서, 여기에 따로 쓸건 없을 것 같다.https://ciel45.tistory.com/113 [OpenGL] FrameBuffer 생성, 사용참조 : https://learnopengl.com/Advanced-OpenGL/Framebuffers LearnOpenGL - FramebuffersFramebuffers Advanced-OpenGL/Framebuffers So far we've used several types of screen buffers: a color buffer for writing color values, a depth buffer to write and testciel45.tistory.comhttps://ciel4..

[OpenGL] 게임 엔진 개발 (1) - 시작 + ImGui

지금까지 학습한 내용을 바탕으로 게임 엔진 제작을 시작하였다.  우선 엔진의 기본 구성 요소들(Camera, Model, Mesh, Light, Material 등)은 공부 일지에서 사용했던 코드를 사용하되, 내 스타일에 맞게 여기저기 많이 고쳤다. 공부할 때 사용했던 코드는 포인터를 거의 사용하지 않았기 때문에 헤더 파일에 #include가 필요하게되어 헤더가 비대화되는 문제가 있었다.https://ciel45.tistory.com/4 (관련 내용) [언리얼 엔진 5] 헤더를 include할 때 주의할 점 (+ 포워드 선언)우선, #include "__.h"를 사용하는 것은 해당 헤더의 소스 코드 전체를 include문의 위치에 그대로 복사 & 붙여넣기하는 것과 같다.컴파일 시에 소스 코드의 inclu..