tutorial 04

This commit is contained in:
h4570
2022-08-22 23:23:51 +02:00
parent 4fa65fc535
commit d469e78747
26 changed files with 400 additions and 96 deletions
+44
View File
@@ -0,0 +1,44 @@
/*
# _____ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licensed under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include <tyra>
namespace Tyra {
class Camera {
public:
Camera(Pad* pad);
~Camera();
Vec4 lookAt;
Vec4 position;
/**
* Result variable of unit circle calculation
* This is needed for rotation about the camera lookAt
* https://www.geogebra.org/m/cNEtsbvC
*/
Vec4 unitCircle;
CameraInfo3D getCameraInfo() { return CameraInfo3D(&position, &lookAt); }
void update();
private:
void updatePosition();
void updateLookAt();
Pad* pad;
float circleRotation, circleLength, speed, lookAtHeight;
};
} // namespace Tyra
+10 -1
View File
@@ -12,6 +12,7 @@
#include <tyra>
#include <memory.h>
#include "./camera.hpp"
namespace Tyra {
@@ -28,8 +29,16 @@ class Tutorial04 : public Game {
Engine* engine;
std::unique_ptr<StaticMesh> mesh;
Camera camera;
/** 3D pipeline used for rendering static meshes */
StaticPipeline stapip;
/** Options for static pipeline */
StaPipOptions renderOptions;
/** Mesh with de_dust2 */
std::unique_ptr<StaticMesh> mesh;
};
} // namespace Tyra