Remove light_manager

This commit is contained in:
Wellinator
2021-04-09 13:36:40 -03:00
parent 9dd69317e3
commit 18ba08dc7a
5 changed files with 0 additions and 190 deletions
-1
View File
@@ -3,7 +3,6 @@ EE_BIN = cube.elf
TYRA_DIR = ./../../engine
EE_OBJS = \
managers/light_manager.o \
objects/cube.o \
camera.o \
cubes.o \
-1
View File
@@ -19,7 +19,6 @@ void Cubes::onInit(){
}
void Cubes::onUpdate(){
lightManager.update();
camera.update(engine->pad, cube->mesh);
cube->update(engine->pad, camera);
engine->renderer->draw(cube->mesh);
-2
View File
@@ -4,7 +4,6 @@
#include <tamtypes.h>
#include <game.hpp>
#include <engine.hpp>
#include "managers/light_manager.hpp"
#include "modules/texture_repository.hpp"
#include "camera.hpp"
#include "objects/cube.hpp"
@@ -25,7 +24,6 @@ class Cubes : public Game
void setBgColorAndAmbientColor();
TextureRepository *texRepo;
Cube *cube;
LightManager lightManager;
Camera camera;
};
-148
View File
@@ -1,148 +0,0 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2020, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "light_manager.hpp"
#include <utils/debug.hpp>
// ----
// Constructors/Destructors
// ----
LightManager::LightManager()
{
PRINT_LOG("Creating light manager!");
bulbsCount = 2;
bulbs = new LightBulb[2];
bulb1Dir = 0;
bulbs[0].intensity = 1;
bulbs[0].position.set(30.00F, 30.00F, -30.00F);
bulb2Dir = 1;
bulbs[1].intensity = 1;
bulbs[1].position.set(-30.00F, 30.00F, 30.00F);
audioOffset = audioTick = 0;
PRINT_LOG("Light manager created!");
}
LightManager::~LightManager()
{
delete[] bulbs;
}
// ----
// Methods
// ----
/** Light bulb moving test */
void LightManager::update()
{
updateBulb1();
updateBulb2();
}
void LightManager::updateBulb1()
{
if (bulb1Dir == 1)
{
if (areLightsInverted)
{
bulbs[0].position.x += 0.6F;
bulbs[0].position.z -= 0.6F;
}
else
{
bulbs[0].position.x += 0.6F;
bulbs[0].position.z += 0.6F;
}
}
else
{
if (areLightsInverted)
{
bulbs[0].position.x -= 0.6F;
bulbs[0].position.z += 0.6F;
}
else
{
bulbs[0].position.x -= 0.6F;
bulbs[0].position.z -= 0.6F;
}
}
}
void LightManager::updateBulb2()
{
if (bulb2Dir == 1)
{
if (areLightsInverted)
{
bulbs[1].position.x -= 0.6F;
bulbs[1].position.z += 0.6F;
}
else
{
bulbs[1].position.x += 0.6F;
bulbs[1].position.z += 0.6F;
}
}
else
{
if (areLightsInverted)
{
bulbs[1].position.x += 0.6F;
bulbs[1].position.z -= 0.6F;
}
else
{
bulbs[1].position.x -= 0.6F;
bulbs[1].position.z -= 0.6F;
}
}
}
/** Called by audio thread */
void LightManager::onAudioTick()
{
bulb1Dir = bulb1Dir == 1 ? 0 : 1;
bulb2Dir = bulb2Dir == 1 ? 0 : 1;
if (audioTick++ > 17)
{
if (++audioOffset > 3)
{
audioOffset = 0;
if (areLightsInverted)
{
areLightsInverted = false;
bulbs[0].position.x = 20.0F;
bulbs[0].position.z = -20.0F;
bulbs[1].position.x = -20.0F;
bulbs[1].position.z = 20.0F;
}
else
{
areLightsInverted = true;
bulbs[0].position.x = 20.0F;
bulbs[0].position.z = 20.0F;
bulbs[1].position.x = -20.0F;
bulbs[1].position.z = -20.0F;
}
}
}
else
{
bulbs[0].intensity += 9;
bulbs[1].intensity += 9;
}
}
@@ -1,38 +0,0 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2020, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#ifndef _LIGHT_MANAGER_
#define _LIGHT_MANAGER_
#include <models/light_bulb.hpp>
#include <models/audio_listener.hpp>
/** Class which is maintaining floors objects */
class LightManager
{
public:
LightManager();
~LightManager();
LightBulb *bulbs;
u8 bulbsCount;
void update();
void onAudioTick();
private:
u8 bulb1Dir, bulb2Dir;
void updateBulb1();
void updateBulb2();
u8 audioOffset, areLightsInverted;
u32 audioTick;
};
#endif