ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
CubeAnimation.h
Go to the documentation of this file.
1#pragma once
2
3#include "Animation.h"
4#include "../Objects/Cube.h"
5#include "../Materials/DepthMaterial.h"
6#include "../Materials/LightMaterial.h"
7#include "../Math/FunctionGenerator.h"
8
9class CubeAnimation : public Animation{
10private:
11 Cube cube;
16
17public:
18 CubeAnimation() : Animation(1) {
19 scene->AddObject(cube.GetObject());
20
21 cube.GetObject()->SetMaterial(&dMat);
22 }
23
24 void FadeIn(float stepRatio) override {}
25 void FadeOut(float stepRatio) override {}
26
27 void Update(float ratio) override {
28 float x = fGenRotation.Update();
29 float sx = fGenScale.Update();
30
32
33 cube.GetObject()->ResetVertices();
34
35 cube.GetObject()->GetTransform()->SetRotation(rotation);
36 cube.GetObject()->GetTransform()->SetScale(Vector3D(sx, sx, sx));
37 cube.GetObject()->GetTransform()->SetPosition(Vector3D(125.0f, 75.0f, 600.0f));
38
39 cube.GetObject()->UpdateTransform();
40 }
41};
DepthMaterial dMat
FunctionGenerator fGenScale
FunctionGenerator fGenRotation
LightMaterial lMat
void FadeIn(float stepRatio) override
void FadeOut(float stepRatio) override
void Update(float ratio) override
Maps depth along a specified axis to an RGB color using a gradient.
@ Z
Depth along the Z-axis.
Encapsulates a 3D rotation using Euler angles and a specific order of application.
Definition EulerAngles.h:25
A class to generate various waveform functions with customizable parameters.
@ Sine
Sine waveform.
float Update()
Updates and calculates the next value of the waveform.
A material class that incorporates multiple light sources for rendering.
A mathematical construct representing a rotation in 3D space.
Definition Quaternion.h:30
Handles 3D rotations and conversions between various rotation representations.
Definition Rotation.h:32
Quaternion GetQuaternion()
Gets the quaternion representation of the rotation.
Definition Rotation.cpp:234
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26
const EulerOrder EulerOrderXZYS
Order: X → Z → Y, static frame.