Compare commits

..

No commits in common. "master" and "874934e603f0934cb55773cd0e74d0cc236586e4" have entirely different histories.

123 changed files with 409 additions and 67642 deletions

228
.gitignore vendored
View File

@ -1,5 +1,223 @@

/grk/.vs/grk-cw
/grk/project/Debug
/.vs
/grk/dependencies/glm/out/build/x64-Debug
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
# Roslyn cache directories
*.ide/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
#NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
*.idb
*.tlog
*.exe
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding addin-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# If using the old MSBuild-Integrated Package Restore, uncomment this:
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# =========================
# Operating System Files
# =========================
# OSX
# =========================
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# Windows
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp

Binary file not shown.

View File

@ -1,43 +0,0 @@
# Nazwa Projektu
Projekt z grafiki komputerowej - Interstellar Odyssey
## Opis
Interaktywny symulator loty kosmicznego 3D. Celem naszej gry jest zwiedzanie rożnych układów słonecznych.
Pokonywanie jak największej ilości wrogów i utrzymywanie się przy życiu za pomocą dostępnych itemków do zebrania.
## Funkcje i możliwości
-Physically Based Rendering z mapą normalnych :
![normal_map](images/normal_map.png)
-Sprite Rendering razem z techniką bilboardingu:
![sprite_rendering](images/sprite.png)
- Particle Generator:
![Turbo](images/turbo.png)
- Skybox/Tworzenie wielu galaktyk:
![galaktyki](images/galaktyki.png)
- Strzelanie
![strzelanie](images/strzelanie.png)
- Pas asteroid
![pas_asteroid](images/asteroidy.png)
- Otrzymywanie i zadawanie obrażeń
![sprite_dmg](images/sprite_dmg.png)
- Możliwości uzupełnienia turbo i życia przez zbieranie itemków
![hp](images/hp.png)
oraz dynamiczne poruszanie się statku podczas skrętów, lotów w górę i w dół oraz na ukos
## Skład zespołu
Sprite Rendering
- Mateusz Kantorski
- Paweł Felcyn
- Wojciech Goralewski

224
grk/.gitignore vendored
View File

@ -1,224 +0,0 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
./Debug
./.vs
# Build results
# Roslyn cache directories
*.ide/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
#NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
*.idb
*.tlog
*.exe
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding addin-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# If using the old MSBuild-Integrated Package Restore, uncomment this:
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# =========================
# Operating System Files
# =========================
# OSX
# =========================
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# Windows
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp

Binary file not shown.

Binary file not shown.

View File

@ -1,90 +0,0 @@
#include "glm.hpp"
#include "src/Shader_Loader.h"
#include <vector>
#include "GameEntity.h"
#pragma once
class Bullet
{
private:
float speed;
float lifetime;
glm::vec3 directionNormalized;
glm::vec3 startPosition;
float birthTime;
float scale;
//GLuint program;
Core::RenderContext renderContext;
float getAge(float time) {
return time - birthTime;
}
Bullet(float speed, float lifetime, glm::vec3 directionNormalized, glm::vec3 startPosition, float birthTime, Core::RenderContext renderContext, float scale){
this->speed = speed;
this->lifetime = lifetime;
this->directionNormalized = directionNormalized;
this->startPosition = startPosition;
this->birthTime = birthTime;
this->renderContext = renderContext;
this->scale = scale;
}
public:
static Bullet* createSimpleBullet(glm::vec3 directionNormalized, glm::vec3 startPosition, float birthTime) {
static bool simpleRenderContextLoaded;
static Core::RenderContext simpleRenderContext;
if (!simpleRenderContextLoaded) {
simpleRenderContextLoaded = true;
Core::loadModelToContext("./models/sphere.obj", simpleRenderContext);
}
return new Bullet(10, 10, directionNormalized, startPosition, birthTime, simpleRenderContext, 0.01f);
}
bool shouldBeDestroyed(float time, GLuint program, std::vector<GameEntity*>& gameEntities, float attackerDmg) {
float age = getAge(time);
if (age > lifetime) {
return true;
}
glm::mat4 modelMatrix = glm::translate(glm::mat4(1.0f), startPosition) * glm::translate(directionNormalized * speed * age) * glm::scale(glm::vec3(scale));
Core::drawObjectPBR(renderContext, modelMatrix, glm::vec3(1.f, 0.f, 0.f), 0.3, 0, program);
//std::cout << "x: " << modelMatrix[3].x << std::endl;
//std::cout << "y: " << modelMatrix[3].y << std::endl;
//std::cout << "z: " << modelMatrix[3].z << std::endl;
if (checkCollisionWithGameEntities(gameEntities, modelMatrix, attackerDmg)) {
return true;
}
return false;
}
bool checkCollisionWithGameEntities(std::vector<GameEntity*>& gameEntities, glm::mat4 bulletModelMatrix, float attackerDmg) {
for (const auto& entity : gameEntities) {
glm::mat4 entityModelMatrix = entity->getModelMatrix();
if (checkAABBCollision(bulletModelMatrix, entityModelMatrix)) {
entity->applyDamage(attackerDmg);
return true;
}
}
return false;
}
bool checkAABBCollision(const glm::mat4& obj1ModelMatrix, const glm::mat4& obj2ModelMatrix) {
glm::vec3 obj1Min = glm::vec3(obj1ModelMatrix * glm::vec4(-0.5f, -0.5f, -0.5f, 1.0f));
glm::vec3 obj1Max = glm::vec3(obj1ModelMatrix * glm::vec4(0.5f, 0.5f, 0.5f, 1.0f));
glm::vec3 obj2Min = glm::vec3(obj2ModelMatrix * glm::vec4(-0.5f, -0.5f, -0.5f, 1.0f));
glm::vec3 obj2Max = glm::vec3(obj2ModelMatrix * glm::vec4(0.5f, 0.5f, 0.5f, 1.0f));
// SprawdŸ kolizjê wzd³u¿ trzech osi (x, y, z)
bool collisionX = obj1Max.x >= obj2Min.x && obj1Min.x <= obj2Max.x;
bool collisionY = obj1Max.y >= obj2Min.y && obj1Min.y <= obj2Max.y;
bool collisionZ = obj1Max.z >= obj2Min.z && obj1Min.z <= obj2Max.z;
// Kolizja wystêpuje tylko wtedy, gdy zachodzi kolizja na wszystkich trzech osiach
return collisionX && collisionY && collisionZ;
}
};

BIN
grk/project/Debug/Box.obj Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
grk/project/Debug/SOIL.obj Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\Users\KOMP\Documents\projekt_grafika_komputerowa\grafika_komputerowa\grk\Debug\grk-project.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
<SatelliteDlls />
<NonRecipeFileRefs />
</Project>

Binary file not shown.

Binary file not shown.

BIN
grk/project/Debug/main.obj Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,108 +0,0 @@
#include "glm.hpp"
#include "ext.hpp"
#include "src/Render_Utils.h"
#include "Bullet.h"
#include "./GameEntity.h"
#include "Spaceship.h"
#pragma once
class Enemy : public GameEntity
{
private:
std::list<Bullet*> bullets;
float lastShootTime = 0.f;
float shootInterval = 0.3f;
float initAggroRange;
public:
glm::mat4 modelMatrix;
float aggroRange;
glm::mat4 initialModelMatrix;
Enemy(float currHp,float initialHp, glm::mat4 initialModelMatrix, float initialDmg, float initialAggroRange)
:
aggroRange(initialAggroRange),
modelMatrix(initialModelMatrix),
initialModelMatrix(initialModelMatrix),
initAggroRange(initialAggroRange),
GameEntity(currHp, initialHp, initialDmg)
{}
virtual ~Enemy() = default;
virtual void attack(const glm::vec3& shipPos, float time) {
if (isInAggroRange(shipPos)) {
requestShoot(time);
}
}
virtual bool isAlive() const {
if (this->currentHP <= 0) {
return false;
}
return true;
}
virtual bool isInAggroRange(const glm::vec3& shipPos) const {
float distanceFromShip = glm::length(shipPos - glm::vec3(this->modelMatrix[3]));
if (distanceFromShip > this->aggroRange) {
return false;
}
return true;
}
void renderBullets(float time, GLuint program, std::vector<GameEntity*>& gameEntities) {
for (auto it = bullets.begin(); it != bullets.end();) {
Bullet* bullet = *it;
if (bullet->shouldBeDestroyed(time, program, gameEntities, dmg)) {
delete bullet;
it = bullets.erase(it);
}
else {
it++;
}
}
}
glm::vec3 getPosition() const override
{
return modelMatrix[3];
}
glm::mat4 getModelMatrix() override
{
return modelMatrix;
}
void respawn() override {
this->currentHP = this->maxHP;
this->modelMatrix = this->initialModelMatrix;
this->aggroRange = this->initAggroRange;
this->dmg = this->initDMG;
return;
}
void heal() override {
this->currentHP = this->currentHP + 5.0f;
}
private:
void requestShoot(float time) {
if (canShoot(time)) {
shoot(time);
}
}
bool canShoot(float time) {
return this->lastShootTime == 0 || time - this->lastShootTime > this->shootInterval;
}
void shoot(float time) {
Spaceship* spaceship = Spaceship::getInstance();
//glm::vec3 bulletDirection = glm::normalize(spaceship->spaceshipPos - glm::vec3(modelMatrix[3]));
glm::vec3 bulletDirection = glm::normalize(glm::vec3(spaceship->getModelMatrix()[3]) - glm::vec3(modelMatrix[3]));
//bulletDirection += glm::linearRand(glm::vec3(-0.01f), glm::vec3(0.1f)); // Modyfikacja kierunku o losowy szum
this->bullets.push_back(Bullet::createSimpleBullet(bulletDirection, this->modelMatrix[3], time));
this->lastShootTime = time;
}
};

View File

@ -1,33 +0,0 @@
#include "glm.hpp"
#pragma once
class GameEntity
{
public:
float currentHP;
float dmg;
float maxHP;
float initDMG;
GameEntity(float currentHP, float maxHP, float initialDmg)
: currentHP(currentHP), maxHP(maxHP), dmg(initialDmg), initDMG(initialDmg)
{
}
virtual void applyDamage(float attackerDmg) {
currentHP = currentHP - attackerDmg;
};
virtual glm::vec3 getPosition() const = 0;
virtual glm::mat4 getModelMatrix() = 0;
virtual bool isAlive() {
if (this->currentHP <= 0) {
return false;
}
return true;
};
virtual void respawn() = 0;
virtual void heal() = 0;
};

View File

@ -1 +0,0 @@
#include "GameObject.h"

View File

@ -1,9 +0,0 @@
#include "glm.hpp"
#pragma once
class GameObject
{
public:
virtual glm::mat4 getPositionMatrix() = 0;
};

View File

@ -1,50 +1,17 @@
#include <list>
#include "Sun.h"
#include "Bullet.h"
#include "src/Shader_Loader.h"
#include "ParticleSystem.h"
#pragma once
class GameUtils
{
private:
// Private constructor to prevent external instantiation
GameUtils() : aspectRatio(1.f)
{
this->suns = new std::list<Sun*>();
this->shaderLoader = new Core::Shader_Loader();
this->particleSystems = new std::list<ParticleSystem*>();
}
std::list<Sun*>* suns;
std::list<Bullet*> bullets;
std::list<ParticleSystem*>* particleSystems;
float aspectRatio;
// Private constructor to prevent external instantiation
GameUtils() : aspectRatio(1.f) {}
public:
Core::Shader_Loader* shaderLoader;
Core::RenderContext sphereContext;
float aspectRatio;
float getAspectRatio() {
return aspectRatio;
}
void setAspectRatio(float value) {
aspectRatio = value;
}
std::list<Sun*>* getSuns() {
return suns;
}
std::list<ParticleSystem*>* getParticleSystems() {
return particleSystems;
}
static GameUtils* getInstance()
static GameUtils& getInstance()
{
static GameUtils instance; // Jedna i jedyna instancja
return &instance;
return instance;
}
};

View File

@ -1,55 +0,0 @@
#include "glm.hpp"
#include "ext.hpp"
#include "src/Render_Utils.h"
#include "./GameEntity.h"
#include "Spaceship.h"
#pragma once
class Heart : public GameEntity
{
public:
glm::mat4 modelMatrix;
glm::mat4 initialModelMatrix;
float healAmount = 10;
bool isCollected;
Heart(glm::mat4 initialModelMatrix, float healAmount)
:
modelMatrix(initialModelMatrix),
initialModelMatrix(initialModelMatrix),
healAmount(healAmount),
isCollected(false),
GameEntity(1, 1, 0)
{}
virtual ~Heart() = default;
virtual bool isAlive() {
if (this->currentHP <= 0) {
isCollected = true;
return false;
}
return true;
}
glm::vec3 getPosition() const override
{
return modelMatrix[3];
}
glm::mat4 getModelMatrix() override
{
return modelMatrix;
}
void respawn() override {
this->currentHP = this->maxHP;
this->modelMatrix = this->initialModelMatrix;
return;
}
void heal() override {
this->currentHP = this->currentHP + 5.0f;
}
};

View File

@ -1,55 +0,0 @@
#include "glm.hpp"
#include "ext.hpp"
#include "src/Render_Utils.h"
#include "./GameEntity.h"
#include "Spaceship.h"
#pragma once
class Nitro : public GameEntity
{
public:
glm::mat4 modelMatrix;
glm::mat4 initialModelMatrix;
float healAmount = 10;
bool isCollected;
Nitro(glm::mat4 initialModelMatrix, float healAmount)
:
modelMatrix(initialModelMatrix),
initialModelMatrix(initialModelMatrix),
healAmount(healAmount),
isCollected(false),
GameEntity(1, 1, 0)
{}
virtual ~Nitro() = default;
virtual bool isAlive() {
if (this->currentHP <= 0) {
isCollected = true;
return false;
}
return true;
}
glm::vec3 getPosition() const override
{
return modelMatrix[3];
}
glm::mat4 getModelMatrix() override
{
return modelMatrix;
}
void respawn() override {
this->currentHP = this->maxHP;
this->modelMatrix = this->initialModelMatrix;
return;
}
void heal() override {
this->currentHP = this->currentHP + 5.0f;
}
};

View File

@ -1,143 +0,0 @@
#pragma once
#include "glew.h"
#include <GLFW/glfw3.h>
#include "glm.hpp"
#include <list>
#include "ext.hpp"
struct Particle
{
public:
float birthTime;
glm::vec3 startPosition;
glm::vec3 direction;
glm::vec3 randomPointOnCircle;
float getAge(float time) {
return time - birthTime;
}
};
class ParticleSystem
{
private:
std::list<Particle> particles;
GLuint VBO;
GLuint VAO;
GLfloat vertices[9];
float lastGenerated = -1.f;
bool shouldGenerateNewParticle(float time) {
return lastGenerated == -1.f || time - lastGenerated > generationInterval;
}
glm::vec3 generateRandomPointOnCircle() {
float distanceFromCenter = static_cast <float> (rand()) / static_cast <float> (RAND_MAX/sourceRadius);
float radians = static_cast <float> (rand()) / static_cast <float> (RAND_MAX / 6.28f);
glm::vec3 referenceVector(0.0f, 1.0f, 0.0f);
glm::vec3 output = glm::normalize(glm::cross(sourceDirection, referenceVector)) * distanceFromCenter;
glm::mat4 rotationMatrix = glm::rotate(glm::mat4(1.0f), radians, sourceDirection);
output = glm::vec3(rotationMatrix * glm::vec4(output, 1.0f));
return output;
}
void generateNewParticle(float time) {
Particle newParticle;
newParticle.birthTime = time;
newParticle.startPosition = sourcePosition;
newParticle.randomPointOnCircle = generateRandomPointOnCircle();
newParticle.direction = sourceDirection;
particles.push_back(newParticle);
lastGenerated = time;
}
void deleteOld(float time) {
auto it = particles.begin();
while (it != particles.end()) {
if ((*it).getAge(time) > lifetime) {
it = particles.erase(it);
}
else {
++it;
}
}
}
glm::vec3 calculateParticleColor(float age) {
float rate = glm::clamp(age / lifetime, 0.f, 1.f);
glm::vec3 mixedColor = (1.0f - rate) * startColor + rate * endColor;
return mixedColor;
}
public:
glm::vec3 sourcePosition;
float sourceRadius = 0.02f;
glm::vec3 sourceDirection = glm::vec3(1.f, 0.f, 0.f);
float generationInterval = 0.0025f;
float lifetime = 0.5f;
float speed = 100.f;
glm::vec3 startColor = glm::vec3(1.f, 0.f, 0.f);
glm::vec3 endColor = glm::vec3(1.f, 1.f, 0.f);
ParticleSystem() {
// Inicjalizacja wierzcho³ków trójk¹ta w 3D
vertices[0] = -0.5f; vertices[1] = -0.5f; vertices[2] = 0.0f;
vertices[3] = 0.5f; vertices[4] = -0.5f; vertices[5] = 0.0f;
vertices[6] = 0.0f; vertices[7] = 0.5f; vertices[8] = 0.0f;
glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
glGenVertexArrays(1, &VAO);
glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), (void*)0);
glEnableVertexAttribArray(0);
glBindVertexArray(0);
}
void drawParticles(GLuint program, glm::mat4 view, glm::mat4 projection, glm::mat4 modelSrc, float time) {
if (shouldGenerateNewParticle(time)) {
generateNewParticle(time);
}
deleteOld(time);
glUseProgram(program);
GLuint modelLoc = glGetUniformLocation(program, "model");
GLuint viewLoc = glGetUniformLocation(program, "view");
GLuint projectionLoc = glGetUniformLocation(program, "projection");
GLuint colorLoc = glGetUniformLocation(program, "color");
int i = 0;
for (auto particle : particles) {
glm::vec3 color = calculateParticleColor(particle.getAge(time));
glUniform3f(colorLoc, color.x, color.y, color.z);
glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(view));
glUniformMatrix4fv(projectionLoc, 1, GL_FALSE, glm::value_ptr(projection));
glm::mat4 model = glm::translate(glm::mat4(1), sourcePosition + particle.randomPointOnCircle);
model = model * modelSrc;
model = glm::scale(model, glm::vec3(0.005f, 0.005f, 0.005f));
model = glm::translate(model, particle.direction * speed * (time - particle.birthTime));
glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));
glBindVertexArray(VAO);
glDrawArrays(GL_TRIANGLES, 0, 3);
i++;
}
glBindVertexArray(0);
}
};

View File

@ -1 +0,0 @@
#include "Planet.h"

View File

@ -1,56 +0,0 @@
#include "./GameObject.h"
#include "glm.hpp"
#include "ext.hpp"
#include "src/Render_Utils.h"
#pragma once
class Planet : public GameObject
{
private:
GameObject* center;
float distanceFromCenter;
float rotationSpeed;
Core::RenderContext sphereContext;
float scale;
glm::vec3 position;
glm::mat4 positionMatrix;
GLuint textureID;
GLuint normalMapID;
float startEulerYRotation = 0.f;
float startYMovement = 0.f;
public:
Planet(GameObject* center, float distanceFromCenter, float rotationSpeed, float scale, Core::RenderContext sphereContext, GLuint textureID, GLuint normalMapID) {
this->center = center;
this->distanceFromCenter = distanceFromCenter;
this->rotationSpeed = rotationSpeed;
this->sphereContext = sphereContext;
this->scale = scale;
this->position = glm::vec3(0);
this->textureID = textureID;
this->normalMapID = normalMapID;
}
glm::mat4 getPositionMatrix() override {
return positionMatrix;
}
void draw(float time, GLuint program) {
if (center == nullptr) {
return;
}
float rotationAngle = glm::radians(time * rotationSpeed);
positionMatrix = center->getPositionMatrix() * glm::eulerAngleY(time * rotationSpeed + startEulerYRotation) * glm::translate(glm::vec3(distanceFromCenter, startYMovement, 0));
glm::mat4 modelMatrix = positionMatrix * glm::scale(glm::vec3(scale));
Core::drawObjectPBRTexture(sphereContext, modelMatrix, textureID, normalMapID, 0.7, 0.0, program);
}
void setStarteulerYRotation(float radians) {
startEulerYRotation = radians;
}
void setStartYMovement(float value) {
startYMovement = value;
}
};

View File

View File

@ -1,47 +1,30 @@
#include "glm.hpp"
#include "ext.hpp"
#include <GLFW/glfw3.h>
#include <list>
#include "Bullet.h"
#include "ParticleSystem.h"
#include "GameEntity.h"
#pragma once
class Spaceship : public GameEntity
class Spaceship
{
private:
std::list<Bullet*> bullets;
float lastShootTime = 0.f;
float shootInterval = 0.3f;
ParticleSystem* leftParticle;
ParticleSystem* rightParticle;
// Prywatny konstruktor, aby zapobiec zewn<77>trznemu tworzeniu instancji
Spaceship() : GameEntity(100.0f, 100.0f, 10.0f)
{
}
// Prywatny konstruktor, aby zapobiec zewnêtrznemu tworzeniu instancji
Spaceship() {}
// Prywatny destruktor, aby zapobiec przypadkowemu usuwaniu instancji
~Spaceship() {}
public:
static Spaceship* getInstance()
static Spaceship& getInstance()
{
static Spaceship instance; // Jedna i jedyna instancja
return &instance;
return instance;
}
glm::vec3 color = glm::vec3(0.3, 0.3, 0.5);
float roughness = 0.5;
float metallic = 0.6;
float turbo = 1.0f;
float turboMAX = 1.0f;
float roughness = 0.2;
float metallic = 1.0;
glm::vec3 spaceshipPos = glm::vec3(4.065808f, 10.250000f, -20.189549f);
glm::vec3 spaceshipPos = glm::vec3(0.065808f, 1.250000f, -2.189549f);
glm::vec3 spaceshipDir = glm::vec3(-0.490263f, 0.000000f, 0.871578f);
glm::vec3 spotlightPos = glm::vec3(0, 0, 0);
@ -51,259 +34,53 @@ public:
glm::vec3 cameraPos = glm::vec3(0.479490f, 1.250000f, -2.124680f);
glm::vec3 cameraDir = glm::vec3(-0.354510f, 0.000000f, 0.935054f);
glm::vec3 cameraPosHUDBar = cameraPos;
glm::mat4 additionalHorRotationMatrix;
glm::mat4 additionalVerRotationMatrix;
glm::mat4 calculateModelMatrix() {
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
glm::mat4 spaceshipCameraRotationMatrix = glm::mat4({
spaceshipSide.x, spaceshipSide.y, spaceshipSide.z, 0,
spaceshipUp.x, spaceshipUp.y, spaceshipUp.z, 0,
-spaceshipDir.x, -spaceshipDir.y, -spaceshipDir.z, 0,
0., 0., 0., 1.
glm::mat4 specshipCameraRotrationMatrix = glm::mat4({
spaceshipSide.x,spaceshipSide.y,spaceshipSide.z,0,
spaceshipUp.x,spaceshipUp.y,spaceshipUp.z ,0,
-spaceshipDir.x,-spaceshipDir.y,-spaceshipDir.z,0,
0.,0.,0.,1.,
});
float additionalVerRotationAngle = glm::radians(currentShipVerAngle);
additionalVerRotationMatrix = glm::rotate(glm::mat4(1.0f), additionalVerRotationAngle, glm::vec3(1.f, 0.f, 0.f));
float additionalHorRotationAngle = glm::radians(currentShipHorAngle);
additionalHorRotationMatrix = glm::rotate(glm::mat4(1.0f), additionalHorRotationAngle, glm::vec3(0.f, 0.2f, 1.f));
glm::mat4 modelMatrix = glm::translate(spaceshipPos) * spaceshipCameraRotationMatrix * additionalVerRotationMatrix * additionalHorRotationMatrix * glm::eulerAngleY(glm::pi<float>()) * glm::scale(glm::vec3(0.02f));
return modelMatrix;
return glm::translate(spaceshipPos) * specshipCameraRotrationMatrix * glm::eulerAngleY(glm::pi<float>()) * glm::scale(glm::vec3(0.03f));
}
void setPerticlesParameters(float speed, float generationInterval) {
leftParticle->speed = speed;
leftParticle->generationInterval = generationInterval;
rightParticle->speed = speed;
rightParticle->generationInterval = generationInterval;
}
const float fromCameraDirHorizontalStateToStateTime = 0.2f;
const float CAMERA_DISTANCE_STATIC_HOR = 0.7f;
const float CAMERA_DISTANCE_SLOW_HOR = 0.85f;
const float CAMERA_DISTANCE_FAST_HOR = 1.f;
float currentCameraDistanceHor = CAMERA_DISTANCE_STATIC_HOR;
float targetCameraDistanceHor = CAMERA_DISTANCE_STATIC_HOR;
int currentWState = 0;
int currentShiftState = 0;
float calculateCameraDistanceHor(int wState, int shiftState, float time) {
currentWState = wState;
currentShiftState = shiftState;
if (currentWState == 1 && currentShiftState == 0) {
targetCameraDistanceHor = CAMERA_DISTANCE_SLOW_HOR;
}
else if (currentWState == 1 && currentShiftState == 1) {
targetCameraDistanceHor = CAMERA_DISTANCE_FAST_HOR;
}
else {
targetCameraDistanceHor = CAMERA_DISTANCE_STATIC_HOR;
}
float diff = targetCameraDistanceHor - currentCameraDistanceHor;
float step = diff / fromCameraDirHorizontalStateToStateTime * time;
currentCameraDistanceHor += step;
return currentCameraDistanceHor;
}
const float fromCameraDirVerticalStateToStateTime = 0.2f;
const float CAMERA_DISTANCE_STATIC_VER = 0.2f;
const float CAMERA_DISTANCE_SLOW_VER = 0.25f;
const float CAMERA_DISTANCE_FAST_VER = 0.3f;
float currentCameraDistanceVer = CAMERA_DISTANCE_STATIC_VER;
float targetCameraDistanceVer = CAMERA_DISTANCE_STATIC_VER;
float calculateCameraDistanceVer(float time) {
if (currentWState == 1 && currentShiftState == 0) {
targetCameraDistanceVer = CAMERA_DISTANCE_SLOW_VER;
}
else if (currentWState == 1 && currentShiftState == 1) {
targetCameraDistanceVer = CAMERA_DISTANCE_FAST_VER;
}
else {
targetCameraDistanceVer = CAMERA_DISTANCE_STATIC_VER;
}
float diff = targetCameraDistanceVer - currentCameraDistanceVer;
float step = diff / fromCameraDirVerticalStateToStateTime * time;
currentCameraDistanceVer += step;
return currentCameraDistanceVer;
}
const float MAX_VERTICAL_ANGLE = 15.f;
float currentShipVerAngle = 0.f;
float targetShipVerAngle = 0.f;
int currentQState = 0;
int currentEState = 0;
float calculateShipAngleVer(int qState, int eState, float time) {
currentQState = qState;
currentEState = eState;
if (currentQState == 1) {
targetShipVerAngle = MAX_VERTICAL_ANGLE;
}
else if (currentEState == 1) {
targetShipVerAngle = -MAX_VERTICAL_ANGLE;
}
else {
targetShipVerAngle = 0.f;
}
float diff = targetShipVerAngle - currentShipVerAngle;
float step = diff / 0.2f * time;
currentShipVerAngle += step;
return currentShipVerAngle;
}
const float MAX_HORIZONTALL_ANGLE = 15.f;
float currentShipHorAngle = 0.f;
float targetShipHorAngle = 0.f;
int currentAState = 0;
int currentDState = 0;
float calculateShipAngleHor(int aState, int dState, float time) {
currentAState = aState;
currentDState = dState;
if (currentAState == 1) {
targetShipHorAngle = MAX_HORIZONTALL_ANGLE;
}
else if (currentDState == 1) {
targetShipHorAngle = -MAX_HORIZONTALL_ANGLE;
}
else {
targetShipHorAngle = 0.f;
}
float diff = targetShipHorAngle - currentShipHorAngle;
float step = diff / 0.2f * time;
currentShipHorAngle += step;
return currentShipHorAngle;
}
void processInput(GLFWwindow* window, float deltaTime, float time) {
static bool mouseButtonCallbackSet = false;
if (!mouseButtonCallbackSet) {
}
void processInput(GLFWwindow* window, float deltaTime) {
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
glm::vec3 spaceshipUp = glm::vec3(0.f, 1.f, 0.f);
float angleSpeed = 0.05f * deltaTime * 60;
float moveSpeed = 0.05f * deltaTime * 60;
int w = glfwGetKey(window, GLFW_KEY_W);
int s = glfwGetKey(window, GLFW_KEY_S);
int shiftState = glfwGetKey(window, GLFW_KEY_LEFT_SHIFT);
int qState = glfwGetKey(window, GLFW_KEY_Q);
int eState = glfwGetKey(window, GLFW_KEY_E);
int aState = glfwGetKey(window, GLFW_KEY_A);
int dState = glfwGetKey(window, GLFW_KEY_D);
calculateShipAngleVer(qState, eState, deltaTime);
calculateShipAngleHor(aState, dState, deltaTime);
//spaceshipDir = glm::vec3(glm::eulerAngleX(verticalAngle) * glm::vec4(spaceshipDir, 0));
if (w == GLFW_PRESS) {
if (shiftState == GLFW_PRESS) {
turbo = glm::max(0.0f, turbo - 0.003f * deltaTime * 60);
if (turbo == 0.0f) {
shiftState = GLFW_RELEASE;
moveSpeed = 0.05f * deltaTime * 60;
setPerticlesParameters(100.f, 0.000001f);
}
else {
moveSpeed *= 2;
setPerticlesParameters(200.f, 0.0000005f);
}
}
else {
setPerticlesParameters(100.f, 0.000001f);
turbo = glm::min(turboMAX, turbo + 0.001f * deltaTime * 60);
}
}
else {
setPerticlesParameters(50.f, 0.0002f);
turbo = glm::min(turboMAX, turbo + 0.005f * deltaTime * 60);
}
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) {
glfwSetWindowShouldClose(window, true);
}
if (w == GLFW_PRESS)
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
spaceshipPos += spaceshipDir * moveSpeed;
if (s == GLFW_PRESS)
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
spaceshipPos -= spaceshipDir * moveSpeed;
if (glfwGetKey(window, GLFW_KEY_X) == GLFW_PRESS)
spaceshipPos += spaceshipSide * moveSpeed;
if (glfwGetKey(window, GLFW_KEY_Z) == GLFW_PRESS)
spaceshipPos -= spaceshipSide * moveSpeed;
if (qState == GLFW_PRESS)
if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS)
spaceshipPos += spaceshipUp * moveSpeed;
if (eState == GLFW_PRESS)
if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS)
spaceshipPos -= spaceshipUp * moveSpeed;
if (aState == GLFW_PRESS)
if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)
spaceshipDir = glm::vec3(glm::eulerAngleY(angleSpeed) * glm::vec4(spaceshipDir, 0));
if (dState == GLFW_PRESS)
if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)
spaceshipDir = glm::vec3(glm::eulerAngleY(-angleSpeed) * glm::vec4(spaceshipDir, 0));
if (glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS)
requestShoot(time);
cameraPos = spaceshipPos - calculateCameraDistanceHor(w, shiftState, deltaTime) * spaceshipDir + glm::vec3(0, calculateCameraDistanceVer(deltaTime), 0);
cameraPosHUDBar = spaceshipPos - 1.f * spaceshipDir + glm::vec3(0, 1, 0) * 0.2f;
cameraPos = spaceshipPos - 0.5 * spaceshipDir + glm::vec3(0, 1, 0) * 0.2f;
cameraDir = spaceshipDir;
glm::vec3 perpendicularVector = 0.08f * glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.0f, 1.0f, 0.0f)));
if (leftParticle != nullptr && rightParticle != nullptr) {
leftParticle->sourcePosition = spaceshipPos + perpendicularVector - (0.25f * spaceshipDir);
rightParticle->sourcePosition = spaceshipPos - perpendicularVector - (0.25f * spaceshipDir);
leftParticle->sourceDirection = -spaceshipDir;
rightParticle->sourceDirection = -spaceshipDir;
}
spotlightPos = spaceshipPos + 0.2 * spaceshipDir;
spotlightConeDir = spaceshipDir;
}
void renderParticles(GLuint program, glm::mat4 view, glm::mat4 projection, float time) {
if (leftParticle != nullptr && rightParticle != nullptr) {
glm::mat4 modelSrc = additionalVerRotationMatrix * additionalHorRotationMatrix;
leftParticle->drawParticles(program, view, projection, modelSrc, time);
rightParticle->drawParticles(program, view, projection, modelSrc, time);
}
}
void createParticles() {
if (leftParticle != nullptr && rightParticle != nullptr) {
delete leftParticle;
delete rightParticle;
}
leftParticle = new ParticleSystem();
rightParticle = new ParticleSystem();
}
glm::mat4 createCameraMatrix()
{
glm::vec3 cameraSide = glm::normalize(glm::cross(cameraDir, glm::vec3(0.f, 1.f, 0.f)));
@ -319,87 +96,4 @@ public:
return cameraMatrix;
}
void renderBullets(float time, GLuint program, std::vector<GameEntity*>& gameEntities) {
for (auto it = bullets.begin(); it != bullets.end();) {
Bullet* bullet = *it;
if (bullet->shouldBeDestroyed(time, program, gameEntities, dmg)) {
delete bullet;
it = bullets.erase(it);
}
else {
it++;
}
}
}
void requestShoot(float time) {
if (canShoot(time)) {
shoot(time);
}
}
bool canShoot(float time) {
return lastShootTime == 0 || time - lastShootTime > shootInterval;
}
void shoot(float time) {
glm::vec3 perpendicularVector = 0.25f * glm::normalize(glm::cross(cameraDir, glm::vec3(0.0f, 1.0f, 0.0f)));
glm::vec3 dir = glm::vec4(spaceshipDir.x, spaceshipDir.y, spaceshipDir.z, 1.f) * additionalVerRotationMatrix * additionalHorRotationMatrix;
bullets.push_back(Bullet::createSimpleBullet(dir, spaceshipPos - perpendicularVector, time));
bullets.push_back(Bullet::createSimpleBullet(dir, spaceshipPos + perpendicularVector, time));
lastShootTime = time;
}
glm::vec3 getPosition() const override {
return spaceshipPos;
}
glm::mat4 getModelMatrix() override {
return calculateModelMatrix();
}
glm::mat4 calculateModelMatrixForHUDBar() {
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
glm::mat4 spaceshipCameraRotationMatrix = glm::mat4({
spaceshipSide.x, spaceshipSide.y, spaceshipSide.z, 0,
spaceshipUp.x, spaceshipUp.y, spaceshipUp.z, 0,
-spaceshipDir.x, -spaceshipDir.y, -spaceshipDir.z, 0,
0., 0., 0., 1.
});
return glm::translate(spaceshipPos) * spaceshipCameraRotationMatrix * glm::eulerAngleY(glm::pi<float>()) * glm::scale(glm::vec3(0.02f));
}
glm::mat4 createCameraMatrixForHUDBar()
{
glm::vec3 cameraSide = glm::normalize(glm::cross(cameraDir, glm::vec3(0.f, 1.f, 0.f)));
glm::vec3 cameraUp = glm::normalize(glm::cross(cameraSide, cameraDir));
glm::mat4 cameraRotrationMatrix = glm::mat4({
cameraSide.x,cameraSide.y,cameraSide.z,0,
cameraUp.x,cameraUp.y,cameraUp.z ,0,
-cameraDir.x,-cameraDir.y,-cameraDir.z,0,
0.,0.,0.,1.,
});
cameraRotrationMatrix = glm::transpose(cameraRotrationMatrix);
glm::mat4 cameraMatrix = cameraRotrationMatrix * glm::translate(-cameraPosHUDBar);
return cameraMatrix;
}
void respawn() override {
this->currentHP = this->maxHP;
this->turbo = this->turboMAX;
this->spaceshipPos = glm::vec3(4.065808f, 10.250000f, -20.189549f);
return;
}
void heal() override {
this->currentHP = this->currentHP + 3.f;
}
void turboBoost() {
this->turbo = this->turboMAX;
}
};

View File

@ -1,143 +0,0 @@
#include "SpriteRenderer.h"
#include <iostream>
Core::SpriteRenderer::SpriteRenderer()
{
this->initRenderData();
}
Core::SpriteRenderer::~SpriteRenderer()
{
glDeleteVertexArrays(1, &this ->VAO);
glDeleteBuffers(1, &this->VBO);
glDeleteBuffers(1, &this->EBO);
}
void Core::SpriteRenderer::DrawHUDBar(const glm::vec3 color, const glm::mat4 modelMatrix, const float progress, GLuint program) {
Spaceship* spaceship = Spaceship::getInstance();
glm::mat4 viewProjectionMatrix = Core::createPerspectiveMatrix() * spaceship->createCameraMatrixForHUDBar();
// Kombinuj macierze transformacji
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
// Przeka¿ macierze do shadera
glUniformMatrix4fv(glGetUniformLocation(program, "transformation"), 1, GL_FALSE, glm::value_ptr(transformation));
glUniformMatrix4fv(glGetUniformLocation(program, "modelMatrix"), 1, GL_FALSE, glm::value_ptr(modelMatrix));
glUniform3fv(glGetUniformLocation(program, "activeColor"), 1, glm::value_ptr(color));
glUniform1f(glGetUniformLocation(program, "progress"), progress);
glBindVertexArray(this->VAO);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
glBindVertexArray(0);
};
void Core::SpriteRenderer::DrawSpriteBar(const glm::vec3 color, const glm::mat4 modelMatrix,const float progress, GLuint program) {
Spaceship* spaceship = Spaceship::getInstance();
// Pobierz pozycjê kamery
glm::vec3 cameraPosition = spaceship->cameraPos;
glm::vec3 spritePosition = glm::vec3(modelMatrix[3]);
// Oblicz wektor skierowany od sprita do kamery
glm::vec3 spriteToCamera = glm::normalize(cameraPosition - spritePosition);
// Oblicz k¹t rotacji w stopniach wokó³ osi Y
float angle = glm::degrees(atan2(spriteToCamera.x, spriteToCamera.z));
// Utwórz macierz rotacji wok³ osi Y
glm::mat4 rotationMatrix = glm::rotate(glm::mat4(1.0f), glm::radians(angle), glm::vec3(0.0f, 1.0f, 0.0f));
// Utwórz macierz widoku-projekcji
glm::mat4 viewProjectionMatrix = Core::createPerspectiveMatrix() * spaceship->createCameraMatrix();
// Kombinuj macierze transformacji
glm::mat4 transformation = viewProjectionMatrix * modelMatrix * rotationMatrix;
// Przeka¿ macierze do shadera
glUniformMatrix4fv(glGetUniformLocation(program, "transformation"), 1, GL_FALSE, glm::value_ptr(transformation));
glUniformMatrix4fv(glGetUniformLocation(program, "modelMatrix"), 1, GL_FALSE, glm::value_ptr(modelMatrix));
glUniform3fv(glGetUniformLocation(program, "activeColor"), 1, glm::value_ptr(color));
glUniform1f(glGetUniformLocation(program, "progress"), progress);
glBindVertexArray(this->VAO);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
glBindVertexArray(0);
};
void Core::SpriteRenderer::DrawSprite(GLuint spriteTexture, const glm::mat4 modelMatrix, GLuint program) {
Spaceship* spaceship = Spaceship::getInstance();
// Pobierz pozycjê kamery
glm::vec3 cameraPosition = spaceship->cameraPos;
glm::vec3 spritePosition = glm::vec3(modelMatrix[3]);
// Oblicz wektor skierowany od sprita do kamery
glm::vec3 spriteToCamera = glm::normalize(cameraPosition - spritePosition);
// Oblicz k¹t rotacji w stopniach wokó³ osi Y
float angle = glm::degrees(atan2(spriteToCamera.x, spriteToCamera.z));
// Utwórz macierz rotacji wok³ osi Y
glm::mat4 rotationMatrix = glm::rotate(glm::mat4(1.0f), glm::radians(angle), glm::vec3(0.0f, 1.0f, 0.0f));
// Utwórz macierz widoku-projekcji
glm::mat4 viewProjectionMatrix = Core::createPerspectiveMatrix() * spaceship->createCameraMatrix();
// Kombinuj macierze transformacji
glm::mat4 transformation = viewProjectionMatrix * modelMatrix * rotationMatrix;
// Przeka¿ macierze do shadera
glUniformMatrix4fv(glGetUniformLocation(program, "transformation"), 1, GL_FALSE, glm::value_ptr(transformation));
glUniformMatrix4fv(glGetUniformLocation(program, "modelMatrix"), 1, GL_FALSE, glm::value_ptr(modelMatrix));
Core::SetActiveTexture(spriteTexture, "colorTexture", program, 0);
glBindVertexArray(this->VAO);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
glBindVertexArray(0);
}
void Core::SpriteRenderer::initRenderData()
{
// Definicja wierzcho³ków kwadratu
float vertices[] = {
// Postions //colors // texture coordiantes
-0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // Left down
-0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,1.0f, // Left up
0.5f, 0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,// Right up
0.5f, -0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f,0.0f// Right down
};
// Definicja indeksów wierzcho³ków dla kwadratu
unsigned int indices[] = {
0, 2, 1, // Upper triangle
0, 3, 2 // Lower triangle
};
glGenVertexArrays(1, &this->VAO);
glGenBuffers(1, &this->VBO);
glGenBuffers(1, &this->EBO);
glBindVertexArray(this->VAO);
// Wype³nij bufor wierzcho³ków
glBindBuffer(GL_ARRAY_BUFFER, this->VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
// Wype³nij bufor indeksów
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->EBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);
glEnableVertexAttribArray(1);
// Konfiguracja atrybutu koordynatow kolorow
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));
glEnableVertexAttribArray(2);
// Konfiguracja atrybutu koordynatow tekstury
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));
glBindVertexArray(0);
}

View File

@ -1,27 +0,0 @@
#include "src/Render_Utils.h"
#include "src/Texture.h"
#include "Spaceship.h"
#pragma once
namespace Core {
class SpriteRenderer
{
public:
SpriteRenderer();
~SpriteRenderer();
void DrawSprite(GLuint spriteTexture, const glm::mat4 modelMatrix, GLuint program);
void DrawSpriteBar(const glm::vec3 color, const glm::mat4 modelMatrix,const float progress, GLuint program);
void DrawHUDBar(const glm::vec3 color, const glm::mat4 modelMatrix, const float progress, GLuint program);
private:
unsigned int VAO;
unsigned int VBO;
unsigned int EBO;
// Initializes and configures the quad's buffer and vertex attributes
void initRenderData();
};
}

View File

@ -1,10 +1,9 @@
#include "glm.hpp"
#include "ext.hpp"
#include "./Spaceship.h"
#include "./GameObject.h"
#pragma once
class Sun : public GameObject
class Sun
{
public:
glm::vec3 sunPos;
@ -13,44 +12,25 @@ public:
double scale;
GLuint program;
Core::RenderContext sphereContext;
glm::mat4 positionMatrix;
GLuint textureID;
Sun(GLuint program, Core::RenderContext sphereContext, glm::vec3 pos, glm::vec3 dir, GLuint textureID, glm::vec3 color, double scale) {
Sun(GLuint program, Core::RenderContext sphereContext, glm::vec3 pos, glm::vec3 dir, glm::vec3 color, double scale) {
this->program = program;
this->sphereContext = sphereContext;
this->sunPos = pos;
this->sunDir = dir;
this->sunColor = color;
this->scale = scale;
this->textureID = textureID;
}
Sun(){}
void draw() {
glUseProgram(program);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureID);
glUniform1i(glGetUniformLocation(program, "sunTexture"), 0);
glm::mat4 viewProjectionMatrix = Core::createPerspectiveMatrix() * Spaceship::getInstance()->createCameraMatrix();
positionMatrix = glm::translate(sunPos);
glm::mat4 transformation = viewProjectionMatrix * positionMatrix * glm::scale(glm::vec3(scale));
glm::mat4 viewProjectionMatrix = Core::createPerspectiveMatrix() * Spaceship::getInstance().createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * glm::translate(sunPos) * glm::scale(glm::vec3(scale));
glUniformMatrix4fv(glGetUniformLocation(program, "transformation"), 1, GL_FALSE, (float*)&transformation);
glUniform3f(glGetUniformLocation(program, "color"), sunColor.x / 2, sunColor.y / 2, sunColor.z / 2);
glUniform1f(glGetUniformLocation(program, "exposition"), 1.f);
Core::DrawContext(sphereContext);
}
glm::vec3 getPosition() {
return sunPos;
}
glm::vec3 getColor() {
return sunColor;
}
glm::mat4 getPositionMatrix() override {
return positionMatrix;
}
};

View File

@ -11,10 +11,6 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="GameObject.cpp" />
<ClCompile Include="Planet.cpp" />
<ClCompile Include="SpriteRenderer.cpp" />
<ClCompile Include="Source.cpp" />
<ClCompile Include="src\Box.cpp" />
<ClCompile Include="src\Camera.cpp" />
<ClCompile Include="src\main.cpp" />
@ -27,17 +23,8 @@
<ClCompile Include="src\Texture.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Bullet.h" />
<ClInclude Include="Enemy.h" />
<ClInclude Include="GameEntity.h" />
<ClInclude Include="GameObject.h" />
<ClInclude Include="GameUtils.h" />
<ClInclude Include="Heart.h" />
<ClInclude Include="Nitro.h" />
<ClInclude Include="ParticleSystem.h" />
<ClInclude Include="Planet.h" />
<ClInclude Include="Spaceship.h" />
<ClInclude Include="SpriteRenderer.h" />
<ClInclude Include="src\Camera.h" />
<ClInclude Include="src\ex_9_1.hpp" />
<ClInclude Include="src\objload.h" />
@ -53,22 +40,10 @@
<ClInclude Include="Sun.h" />
</ItemGroup>
<ItemGroup>
<None Include="fireball.frag" />
<None Include="fireball.vert" />
<None Include="particle.frag" />
<None Include="particle.vert" />
<None Include="shaders\shader_9_1.frag" />
<None Include="shaders\shader_9_1.vert" />
<None Include="shaders\shader_8_sun.frag" />
<None Include="shaders\shader_8_sun.vert" />
<None Include="shaders\shader_skybox.frag" />
<None Include="shaders\shader_skybox.vert" />
<None Include="shaders\shader_sprite.frag" />
<None Include="shaders\shader_sprite.vert" />
<None Include="shaders\shader_tex.frag" />
<None Include="shaders\shader_tex.vert" />
<None Include="shaders\shader_sprite_bar.frag" />
<None Include="shaders\shader_sprite_bar.vert" />
<None Include="shaders\test.frag" />
<None Include="shaders\test.vert" />
</ItemGroup>

View File

@ -51,18 +51,6 @@
<ClCompile Include="src\SOIL\image_helper.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="GameObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Planet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SpriteRenderer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Source.cpp">
<Filter>Shader Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\objload.h">
@ -110,33 +98,6 @@
<ClInclude Include="GameUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Planet.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Bullet.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Enemy.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SpriteRenderer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ParticleSystem.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameEntity.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Heart.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Nitro.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="shaders\shader_8_sun.vert">
@ -157,37 +118,5 @@
<None Include="shaders\test.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_skybox.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_skybox.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="fireball.frag" />
<None Include="fireball.vert" />
<None Include="shaders\shader_sprite.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_sprite.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_tex.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_tex.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="particle.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="particle.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_sprite_bar.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_sprite_bar.vert">
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -1,150 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shader Files">
<UniqueIdentifier>{0a247bb8-2e8e-4a90-b0ef-17415b0941ba}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\SOIL">
<UniqueIdentifier>{0af44075-33f4-4953-b1d6-1d28d61d758f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Render_Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Shader_Loader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Box.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Camera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\SOIL.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\stb_image_aug.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_DXT.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_helper.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="GameObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Planet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\objload.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Render_Utils.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Shader_Loader.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Camera.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Texture.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_helper.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\SOIL.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stb_image_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug_c.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_DXT.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\ex_9_1.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="Sun.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spaceship.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Planet.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Bullet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="shaders\shader_8_sun.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_8_sun.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.vert">
<Filter>Shader Files</Filter>
</None>
<<<<<<< HEAD
<None Include="shaders\shader_skybox.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_skybox.vert">
=======
<None Include="fireball.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="fireball.frag">
>>>>>>> 62afe67 (add shooting)
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -1,150 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shader Files">
<UniqueIdentifier>{0a247bb8-2e8e-4a90-b0ef-17415b0941ba}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\SOIL">
<UniqueIdentifier>{0af44075-33f4-4953-b1d6-1d28d61d758f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Render_Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Shader_Loader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Box.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Camera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\SOIL.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\stb_image_aug.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_DXT.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_helper.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="GameObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Planet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\objload.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Render_Utils.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Shader_Loader.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Camera.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Texture.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_helper.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\SOIL.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stb_image_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug_c.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_DXT.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\ex_9_1.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="Sun.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spaceship.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Planet.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Bullet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="shaders\shader_8_sun.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_8_sun.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.vert">
<Filter>Shader Files</Filter>
</None>
<<<<<<< HEAD
<None Include="shaders\shader_skybox.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_skybox.vert">
=======
<None Include="fireball.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="fireball.frag">
>>>>>>> 62afe67 (add shooting)
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -1,150 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shader Files">
<UniqueIdentifier>{0a247bb8-2e8e-4a90-b0ef-17415b0941ba}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\SOIL">
<UniqueIdentifier>{0af44075-33f4-4953-b1d6-1d28d61d758f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Render_Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Shader_Loader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Box.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Camera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\SOIL.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\stb_image_aug.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_DXT.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_helper.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="GameObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Planet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\objload.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Render_Utils.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Shader_Loader.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Camera.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Texture.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_helper.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\SOIL.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stb_image_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug_c.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_DXT.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\ex_9_1.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="Sun.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spaceship.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Planet.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Bullet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="shaders\shader_8_sun.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_8_sun.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.vert">
<Filter>Shader Files</Filter>
</None>
<<<<<<< HEAD
<None Include="shaders\shader_skybox.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_skybox.vert">
=======
<None Include="fireball.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="fireball.frag">
>>>>>>> 62afe67 (add shooting)
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -1,134 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shader Files">
<UniqueIdentifier>{0a247bb8-2e8e-4a90-b0ef-17415b0941ba}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\SOIL">
<UniqueIdentifier>{0af44075-33f4-4953-b1d6-1d28d61d758f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Render_Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Shader_Loader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Box.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Camera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\SOIL.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\stb_image_aug.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_DXT.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_helper.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="GameObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Planet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\objload.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Render_Utils.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Shader_Loader.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Camera.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Texture.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_helper.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\SOIL.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stb_image_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug_c.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_DXT.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\ex_9_1.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="Sun.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spaceship.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Planet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="shaders\shader_8_sun.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_8_sun.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.vert">
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -1,134 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shader Files">
<UniqueIdentifier>{0a247bb8-2e8e-4a90-b0ef-17415b0941ba}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\SOIL">
<UniqueIdentifier>{0af44075-33f4-4953-b1d6-1d28d61d758f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Render_Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Shader_Loader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Box.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Camera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\SOIL.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\stb_image_aug.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_DXT.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_helper.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="GameObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Planet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\objload.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Render_Utils.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Shader_Loader.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Camera.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Texture.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_helper.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\SOIL.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stb_image_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug_c.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_DXT.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\ex_9_1.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="Sun.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spaceship.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Planet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="shaders\shader_8_sun.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_8_sun.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.vert">
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -1,134 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shader Files">
<UniqueIdentifier>{0a247bb8-2e8e-4a90-b0ef-17415b0941ba}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\SOIL">
<UniqueIdentifier>{0af44075-33f4-4953-b1d6-1d28d61d758f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Render_Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Shader_Loader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Box.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Camera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\SOIL.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\stb_image_aug.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_DXT.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_helper.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="GameObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Planet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\objload.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Render_Utils.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Shader_Loader.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Camera.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Texture.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_helper.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\SOIL.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stb_image_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug_c.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_DXT.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\ex_9_1.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="Sun.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spaceship.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Planet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="shaders\shader_8_sun.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_8_sun.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.vert">
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -1,140 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shader Files">
<UniqueIdentifier>{0a247bb8-2e8e-4a90-b0ef-17415b0941ba}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\SOIL">
<UniqueIdentifier>{0af44075-33f4-4953-b1d6-1d28d61d758f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Render_Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Shader_Loader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Box.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Camera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\SOIL.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\stb_image_aug.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_DXT.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_helper.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="GameObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Planet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\objload.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Render_Utils.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Shader_Loader.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Camera.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Texture.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_helper.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\SOIL.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stb_image_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug_c.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_DXT.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\ex_9_1.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="Sun.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spaceship.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Planet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="shaders\shader_8_sun.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_8_sun.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_skybox.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_skybox.vert">
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -1,140 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shader Files">
<UniqueIdentifier>{0a247bb8-2e8e-4a90-b0ef-17415b0941ba}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\SOIL">
<UniqueIdentifier>{0af44075-33f4-4953-b1d6-1d28d61d758f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Render_Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Shader_Loader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Box.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Camera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\SOIL.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\stb_image_aug.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_DXT.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_helper.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="GameObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Planet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\objload.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Render_Utils.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Shader_Loader.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Camera.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Texture.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_helper.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\SOIL.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stb_image_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug_c.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_DXT.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\ex_9_1.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="Sun.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spaceship.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Planet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="shaders\shader_8_sun.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_8_sun.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_skybox.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_skybox.vert">
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -1,140 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shader Files">
<UniqueIdentifier>{0a247bb8-2e8e-4a90-b0ef-17415b0941ba}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\SOIL">
<UniqueIdentifier>{0af44075-33f4-4953-b1d6-1d28d61d758f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Render_Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Shader_Loader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Box.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Camera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\SOIL.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\stb_image_aug.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_DXT.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_helper.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="GameObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Planet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\objload.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Render_Utils.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Shader_Loader.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Camera.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Texture.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_helper.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\SOIL.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stb_image_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug_c.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_DXT.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\ex_9_1.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="Sun.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spaceship.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Planet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="shaders\shader_8_sun.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_8_sun.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_skybox.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_skybox.vert">
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -1,143 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shader Files">
<UniqueIdentifier>{0a247bb8-2e8e-4a90-b0ef-17415b0941ba}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\SOIL">
<UniqueIdentifier>{0af44075-33f4-4953-b1d6-1d28d61d758f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Render_Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Shader_Loader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Box.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Camera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\SOIL.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\stb_image_aug.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_DXT.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_helper.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="GameObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Planet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\objload.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Render_Utils.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Shader_Loader.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Camera.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Texture.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_helper.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\SOIL.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stb_image_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug_c.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_DXT.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\ex_9_1.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="Sun.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spaceship.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Planet.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Bullet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="shaders\shader_8_sun.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_8_sun.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="fireball.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="fireball.frag">
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -1,143 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shader Files">
<UniqueIdentifier>{0a247bb8-2e8e-4a90-b0ef-17415b0941ba}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\SOIL">
<UniqueIdentifier>{0af44075-33f4-4953-b1d6-1d28d61d758f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Render_Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Shader_Loader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Box.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Camera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\SOIL.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\stb_image_aug.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_DXT.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_helper.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="GameObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Planet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\objload.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Render_Utils.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Shader_Loader.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Camera.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Texture.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_helper.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\SOIL.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stb_image_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug_c.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_DXT.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\ex_9_1.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="Sun.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spaceship.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Planet.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Bullet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="shaders\shader_8_sun.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_8_sun.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="fireball.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="fireball.frag">
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -1,143 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Shader Files">
<UniqueIdentifier>{0a247bb8-2e8e-4a90-b0ef-17415b0941ba}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\SOIL">
<UniqueIdentifier>{0af44075-33f4-4953-b1d6-1d28d61d758f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Render_Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Shader_Loader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Box.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Camera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\SOIL.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\stb_image_aug.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_DXT.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\SOIL\image_helper.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="GameObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Planet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\objload.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Render_Utils.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Shader_Loader.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Camera.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\Texture.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_helper.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\SOIL.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stb_image_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\stbi_DDS_aug_c.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\SOIL\image_DXT.h">
<Filter>Source Files\SOIL</Filter>
</ClInclude>
<ClInclude Include="src\ex_9_1.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="Sun.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spaceship.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameObject.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Planet.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Bullet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="shaders\shader_8_sun.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_8_sun.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_9_1.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\test.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="fireball.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="fireball.frag">
<Filter>Shader Files</Filter>
</None>
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +0,0 @@
#
#
#
newmtl Siatka _Material.003
illum 2
Ka 1.000000 1.000000 1.000000
Kd 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ns 0.000000
map_Kd Material.001_Base_color.jpg

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
# Blender v2.90.0 OBJ File: ''
# www.blender.org
mtllib cube.mtl
o Cube
v -10.000000 -10.000000 10.000000
v -10.000000 10.000000 10.000000
v -10.000000 -10.000000 -10.000000
v -10.000000 10.000000 -10.000000
v 10.000000 -10.000000 10.000000
v 10.000000 10.000000 10.000000
v 10.000000 -10.000000 -10.000000
v 10.000000 10.000000 -10.000000
vt 0.375000 0.000000
vt 0.625000 0.000000
vt 0.625000 0.250000
vt 0.375000 0.250000
vt 0.625000 0.500000
vt 0.375000 0.500000
vt 0.625000 0.750000
vt 0.375000 0.750000
vt 0.625000 1.000000
vt 0.375000 1.000000
vt 0.125000 0.500000
vt 0.125000 0.750000
vt 0.875000 0.500000
vt 0.875000 0.750000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
usemtl _PBR
s 1
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/4/2 4/3/2 8/5/2 7/6/2
f 7/6/3 8/5/3 6/7/3 5/8/3
f 5/8/4 6/7/4 2/9/4 1/10/4
f 3/11/5 7/6/5 5/8/5 1/12/5
f 8/5/6 4/13/6 2/14/6 6/7/6

View File

@ -1,8 +0,0 @@
#version 330 core
out vec4 FragColor;
in vec3 vertexColor;
void main() {
FragColor = vec4(vertexColor.r, vertexColor.g, vertexColor.b, 1.0);
}

View File

@ -1,14 +0,0 @@
#version 330 core
layout (location = 0) in vec3 inPosition;
out vec3 vertexColor;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
uniform vec3 color;
void main() {
gl_Position = projection * view * model * vec4(inPosition, 1.0);
vertexColor = color;
}

View File

@ -3,13 +3,9 @@
uniform vec3 color;
uniform float exposition;
uniform sampler2D sunTexture;
in vec2 TexCoords;
out vec4 outColor;
void main()
{
vec4 texColor = texture(sunTexture, TexCoords);
vec3 brightColor = texColor.rgb * 4.0;
outColor = vec4(vec3(1.0) - exp(-brightColor*exposition),texColor.a);
outColor = vec4(vec3(1.0) - exp(-color*exposition),1);
}

View File

@ -5,11 +5,9 @@ layout(location = 1) in vec3 vertexNormal;
layout(location = 2) in vec2 vertexTexCoord;
uniform mat4 transformation;
out vec2 TexCoords;
void main()
{
gl_Position = transformation * vec4(vertexPosition, 1.0);
//gl_Position = vec4(vertexPosition, 1.0);
TexCoords = vertexTexCoord;
}

View File

@ -9,8 +9,11 @@ uniform vec3 cameraPos;
uniform vec3 color;
uniform vec3 lightPositions[8];
uniform vec3 lightColors[8];
//uniform vec3 sunDir;
//uniform vec3 sunColor;
uniform vec3 lightPos;
uniform vec3 lightColor;
uniform vec3 spotlightPos;
uniform vec3 spotlightColor;
@ -29,7 +32,7 @@ out vec4 outColor;
in vec3 viewDirTS;
in vec3 lightDirTS[4];
in vec3 lightDirTS;
in vec3 spotlightDirTS;
in vec3 sunDirTS;
@ -71,11 +74,13 @@ vec3 fresnelSchlick(float cosTheta, vec3 F0){
vec3 PBRLight(vec3 lightDir, vec3 radiance, vec3 normal, vec3 V){
float diffuse=max(0,dot(normal,lightDir));
//vec3 V = normalize(cameraPos-worldPos);
vec3 F0 = vec3(0.04);
F0 = mix(F0, color, metallic);
vec3 H = normalize(V + lightDir);
// cook-torrance brdf
float NDF = DistributionGGX(normal, H, roughness);
float G = GeometrySmith(normal, V, lightDir, roughness);
vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0);
@ -88,6 +93,7 @@ vec3 PBRLight(vec3 lightDir, vec3 radiance, vec3 normal, vec3 V){
float denominator = 4.0 * max(dot(normal, V), 0.0) * max(dot(normal, lightDir), 0.0) + 0.0001;
vec3 specular = numerator / denominator;
// add to outgoing radiance Lo
float NdotL = max(dot(normal, lightDir), 0.0);
return (kD * color / PI + specular) * radiance * NdotL;
}
@ -95,29 +101,35 @@ vec3 PBRLight(vec3 lightDir, vec3 radiance, vec3 normal, vec3 V){
void main()
{
//vec3 normal = vec3(0,0,1);
vec3 normal = normalize(vecNormal);
//vec3 viewDir = normalize(viewDirTS);
vec3 viewDir = normalize(cameraPos-worldPos);
vec3 lightDirs[4];
vec3 ambient = AMBIENT * color;
vec3 ilumination = ambient;
for (int i = 0; i < 8; ++i) {
lightDirs[i] = normalize(lightPositions[i] - worldPos);
vec3 attenuatedlightColor = lightColors[i] / pow(length(lightPositions[i] - worldPos), 2);
ilumination = ilumination+PBRLight(lightDirs[i], attenuatedlightColor * 300, normal, viewDir);
}
//vec3 lightDir = normalize(lightDirTS);
vec3 lightDir = normalize(lightPos-worldPos);
vec3 ambient = AMBIENT*color;
vec3 attenuatedlightColor = lightColor/pow(length(lightPos-worldPos),2);
vec3 ilumination;
ilumination = ambient+PBRLight(lightDir,attenuatedlightColor * 300,normal,viewDir);
//flashlight
//vec3 spotlightDir= normalize(spotlightDirTS);
vec3 spotlightDir= normalize(spotlightPos-worldPos);
float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1);
vec3 attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
//sun
//ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);
outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1);
//outColor = vec4(roughness,metallic,0,1);
//outColor = vec4(test;
}

View File

@ -1,129 +0,0 @@
#version 430 core
float AMBIENT = 0.03;
float PI = 3.14;
uniform sampler2D depthMap;
uniform vec3 cameraPos;
uniform vec3 color;
uniform vec3 lightPositions[100];
uniform vec3 lightColors[100];
uniform vec3 spotlightPos;
uniform vec3 spotlightColor;
uniform vec3 spotlightConeDir;
uniform vec3 spotlightPhi;
uniform float metallic;
uniform float roughness;
uniform float exposition;
in vec3 vecNormal;
in vec3 worldPos;
out vec4 outColor;
in vec3 viewDirTS;
in vec3 lightDirTS[4];
in vec3 spotlightDirTS;
in vec3 sunDirTS;
in vec3 test;
float DistributionGGX(vec3 normal, vec3 H, float roughness){
float a = roughness*roughness;
float a2 = a*a;
float NdotH = max(dot(normal, H), 0.0);
float NdotH2 = NdotH*NdotH;
float num = a2;
float denom = (NdotH2 * (a2 - 1.0) + 1.0);
denom = PI * denom * denom;
return num / denom;
}
float GeometrySchlickGGX(float NdotV, float roughness){
float r = (roughness + 1.0);
float k = (r*r) / 8.0;
float num = NdotV;
float denom = NdotV * (1.0 - k) + k;
return num / denom;
}
float GeometrySmith(vec3 normal, vec3 V, vec3 lightDir, float roughness){
float NdotV = max(dot(normal, V), 0.0);
float NdotL = max(dot(normal, lightDir), 0.0);
float ggx2 = GeometrySchlickGGX(NdotV, roughness);
float ggx1 = GeometrySchlickGGX(NdotL, roughness);
return ggx1 * ggx2;
}
vec3 fresnelSchlick(float cosTheta, vec3 F0){
return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);
}
vec3 PBRLight(vec3 lightDir, vec3 radiance, vec3 normal, vec3 V){
float diffuse=max(0,dot(normal,lightDir));
vec3 F0 = vec3(0.04);
F0 = mix(F0, color, metallic);
vec3 H = normalize(V + lightDir);
float NDF = DistributionGGX(normal, H, roughness);
float G = GeometrySmith(normal, V, lightDir, roughness);
vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0);
vec3 kS = F;
vec3 kD = vec3(1.0) - kS;
kD *= 1.0 - metallic;
vec3 numerator = NDF * G * F;
float denominator = 4.0 * max(dot(normal, V), 0.0) * max(dot(normal, lightDir), 0.0) + 0.0001;
vec3 specular = numerator / denominator;
float NdotL = max(dot(normal, lightDir), 0.0);
return (kD * color / PI + specular) * radiance * NdotL;
}
void main()
{
vec3 normal = normalize(vecNormal);
vec3 viewDir = normalize(cameraPos-worldPos);
vec3 lightDirs[4];
vec3 ambient = AMBIENT * color;
vec3 ilumination = ambient;
for (int i = 0; i < 100; ++i) {
lightDirs[i] = normalize(lightPositions[i] - worldPos);
vec3 attenuatedlightColor = lightColors[i] / pow(length(lightPositions[i] - worldPos), 2);
ilumination = ilumination+PBRLight(lightDirs[i], attenuatedlightColor * 300, normal, viewDir);
}
vec3 spotlightDir= normalize(spotlightPos-worldPos);
float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1);
vec3 attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir);
<<<<<<< HEAD
=======
//sun
//ilumination=ilumination+PBRLight(sunDir,sunColor,normal,viewDir);
>>>>>>> c0971c9 (Add enemy class)
outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1);
}

View File

@ -12,13 +12,15 @@ uniform mat4 modelMatrix;
out vec3 vecNormal;
out vec3 worldPos;
uniform vec3 lightsPositions[8];
uniform vec3 lightPos;
uniform vec3 spotlightPos;
uniform vec3 cameraPos;
//uniform vec3 sunDir;
out vec3 viewDirTS;
out vec3 lightDirTS[8];
out vec3 lightDirTS;
out vec3 spotlightDirTS;
//out vec3 sunDirTS;
void main()
{
@ -32,12 +34,10 @@ void main()
vec3 V = normalize(cameraPos-worldPos);
viewDirTS = TBN*V;
for (int i = 0; i < 8; ++i) {
vec3 L = normalize(lightsPositions[i]-worldPos);
lightDirTS[i] = TBN*L;
}
vec3 L = normalize(lightPos-worldPos);
lightDirTS = TBN*L;
vec3 SL = normalize(spotlightPos-worldPos);
spotlightDirTS = TBN*SL;
//sunDirTS = TBN*sunDir;
}

View File

@ -1,12 +0,0 @@
#version 430 core
uniform samplerCube skybox;
in vec3 texCoord;
out vec4 out_color;
void main()
{
out_color = texture(skybox,texCoord);
}

View File

@ -1,13 +0,0 @@
#version 430 core
layout(location = 0) in vec3 vertexPosition;
uniform mat4 transformation;
out vec3 texCoord;
void main()
{
texCoord = vertexPosition;
gl_Position = transformation * vec4(vertexPosition, 1.0);
}

View File

@ -1,16 +0,0 @@
#version 430 core
uniform sampler2D colorTexture;
in vec3 worldPos;
in vec2 texCoord;
in vec3 color;
out vec4 outColor;
void main()
{
outColor = texture(colorTexture, texCoord);
outColor *= vec4(color, 1.0);
}

View File

@ -1,21 +0,0 @@
#version 430 core
layout(location = 0) in vec3 vertexPosition;
layout(location = 1) in vec3 aColor;
layout(location = 2) in vec2 vertexTexCoord;
uniform mat4 transformation;
uniform mat4 modelMatrix;
out vec3 worldPos;
out vec2 texCoord;
out vec3 color;
void main()
{
worldPos = (modelMatrix* vec4(vertexPosition,1)).xyz;
gl_Position = transformation * vec4(vertexPosition, 1.0);
texCoord = vertexTexCoord;
texCoord.y = 1.0 - texCoord.y; // so that it is turned correctly
color = aColor;
}

View File

@ -1,24 +0,0 @@
#version 430 core
uniform float progress;
uniform vec3 activeColor;
in vec3 worldPos;
in vec2 texCoord;
in vec3 color;
out vec4 outColor;
void main()
{
vec4 inactiveColor = vec4(0.5, 0.5, 0.5, 1.0);
if (texCoord.x > progress) {
outColor = inactiveColor; // Ustawienie koloru dla obszaru nieaktywnego
return;
}
outColor = vec4(activeColor,1.0); // Ustawienie koloru dla obszaru aktywnego
}

View File

@ -1,20 +0,0 @@
#version 430 core
layout(location = 0) in vec3 vertexPosition;
layout(location = 1) in vec3 aColor;
layout(location = 2) in vec2 vertexTexCoord;
uniform mat4 transformation;
uniform mat4 modelMatrix;
out vec3 worldPos;
out vec2 texCoord;
out vec3 color;
void main()
{
worldPos = (modelMatrix* vec4(vertexPosition,1)).xyz;
gl_Position = transformation * vec4(vertexPosition, 1.0);
texCoord = vertexTexCoord;
color = aColor;
}

View File

@ -1,139 +0,0 @@
#version 430 core
float AMBIENT = 0.03;
float PI = 3.14;
uniform sampler2D depthMap;
uniform vec3 cameraPos;
uniform sampler2D textureSampler;
uniform sampler2D normalSampler;
uniform vec3 lightPositions[100];
uniform vec3 lightColors[100];
uniform vec3 spotlightPos;
uniform vec3 spotlightColor;
uniform vec3 spotlightConeDir;
uniform vec3 spotlightPhi;
uniform float metallic;
uniform float roughness;
uniform float exposition;
in vec3 vecNormal;
in vec3 worldPos;
in vec2 TexCoords;
in mat3 TBN;
out vec4 outColor;
in vec3 viewDirTS;
in vec3 lightDirTS[4];
in vec3 spotlightDirTS;
in vec3 sunDirTS;
in vec3 test;
float DistributionGGX(vec3 normal, vec3 H, float roughness){
float a = roughness*roughness;
float a2 = a*a;
float NdotH = max(dot(normal, H), 0.0);
float NdotH2 = NdotH*NdotH;
float num = a2;
float denom = (NdotH2 * (a2 - 1.0) + 1.0);
denom = PI * denom * denom;
return num / denom;
}
float GeometrySchlickGGX(float NdotV, float roughness){
float r = (roughness + 1.0);
float k = (r*r) / 8.0;
float num = NdotV;
float denom = NdotV * (1.0 - k) + k;
return num / denom;
}
float GeometrySmith(vec3 normal, vec3 V, vec3 lightDir, float roughness){
float NdotV = max(dot(normal, V), 0.0);
float NdotL = max(dot(normal, lightDir), 0.0);
float ggx2 = GeometrySchlickGGX(NdotV, roughness);
float ggx1 = GeometrySchlickGGX(NdotL, roughness);
return ggx1 * ggx2;
}
vec3 fresnelSchlick(float cosTheta, vec3 F0){
return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);
}
vec3 PBRLight(vec3 lightDir, vec3 radiance, vec3 normal, vec3 V, vec3 texcolorRGB){
float diffuse=max(0,dot(normal,lightDir));
vec3 F0 = vec3(0.04);
F0 = mix(F0, texcolorRGB , metallic);
vec3 H = normalize(V + lightDir);
float NDF = DistributionGGX(normal, H, roughness);
float G = GeometrySmith(normal, V, lightDir, roughness);
vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0);
vec3 kS = F;
vec3 kD = vec3(1.0) - kS;
kD *= 1.0 - metallic;
vec3 numerator = NDF * G * F;
float denominator = 4.0 * max(dot(normal, V), 0.0) * max(dot(normal, lightDir), 0.0) + 0.0001;
vec3 specular = numerator / denominator;
float NdotL = max(dot(normal, lightDir), 0.0);
return (kD * texcolorRGB / PI + specular) * radiance * NdotL;
}
void main()
{
vec4 texColor = texture(textureSampler, TexCoords);
vec3 normalMapNormal = texture(normalSampler, TexCoords).xyz;
normalMapNormal = normalMapNormal * 2.0 - 1.0;
//normalMapNormal.y = -normalMapNormal.y;
vec3 normal = normalize(normalMapNormal * TBN );
//vec3 normal = normalize(texture(normalSampler, TexCoords).xyz * TBN);
//vec3 normal = normalize(vecNormal);
vec3 viewDir = normalize(cameraPos-worldPos);
vec3 lightDirs[4];
vec3 ambient = AMBIENT * texColor.rgb;
vec3 ilumination = ambient;
for (int i = 0; i < 100; ++i) {
lightDirs[i] = normalize(lightPositions[i] - worldPos);
vec3 attenuatedlightColor = lightColors[i] / pow(length(lightPositions[i] - worldPos), 2);
ilumination = ilumination+PBRLight(lightDirs[i], attenuatedlightColor * 300, normal, viewDir, texColor.rgb);
}
vec3 spotlightDir= normalize(spotlightPos-worldPos);
float angle_atenuation = clamp((dot(-normalize(spotlightPos-worldPos),spotlightConeDir)-0.5)*3,0,1);
vec3 attenuatedlightColor = angle_atenuation*spotlightColor/pow(length(spotlightPos-worldPos),2);
ilumination=ilumination+PBRLight(spotlightDir,attenuatedlightColor,normal,viewDir, texColor.rgb);
outColor = vec4(vec3(1.0) - exp(-ilumination*exposition),1);
}

View File

@ -1,49 +0,0 @@
#version 430 core
layout(location = 0) in vec3 vertexPosition;
layout(location = 1) in vec3 vertexNormal;
layout(location = 2) in vec2 vertexTexCoord;
layout(location = 3) in vec3 vertexTangent;
layout(location = 4) in vec3 vertexBitangent;
uniform mat4 transformation;
uniform mat4 modelMatrix;
out vec3 vecNormal;
out vec3 worldPos;
out vec2 TexCoords;
uniform vec3 lightsPositions[10];
uniform vec3 spotlightPos;
uniform vec3 cameraPos;
out vec3 viewDirTS;
out vec3 lightDirTS[10];
out vec3 spotlightDirTS;
out mat3 TBN;
void main()
{
TexCoords = vertexTexCoord * -1;
TexCoords = vec2(vertexTexCoord.x, 1.0 - vertexTexCoord.y);
worldPos = (modelMatrix* vec4(vertexPosition,1)).xyz;
vecNormal = (modelMatrix* vec4(vertexNormal,0)).xyz;
gl_Position = transformation * vec4(vertexPosition, 1.0);
vec3 w_tangent = normalize(mat3(modelMatrix)*vertexTangent);
vec3 w_bitangent = normalize(mat3(modelMatrix)*vertexBitangent);
TBN = transpose(mat3(w_tangent, w_bitangent, vecNormal));
vec3 V = normalize(cameraPos-worldPos);
viewDirTS = TBN*V;
for (int i = 0; i < 9; ++i) {
vec3 L = normalize(lightsPositions[i]-worldPos);
lightDirTS[i] = TBN*L;
}
vec3 SL = normalize(spotlightPos-worldPos);
spotlightDirTS = TBN*SL;
}

View File

@ -4,7 +4,7 @@
namespace Core
{
glm::mat4 createPerspectiveMatrix(float zNear, float zFar, float frustumScale);
glm::mat4 createPerspectiveMatrix(float zNear = 0.1f, float zFar = 100.0f, float frustumScale = 1.f);
// position - pozycja kamery
// forward - wektor "do przodu" kamery (jednostkowy)

View File

@ -1,16 +1,13 @@
#include "Render_Utils.h"
#include <algorithm>
#include <list>
#include "glew.h"
#include "freeglut.h"
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include "../GameUtils.h"
#include "../Spaceship.h"
#include "Texture.h"
@ -137,11 +134,11 @@ glm::mat4 Core::createPerspectiveMatrix()
glm::mat4 perspectiveMatrix;
float n = 0.05;
float f = 200.;
float a1 = glm::min(GameUtils::getInstance()->getAspectRatio(), 1.f);
float a2 = glm::min(1 / GameUtils::getInstance()->getAspectRatio(), 1.f);
float a1 = glm::min(GameUtils::getInstance().aspectRatio, 1.f);
float a2 = glm::min(1 / GameUtils::getInstance().aspectRatio, 1.f);
perspectiveMatrix = glm::mat4({
1,0.,0.,0.,
0.,GameUtils::getInstance()->getAspectRatio(),0.,0.,
0.,GameUtils::getInstance().aspectRatio,0.,0.,
0.,0.,(f + n) / (n - f),2 * f * n / (n - f),
0.,0.,-1.,0.,
});
@ -151,111 +148,3 @@ glm::mat4 Core::createPerspectiveMatrix()
return perspectiveMatrix;
}
void Core::drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color, float roughness, float metallic, GLuint program) {
Spaceship* spaceship = Spaceship::getInstance();
glm::mat4 viewProjectionMatrix = Core::createPerspectiveMatrix() * spaceship->createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(program, "transformation"), 1, GL_FALSE, (float*)&transformation);
glUniformMatrix4fv(glGetUniformLocation(program, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
glUniform1f(glGetUniformLocation(program, "exposition"), 1.f);
glUniform1f(glGetUniformLocation(program, "roughness"), roughness);
glUniform1f(glGetUniformLocation(program, "metallic"), metallic);
glUniform3f(glGetUniformLocation(program, "color"), color.x, color.y, color.z);
glUniform3f(glGetUniformLocation(program, "cameraPos"), spaceship->cameraPos.x, spaceship->cameraPos.y, spaceship->cameraPos.z);
std::list<Sun*>* suns = GameUtils::getInstance()->getSuns();
glm::vec3 lightsPositions[100];
glm::vec3 lightsColors[100];
int i = 0;
for (Sun* sun : *suns) {
lightsPositions[i] = sun->getPosition();
lightsColors[i] = sun->getColor();
++i;
}
glUniform3fv(glGetUniformLocation(program, "lightPositions"), 100, glm::value_ptr(lightsPositions[0]));
glUniform3fv(glGetUniformLocation(program, "lightColors"), 100, glm::value_ptr(lightsColors[0]));
glUniform3f(glGetUniformLocation(program, "spotlightConeDir"), spaceship->spotlightConeDir.x, spaceship->spotlightConeDir.y, spaceship->spotlightConeDir.z);
glUniform3f(glGetUniformLocation(program, "spotlightPos"), spaceship->spotlightPos.x, spaceship->spotlightPos.y, spaceship->spotlightPos.z);
glUniform3f(glGetUniformLocation(program, "spotlightColor"), spaceship->spotlightColor.x, spaceship->spotlightColor.y, spaceship->spotlightColor.z);
glUniform1f(glGetUniformLocation(program, "spotlightPhi"), spaceship->spotlightPhi);
Core::DrawContext(context);
}
void Core::drawObjectPBRTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID, GLuint normalID, float roughness, float metallic, GLuint program) {
Spaceship* spaceship = Spaceship::getInstance();
glm::mat4 viewProjectionMatrix = Core::createPerspectiveMatrix() * spaceship->createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(program, "transformation"), 1, GL_FALSE, (float*)&transformation);
glUniformMatrix4fv(glGetUniformLocation(program, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
glUniform1f(glGetUniformLocation(program, "exposition"), 1.f);
glUniform1f(glGetUniformLocation(program, "roughness"), roughness);
glUniform1f(glGetUniformLocation(program, "metallic"), metallic);
Core::SetActiveTexture(textureID, "textureSampler", program, 0);
glUniform1i(glGetUniformLocation(program, "textureSampler"), 0);
Core::SetActiveTexture(normalID, "normalSampler", program, 1);
glUniform1i(glGetUniformLocation(program, "normalSampler"), 1);
glUniform3f(glGetUniformLocation(program, "cameraPos"), spaceship->cameraPos.x, spaceship->cameraPos.y, spaceship->cameraPos.z);
std::list<Sun*>* suns = GameUtils::getInstance()->getSuns();
glm::vec3 lightsPositions[100];
glm::vec3 lightsColors[100];
int i = 0;
for (Sun* sun : *suns) {
lightsPositions[i] = sun->getPosition();
lightsColors[i] = sun->getColor();
++i;
}
glUniform3fv(glGetUniformLocation(program, "lightPositions"), 100, glm::value_ptr(lightsPositions[0]));
glUniform3fv(glGetUniformLocation(program, "lightColors"), 100, glm::value_ptr(lightsColors[0]));
glUniform3f(glGetUniformLocation(program, "spotlightConeDir"), spaceship->spotlightConeDir.x, spaceship->spotlightConeDir.y, spaceship->spotlightConeDir.z);
glUniform3f(glGetUniformLocation(program, "spotlightPos"), spaceship->spotlightPos.x, spaceship->spotlightPos.y, spaceship->spotlightPos.z);
glUniform3f(glGetUniformLocation(program, "spotlightColor"), spaceship->spotlightColor.x, spaceship->spotlightColor.y, spaceship->spotlightColor.z);
glUniform1f(glGetUniformLocation(program, "spotlightPhi"), spaceship->spotlightPhi);
Core::DrawContext(context);
}
void Core::drawSkybox(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID, GLuint program) {
Spaceship* spaceship = Spaceship::getInstance();
glDisable(GL_DEPTH_TEST);
glUseProgram(program);
glm::mat4 viewProjectionMatrix = Core::createPerspectiveMatrix() * spaceship->createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(program, "transformation"), 1, GL_FALSE, (float*)&transformation);
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
Core::DrawContext(context);
glEnable(GL_DEPTH_TEST);
}
void Core::loadModelToContext(std::string path, Core::RenderContext& context)
{
Assimp::Importer import;
const aiScene* scene = import.ReadFile(path, aiProcess_Triangulate | aiProcess_CalcTangentSpace);
if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode)
{
std::cout << "ERROR::ASSIMP::" << import.GetErrorString() << std::endl;
return;
}
context.initFromAssimpMesh(scene->mMeshes[0]);
}

View File

@ -1,249 +0,0 @@
#include "Render_Utils.h"
#include <algorithm>
#include <list>
#include "glew.h"
#include "freeglut.h"
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include "../GameUtils.h"
#include "../Spaceship.h"
void Core::RenderContext::initFromAssimpMesh(aiMesh* mesh) {
vertexArray = 0;
vertexBuffer = 0;
vertexIndexBuffer = 0;
std::vector<float> textureCoord;
std::vector<unsigned int> indices;
//tex coord must be converted to 2d vecs
for (unsigned int i = 0; i < mesh->mNumVertices; i++)
{
if (mesh->mTextureCoords[0] != nullptr) {
textureCoord.push_back(mesh->mTextureCoords[0][i].x);
textureCoord.push_back(mesh->mTextureCoords[0][i].y);
}
else {
textureCoord.push_back(0.0f);
textureCoord.push_back(0.0f);
}
}
if (mesh->mTextureCoords[0] == nullptr) {
std::cout << "no uv coords\n";
}
for (unsigned int i = 0; i < mesh->mNumFaces; i++)
{
aiFace face = mesh->mFaces[i];
// retrieve all indices of the face and store them in the indices vector
for (unsigned int j = 0; j < face.mNumIndices; j++)
indices.push_back(face.mIndices[j]);
}
unsigned int vertexDataBufferSize = sizeof(float) * mesh->mNumVertices * 3;
unsigned int vertexNormalBufferSize = sizeof(float) * mesh->mNumVertices * 3;
unsigned int vertexTexBufferSize = sizeof(float) * mesh->mNumVertices * 2;
unsigned int vertexTangentBufferSize = sizeof(float) * mesh->mNumVertices * 3;
unsigned int vertexBiTangentBufferSize = sizeof(float) * mesh->mNumVertices * 3;
unsigned int vertexElementBufferSize = sizeof(unsigned int) * indices.size();
size = indices.size();
glGenVertexArrays(1, &vertexArray);
glBindVertexArray(vertexArray);
glGenBuffers(1, &vertexIndexBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vertexIndexBuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, vertexElementBufferSize, &indices[0], GL_STATIC_DRAW);
glGenBuffers(1, &vertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
//std::cout << vertexBuffer;
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);
glEnableVertexAttribArray(3);
glEnableVertexAttribArray(4);
glBufferData(GL_ARRAY_BUFFER, vertexDataBufferSize + vertexNormalBufferSize + vertexTexBufferSize + vertexTangentBufferSize + vertexBiTangentBufferSize, NULL, GL_STATIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, 0, vertexDataBufferSize, mesh->mVertices);
glBufferSubData(GL_ARRAY_BUFFER, vertexDataBufferSize, vertexNormalBufferSize, mesh->mNormals);
glBufferSubData(GL_ARRAY_BUFFER, vertexDataBufferSize + vertexNormalBufferSize, vertexTexBufferSize, &textureCoord[0]);
glBufferSubData(GL_ARRAY_BUFFER, vertexDataBufferSize + vertexNormalBufferSize + vertexTexBufferSize, vertexTangentBufferSize, mesh->mTangents);
glBufferSubData(GL_ARRAY_BUFFER, vertexDataBufferSize + vertexNormalBufferSize + vertexTexBufferSize + vertexTangentBufferSize, vertexBiTangentBufferSize, mesh->mBitangents);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)(0));
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, (void*)(vertexDataBufferSize));
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 0, (void*)(vertexNormalBufferSize + vertexDataBufferSize));
glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, 0, (void*)(vertexDataBufferSize + vertexNormalBufferSize + vertexTexBufferSize));
glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, 0, (void*)(vertexDataBufferSize + vertexNormalBufferSize + vertexTexBufferSize + vertexTangentBufferSize));
}
void Core::DrawVertexArray(const float * vertexArray, int numVertices, int elementSize )
{
glVertexAttribPointer(0, elementSize, GL_FLOAT, false, 0, vertexArray);
glEnableVertexAttribArray(0);
glDrawArrays(GL_TRIANGLES, 0, numVertices);
}
void Core::DrawVertexArrayIndexed( const float * vertexArray, const int * indexArray, int numIndexes, int elementSize )
{
glVertexAttribPointer(0, elementSize, GL_FLOAT, false, 0, vertexArray);
glEnableVertexAttribArray(0);
glDrawElements(GL_TRIANGLES, numIndexes, GL_UNSIGNED_INT, indexArray);
}
void Core::DrawVertexArray( const VertexData & data )
{
int numAttribs = std::min(VertexData::MAX_ATTRIBS, data.NumActiveAttribs);
for(int i = 0; i < numAttribs; i++)
{
glVertexAttribPointer(i, data.Attribs[i].Size, GL_FLOAT, false, 0, data.Attribs[i].Pointer);
glEnableVertexAttribArray(i);
}
glDrawArrays(GL_TRIANGLES, 0, data.NumVertices);
}
void Core::DrawContext(Core::RenderContext& context)
{
glBindVertexArray(context.vertexArray);
glDrawElements(
GL_TRIANGLES, // mode
context.size, // count
GL_UNSIGNED_INT, // type
(void*)0 // element array buffer offset
);
glBindVertexArray(0);
}
glm::mat4 Core::createPerspectiveMatrix()
{
glm::mat4 perspectiveMatrix;
float n = 0.05;
float f = 200.;
float a1 = glm::min(GameUtils::getInstance()->getAspectRatio(), 1.f);
float a2 = glm::min(1 / GameUtils::getInstance()->getAspectRatio(), 1.f);
perspectiveMatrix = glm::mat4({
1,0.,0.,0.,
0.,GameUtils::getInstance()->getAspectRatio(),0.,0.,
0.,0.,(f + n) / (n - f),2 * f * n / (n - f),
0.,0.,-1.,0.,
});
perspectiveMatrix = glm::transpose(perspectiveMatrix);
return perspectiveMatrix;
}
void Core::drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color, float roughness, float metallic, GLuint program) {
Spaceship* spaceship = Spaceship::getInstance();
glm::mat4 viewProjectionMatrix = Core::createPerspectiveMatrix() * spaceship->createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(program, "transformation"), 1, GL_FALSE, (float*)&transformation);
glUniformMatrix4fv(glGetUniformLocation(program, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
glUniform1f(glGetUniformLocation(program, "exposition"), 1.f);
glUniform1f(glGetUniformLocation(program, "roughness"), roughness);
glUniform1f(glGetUniformLocation(program, "metallic"), metallic);
glUniform3f(glGetUniformLocation(program, "color"), color.x, color.y, color.z);
glUniform3f(glGetUniformLocation(program, "cameraPos"), spaceship->cameraPos.x, spaceship->cameraPos.y, spaceship->cameraPos.z);
const int NUM_LIGHTS = 23;
glm::vec3 lightsPositions[NUM_LIGHTS];
glm::vec3 lightsColors[NUM_LIGHTS];
glm::vec3 lightsDirections[NUM_LIGHTS];
/*glUniform3f(glGetUniformLocation(program, "sunDir"), sun.sunDir.x, sun.sunDir.y, sun.sunDir.z);
glUniform3f(glGetUniformLocation(program, "sunColor"), sun.sunColor.x, sun.sunColor.y, sun.sunColor.z);*/
std::list<Sun*>* suns = GameUtils::getInstance()->getSuns();
glm::vec3 firstSunPos = suns->front()->getPosition();
glm::vec3 firstSunColor = suns->front()->getColor();
glUniform3f(glGetUniformLocation(program, "lightPos"), firstSunPos.x, firstSunPos.y, firstSunPos.z);
glUniform3f(glGetUniformLocation(program, "lightColor"), firstSunColor.x, firstSunColor.y, firstSunColor.z);
glUniform3f(glGetUniformLocation(program, "spotlightConeDir"), spaceship->spotlightConeDir.x, spaceship->spotlightConeDir.y, spaceship->spotlightConeDir.z);
glUniform3f(glGetUniformLocation(program, "spotlightPos"), spaceship->spotlightPos.x, spaceship->spotlightPos.y, spaceship->spotlightPos.z);
glUniform3f(glGetUniformLocation(program, "spotlightColor"), spaceship->spotlightColor.x, spaceship->spotlightColor.y, spaceship->spotlightColor.z);
glUniform1f(glGetUniformLocation(program, "spotlightPhi"), spaceship->spotlightPhi);
Core::DrawContext(context);
}
<<<<<<< HEAD
void Core::drawSkybox(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID, GLuint program) {
Spaceship* spaceship = Spaceship::getInstance();
glDisable(GL_DEPTH_TEST);
glUseProgram(program);
glm::mat4 viewProjectionMatrix = Core::createPerspectiveMatrix() * spaceship->createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(program, "transformation"), 1, GL_FALSE, (float*)&transformation);
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
Core::DrawContext(context);
glEnable(GL_DEPTH_TEST);
}
=======
void Core::drawFireball(const glm::mat4& model, float radius, const glm::mat4& view, const glm::mat4& cameraMatrix) {
//GLuint shaderProgram = GameUtils::getInstance()->shaderLoader->CreateProgram("shaders/fireball.vert", "shaders/fireball.frag");
//
//// Ustaw aktywny program cieniuj¹cy
//glUseProgram(shaderProgram);
//// Przeka¿ wartoœci uniform do shadera
//glUniform3fv(glGetUniformLocation(shaderProgram, "cameraPosition"), 1, glm::value_ptr(cameraPosition));
//glUniform3fv(glGetUniformLocation(shaderProgram, "flareColor"), 1, glm::value_ptr(flareColor));
//glUniform3fv(glGetUniformLocation(shaderProgram, "lightPosition"), 1, glm::value_ptr(lightPosition));
//// Oblicz normalne dla efektu œwiat³a
//glm::mat3 normalMatrix = glm::transpose(glm::inverse(glm::mat3(model)));
//// Przeka¿ macierze do shadera
//glUniformMatrix4fv(glGetUniformLocation(shaderProgram, "model"), 1, GL_FALSE, glm::value_ptr(model));
//glUniformMatrix4fv(glGetUniformLocation(shaderProgram, "view"), 1, GL_FALSE, glm::value_ptr(view));
//glUniformMatrix4fv(glGetUniformLocation(shaderProgram, "projection"), 1, GL_FALSE, glm::value_ptr(projection));
//glUniformMatrix3fv(glGetUniformLocation(shaderProgram, "normalMatrix"), 1, GL_FALSE, glm::value_ptr(normalMatrix));
//// Tutaj mo¿esz umieœciæ kod odpowiedzialny za rysowanie przygotowanego obiektu
//// Przyk³adowy kod, zak³adaj¹c, ¿e masz funkcjê renderuj¹c¹ obiekt:
//// renderObject();
//// Wy³¹cz program cieniuj¹cy
//glDeleteProgram(shaderProgram);
}
void Core::loadModelToContext(std::string path, Core::RenderContext& context)
{
Assimp::Importer import;
const aiScene* scene = import.ReadFile(path, aiProcess_Triangulate | aiProcess_CalcTangentSpace);
if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode)
{
std::cout << "ERROR::ASSIMP::" << import.GetErrorString() << std::endl;
return;
}
context.initFromAssimpMesh(scene->mMeshes[0]);
}
>>>>>>> 62afe67 (add shooting)

View File

@ -69,10 +69,6 @@ namespace Core
void DrawVertexArray(const VertexData & data);
void DrawContext(RenderContext& context);
void drawSkybox(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID, GLuint program);
glm::mat4 createPerspectiveMatrix();
void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color, float roughness, float metallic, GLuint program);
void loadModelToContext(std::string path, Core::RenderContext& context);
void drawObjectPBRTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID, GLuint normalID, float roughness, float metallic, GLuint program);
}

View File

@ -17,62 +17,17 @@ GLuint Core::LoadTexture( const char * filepath )
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
int w, h;
unsigned char* image = SOIL_load_image(filepath, &w, &h, 0, SOIL_LOAD_RGBA);
if (image) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image);
glGenerateMipmap(GL_TEXTURE_2D);
SOIL_free_image_data(image);
}
else {
std::cerr << "Texture loading failed for path: " << filepath << std::endl;
}
//glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image);
//glGenerateMipmap(GL_TEXTURE_2D);
//SOIL_free_image_data(image);
return id;
}
GLuint Core::LoadCubemap(const std::vector<std::string>& faces)
{
GLuint textureID;
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
int width, height;
unsigned char* data;
for (unsigned int i = 0; i < faces.size(); i++)
{
data = SOIL_load_image(("textures/skybox/" + faces[i]).c_str(), &width, &height, 0, SOIL_LOAD_RGBA);
if (data)
{
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
SOIL_free_image_data(data);
}
else
{
std::cerr << "Cubemap tex failed to load at path:" << faces[i] << std::endl;
SOIL_free_image_data(data);
glDeleteTextures(1, &textureID);
return 0;
}
}
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
return textureID;
}
void Core::SetActiveTexture(GLuint textureID, const char * shaderVariableName, GLuint programID, int textureUnit)
{

View File

@ -2,13 +2,10 @@
#include "glew.h"
#include "freeglut.h"
#include <vector>
#include <string>
namespace Core
{
GLuint LoadTexture(const char * filepath);
GLuint LoadCubemap(const std::vector<std::string>& faces);
// textureID - identyfikator tekstury otrzymany z funkcji LoadTexture
// shaderVariableName - nazwa zmiennej typu 'sampler2D' w shaderze, z ktora ma zostac powiazana tekstura

View File

@ -5,11 +5,11 @@
#include <iostream>
#include <cmath>
#include <list>
#include <vector>
#include <random>
#include "Shader_Loader.h"
#include "Render_Utils.h"
#include "texture.h"
//#include "Texture.h"
#include "Box.cpp"
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
@ -17,58 +17,17 @@
#include <string>
#include "../Sun.h"
#include "../Spaceship.h"
#include "../Planet.h"
#include "../GameObject.h"
#include "../GameUtils.h"
#include "../SpriteRenderer.h"
#include "../Enemy.h"
#include "../Heart.h"
#include "../Nitro.h"
#include "../ParticleSystem.h"
#include "Camera.h"
#include <random>
#ifndef EX_9_1_HPP
#define EX_9_1_HPP
extern int WIDTH;
extern int HEIGHT;
#endif
const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;
//int WIDTH = 1920, HEIGHT = 1080;
int WIDTH = 500, HEIGHT = 500;
namespace models {
Core::RenderContext marbleBustContext;
Core::RenderContext spaceshipContext;
Core::RenderContext sphereContext;
Core::RenderContext cubeContext;
Core::RenderContext asteroid;
}
namespace texture {
GLuint cubemapTexture;
GLuint spaceshipTexture;
GLuint spaceshipNormal;
GLuint spriteTexture;
GLuint earthTexture;
GLuint asteroidTexture;
GLuint asteroidNormal;
GLuint heartTexture;
GLuint boosterTexture;
}
struct TextureTuple {
GLuint textureID;
GLuint normalMapID;
};
std::vector<TextureTuple> planetTextures;
std::vector<GLuint> sunTexturesIds;
void createGalaxy(glm::vec3 galaxyPosition);
GLuint depthMapFBO;
GLuint depthMap;
@ -76,21 +35,14 @@ GLuint depthMap;
GLuint program;
GLuint programSun;
GLuint programTest;
GLuint programSprite;
GLuint programCubemap;
GLuint programParticle;
GLuint programTex;
GLuint programSpriteBar;
std::list<Planet*> planets;
Sun* sun;
Core::Shader_Loader shaderLoader;
std::list<Sun> suns;
Sun sun;
GLuint VAO,VBO;
std::vector<Nitro*> nitros;
std::vector<Heart*> hearts;
std::vector<Enemy*> enemies;
std::vector<GameEntity*> gameEntities;
float exposition = 1.f;
glm::vec3 pointlightPos = glm::vec3(0, 2, 0);
@ -99,21 +51,8 @@ glm::vec3 pointlightColor = glm::vec3(0.9, 0.6, 0.6);
float lastTime = -1.f;
float deltaTime = 0.f;
Spaceship* spaceship = Spaceship::getInstance();
void createSolarSystem(glm::vec3 sunPos, GLuint sunTexId,float sunScale, float* planetSizes, int numberOfPlanets, float planetsDistance, float planetSpeedCoef);
Core::SpriteRenderer* spriteRenderer;
Spaceship& spaceship = Spaceship::getInstance();
const int ENEMY_COUNT = 20;
std::vector<glm::vec3> referencePoints = {
glm::vec3(0, 2, 0),
glm::vec3(150, 5, 0),
glm::vec3(-20, -30, 50),
glm::vec3(100, 20, -50),
glm::vec3(0, 52, 200),
glm::vec3(150, 55, 200),
glm::vec3(-20, 20, 250),
glm::vec3(100, 70, 150)
};
void updateDeltaTime(float time) {
if (lastTime < 0) {
lastTime = time;
@ -124,471 +63,161 @@ void updateDeltaTime(float time) {
if (deltaTime > 0.1) deltaTime = 0.1;
lastTime = time;
}
void renderHUD(GLFWwindow* window) {
glm::mat4 modelMatrixHUD = spaceship->calculateModelMatrixForHUDBar();
glm::mat4 healthBarPosition;
glm::vec3 healthBarScale;
glm::mat4 turboBarPosition;
glm::vec3 turboBarScale;
if (glfwGetWindowAttrib(window, GLFW_MAXIMIZED)) {
healthBarPosition = glm::translate(modelMatrixHUD, glm::vec3(38.0f, -11.0f, 0.0f));
healthBarScale = glm::vec3(22.0f, 2.f, 1.0f);
turboBarScale = healthBarScale;
turboBarPosition = glm::translate(healthBarPosition, glm::vec3(0.0f, 3.5f, 0.0f));
}
else {
healthBarScale = glm::vec3(22.0f, 4.f, 1.0f);
healthBarPosition = glm::translate(modelMatrixHUD, glm::vec3(38.0f, -30.0f, 0.0f));
turboBarScale = healthBarScale;
turboBarPosition = glm::translate(healthBarPosition, glm::vec3(0.0f, 5.0f, 0.0f));
}
glUseProgram(programSpriteBar);
glDisable(GL_DEPTH_TEST);
spriteRenderer->DrawHUDBar(
glm::vec3(0.0824f, 0.5725f, 0.9765f),
glm::scale(turboBarPosition, turboBarScale),
spaceship->turbo / spaceship->turboMAX,
programSpriteBar);
void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color, float roughness, float metallic) {
spriteRenderer->DrawHUDBar(
glm::vec3(0.0f, 1.0f, 0.0f),
glm::scale(healthBarPosition, healthBarScale),
spaceship->currentHP / spaceship->maxHP,
programSpriteBar);
glEnable(GL_DEPTH_TEST);
}
bool isFarFromReferencePoints(float x, float y, float z, const std::vector<glm::vec3>& referencePoints) {
float minDistance = 10.0f;
glm::mat4 viewProjectionMatrix = Core::createPerspectiveMatrix() *spaceship.createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(program, "transformation"), 1, GL_FALSE, (float*)&transformation);
glUniformMatrix4fv(glGetUniformLocation(program, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
glm::vec3 currentPoint(x, y, z);
glUniform1f(glGetUniformLocation(program, "exposition"), exposition);
auto checkDistance = [currentPoint, minDistance](const glm::vec3& referencePoint) {
return glm::distance(currentPoint, referencePoint) > minDistance;
};
glUniform1f(glGetUniformLocation(program, "roughness"), roughness);
glUniform1f(glGetUniformLocation(program, "metallic"), metallic);
for (const auto& referencePoint : referencePoints) {
if (!checkDistance(referencePoint)) {
return false;
}
}
glUniform3f(glGetUniformLocation(program, "color"), color.x, color.y, color.z);
return true;
}
glm::mat4 generateRandomMatrix(const glm::mat4& startMatrix) {
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_real_distribution<float> disX(-30.0f, 180.0f);
std::uniform_real_distribution<float> disY(-50.0f, 60.0f);
std::uniform_real_distribution<float> disZ(-30.0f, 210.0f);
float randomX, randomY, randomZ;
do {
randomX = disX(gen);
randomY = disY(gen);
randomZ = disZ(gen);
} while (!isFarFromReferencePoints(randomX, randomY, randomZ, referencePoints));
glm::mat4 randomModelMatrix = glm::translate(startMatrix, glm::vec3(randomX, randomY, randomZ));
glUniform3f(glGetUniformLocation(program, "cameraPos"),spaceship.cameraPos.x,spaceship.cameraPos.y,spaceship.cameraPos.z);
return randomModelMatrix;
}
void renderEnemies() {
int counter = 0;
glUseProgram(program);
for (const auto& enemy : enemies) {
if (enemy->isAlive()) {
enemy->attack(spaceship->spaceshipPos, glfwGetTime());
enemy->renderBullets(glfwGetTime(), program, gameEntities);
}
else {
counter++;
}
const int NUM_LIGHTS = 23;
}
if (counter >= ENEMY_COUNT / 2) {
for (const auto& enemy : enemies) {
if (!enemy->isAlive()) {
enemy->initialModelMatrix = generateRandomMatrix(enemy->getModelMatrix());
enemy->respawn();
enemy->aggroRange *= 1.1;
enemy->dmg *= 1.2;
}
}
counter = 0;
}
glm::vec3 lightsPositions[NUM_LIGHTS];
glm::vec3 lightsColors[NUM_LIGHTS];
glm::vec3 lightsDirections[NUM_LIGHTS];
glUseProgram(programSpriteBar);
for (const auto& enemy : enemies) {
if (enemy->isAlive()) {
spriteRenderer->DrawSpriteBar(
glm::vec3(1.0f, 0.0f, 0.0f),
glm::scale(
glm::translate(enemy->modelMatrix, glm::vec3(0.0f, 0.7f, 0.0f)
),
glm::vec3(1.0f, 0.2f, 1.0f)
),
enemy->currentHP / enemy->maxHP,
programSpriteBar);
}
}
glUseProgram(programSprite);
for (const auto& enemy : enemies) {
/*glUniform3f(glGetUniformLocation(program, "sunDir"), sun.sunDir.x, sun.sunDir.y, sun.sunDir.z);
glUniform3f(glGetUniformLocation(program, "sunColor"), sun.sunColor.x, sun.sunColor.y, sun.sunColor.z);*/
if (enemy->isAlive()) {
spriteRenderer->DrawSprite(texture::spriteTexture, enemy->modelMatrix, programSprite);
}
glUniform3f(glGetUniformLocation(program, "lightPos"), sun.sunPos.x, sun.sunPos.y, sun.sunPos.z);
glUniform3f(glGetUniformLocation(program, "lightColor"), sun.sunColor.x, sun.sunColor.y, sun.sunColor.z);
glUniform3f(glGetUniformLocation(program, "spotlightConeDir"),spaceship.spotlightConeDir.x,spaceship.spotlightConeDir.y,spaceship.spotlightConeDir.z);
glUniform3f(glGetUniformLocation(program, "spotlightPos"),spaceship.spotlightPos.x,spaceship.spotlightPos.y,spaceship.spotlightPos.z);
glUniform3f(glGetUniformLocation(program, "spotlightColor"),spaceship.spotlightColor.x,spaceship.spotlightColor.y,spaceship.spotlightColor.z);
glUniform1f(glGetUniformLocation(program, "spotlightPhi"),spaceship.spotlightPhi);
Core::DrawContext(context);
}
}
void renderHeartsAndNitro() {
//if (heart->isAlive()) {
//spriteRenderer->DrawSprite(texture::heartTexture, heart->modelMatrix, programSprite);
//}
glUseProgram(programSprite);
for (auto it = hearts.begin(); it != hearts.end();) {
Heart* heart = *it;
if (heart->isAlive()) {
spriteRenderer->DrawSprite(texture::heartTexture, heart->modelMatrix, programSprite);
}
if (heart->isCollected) {
spaceship->heal();
it = hearts.erase(it);
}
else {
++it;
}
}
for (auto it = nitros.begin(); it != nitros.end();) {
Nitro* nitro = *it;
if (nitro->isAlive()) {
spriteRenderer->DrawSprite(texture::boosterTexture, nitro->modelMatrix, programSprite);
}
if (nitro->isCollected) {
spaceship->turboBoost();
it = nitros.erase(it);
}
else {
++it;
}
}
}
TextureTuple getRandomPlanetTexture() {
int textureIndex = rand() % planetTextures.size();
TextureTuple selectedTextures = planetTextures[textureIndex];
//GLuint textureID = selectedTextures.textureID;
//GLuint normalMapID = selectedTextures.normalMapID;
return planetTextures[textureIndex];
}
void renderShadowapSun() {
float time = glfwGetTime();
glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
//uzupelnij o renderowanie glebokosci do tekstury
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, WIDTH, HEIGHT);
}
void renderScene(GLFWwindow* window)
{
glClearColor(0.4f, 0.4f, 0.8f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
float time = glfwGetTime();
updateDeltaTime(time);
renderShadowapSun();
drawSkybox(models::cubeContext, glm::translate(glm::mat4(), spaceship->cameraPos), texture::cubemapTexture, programCubemap);
//space lamp
glUseProgram(programSun);
std::list<Sun*>* suns = GameUtils::getInstance()->getSuns();
for (Sun* sun : *suns) {
sun->draw();
}
glUseProgram(programTex);
for (Planet* p : planets) {
p->draw(time, programTex);
for (Sun& s : suns) {
s.draw();
}
glUseProgram(program);
std::vector<GameEntity*> gameEntities(enemies.begin(), enemies.end());
//spaceship->renderBullets(glfwGetTime(), program, gameEntities);
gameEntities.insert(gameEntities.end(), hearts.begin(), hearts.end());
gameEntities.insert(gameEntities.end(), nitros.begin(), nitros.end());
spaceship->renderBullets(glfwGetTime(), program, gameEntities);
drawObjectPBR(models::sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), glm::vec3(0.2, 0.7, 0.3), 0.3, 0.0);
drawObjectPBR(models::sphereContext,
glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f)),
glm::vec3(0.5, 0.5, 0.5), 0.7, 0.0, program);
glm::vec3(0.5, 0.5, 0.5), 0.7, 0.0);
drawObjectPBR(models::marbleBustContext, glm::mat4(), glm::vec3(1.f, 1.f, 1.f), 0.5f, 1.0f);
glUseProgram(programTex);
//Core::SetActiveTexture(texture::spaceshipTexture, "textureSampler", programTex, 0);
drawObjectPBRTexture(models::spaceshipContext,
spaceship->calculateModelMatrix(),
texture::spaceshipTexture,
texture::spaceshipNormal,
spaceship->roughness, spaceship->metallic, programTex
);
//Core::SetActiveTexture(texture::earthTexture, "textureSampler", programTex, 0);
//drawObjectPBRTexture(models::sphereContext, glm::translate(glm::vec3(10.f, 0, 0)) * glm::scale(glm::vec3(1.0f)), texture::earthTexture, 0.3, 0.0, programTex);
//glm::translate(pointlightPos) * glm::scale(glm::vec3(1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(10.f, 0, 0)) *
//Core::SetActiveTexture(texture::earthTexture, "textureSampler", programTex, 0);
//drawObjectPBRTexture(models::sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(10.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), texture::earthTexture, 0.3, 0.0, programTex);
//glUseProgram(programSprite);
//for (const auto& enemy : enemies) {
// if (enemy->isAlive()) {
// spriteRenderer->DrawSprite(texture::spriteTexture, enemy->modelMatrix, programSprite);
// }
//}
//glUseProgram(program);
//for (const auto& enemy : enemies) {
// if (enemy->isAlive()) {
// enemy->attack(spaceship->spaceshipPos, glfwGetTime());
// enemy->renderBullets(glfwGetTime(), program, gameEntities);
// }
//}
glm::vec3 cameraSide = glm::normalize(glm::cross(spaceship->cameraDir, glm::vec3(0.f, 1.f, 0.f)));
glm::vec3 cameraUp = glm::normalize(glm::cross(cameraSide, spaceship->cameraDir));
glm::mat4 viewMatrix = Core::createViewMatrix(spaceship->cameraPos, spaceship->cameraDir, cameraUp);
spaceship->renderParticles(programParticle, viewMatrix, Core::createPerspectiveMatrix(), time);
if(!spaceship->isAlive()){
spaceship->respawn();
for (const auto& enemy : enemies) {
enemy->respawn();
}
}
renderHUD(window);
renderEnemies();
renderHeartsAndNitro();
//drawObjectPBR(sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(10.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), glm::vec3(0.2, 0.7, 0.3), 0.3, 0.0, program);
drawObjectPBR(models::spaceshipContext, spaceship.calculateModelMatrix(), spaceship.color, spaceship.roughness, spaceship.metallic);
glUseProgram(0);
glfwSwapBuffers(window);
}
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
{
GameUtils::getInstance()->setAspectRatio(width / float(height));
GameUtils::getInstance().aspectRatio = width / float(height);
glViewport(0, 0, width, height);
WIDTH = width;
HEIGHT = height;
}
void loadModelToContext(std::string path, Core::RenderContext& context)
{
Assimp::Importer import;
const aiScene* scene = import.ReadFile(path, aiProcess_Triangulate | aiProcess_CalcTangentSpace);
if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode)
{
std::cout << "ERROR::ASSIMP::" << import.GetErrorString() << std::endl;
return;
}
context.initFromAssimpMesh(scene->mMeshes[0]);
}
void createSuns() {
createGalaxy(glm::vec3(0.f));
createGalaxy(glm::vec3(0.f, 50.f, 200.f));
sun = Sun(programSun, models::sphereContext, glm::vec3(0, 2, 0), glm::vec3(-0.93633f, 0.351106, 0.003226f), glm::vec3(0.9f, 0.9f, 0.7f) * 5, 1);
suns.push_back(sun);
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(-80, 20, 50), glm::vec3(-0.93633f, 0.351106, 0.003226f), glm::vec3(1.0f, 0.8f, 0.2f), 4.0));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(50, 40, -30), glm::vec3(-0.73633f, 0.451106, 0.023226f), glm::vec3(0.9f, 0.5f, 0.1f), 3.5));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(0, -60, 100), glm::vec3(-0.53633f, 0.551106, 0.043226f), glm::vec3(0.8f, 0.2f, 0.2f), 4.5));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(20, 80, -70), glm::vec3(0.33633f, 0.651106, 0.063226f), glm::vec3(0.5f, 0.7f, 0.9f), 3.8));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(-60, -20, 30), glm::vec3(-0.23633f, 0.751106, 0.083226f), glm::vec3(0.7f, 0.2f, 0.7f), 4.2));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(70, -50, -80), glm::vec3(-0.03633f, 0.851106, 0.103226f), glm::vec3(0.1f, 0.3f, 0.9f), 3.9));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(10, 30, 60), glm::vec3(0.13633f, -0.951106, -0.123226f), glm::vec3(0.6f, 0.9f, 0.4f), 4.3));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(-40, -80, -50), glm::vec3(0.33633f, -0.851106, -0.143226f), glm::vec3(0.7f, 0.5f, 0.2f), 3.7));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(90, 70, 20), glm::vec3(0.53633f, -0.751106, -0.163226f), glm::vec3(0.4f, 0.1f, 0.9f), 4.1));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(-30, 10, -40), glm::vec3(0.73633f, -0.651106, -0.183226f), glm::vec3(0.8f, 0.4f, 0.1f), 4.4));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(150, -100, 80), glm::vec3(0.33633f, -0.951106, -0.143226f), glm::vec3(0.2f, 0.8f, 0.5f), 3.9));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(-120, 50, -60), glm::vec3(0.73633f, 0.551106, 0.103226f), glm::vec3(0.9f, 0.2f, 0.7f), 3.6));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(0, 120, -150), glm::vec3(-0.23633f, -0.751106, 0.083226f), glm::vec3(0.5f, 0.6f, 0.9f), 3.4));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(-180, -50, 120), glm::vec3(0.13633f, 0.351106, -0.003226f), glm::vec3(0.7f, 0.9f, 0.2f), 4.2));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(60, -150, 180), glm::vec3(-0.93633f, -0.451106, -0.023226f), glm::vec3(0.3f, 0.7f, 0.8f), 3.8));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(100, 80, -120), glm::vec3(0.53633f, -0.651106, 0.163226f), glm::vec3(0.8f, 0.1f, 0.4f), 4.5));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(-50, -180, 150), glm::vec3(-0.33633f, 0.951106, -0.083226f), glm::vec3(0.4f, 0.8f, 0.6f), 3.5));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(200, 150, -100), glm::vec3(0.03633f, 0.151106, 0.103226f), glm::vec3(0.6f, 0.2f, 0.9f), 3.9));
suns.push_back(Sun(programSun, models::sphereContext, glm::vec3(-150, -100, -50), glm::vec3(0.83633f, -0.251106, -0.123226f), glm::vec3(0.7f, 0.5f, 0.8f), 4.1));
}
float generateRandomFloat(float minValue, float maxValue) {
return minValue + static_cast <float> (rand()) / (static_cast <float> (RAND_MAX / (maxValue - minValue)));
}
void createAsteroids() {
GameUtils* gu = GameUtils::getInstance();
GameObject* center = gu->getSuns()->front();
float minDistanceFromCenter = 24.f;
float maxDistanceFromCenter = 26.f;
float rotationSpeed = 0.05f;
float scale = 0.002f;
int numAsteroids = 80;
float distanceIncrement = 2.f / (minDistanceFromCenter + 1);
for (int j = -1; j < 2; j++) {
for (int i = 0; i < numAsteroids; ++i) {
float distanceFromCenter = generateRandomFloat(minDistanceFromCenter, maxDistanceFromCenter);
Planet* asteroid = new Planet(center, distanceFromCenter, rotationSpeed, scale, models::asteroid, texture::asteroidTexture, texture::asteroidNormal);
asteroid->setStarteulerYRotation(distanceIncrement * i);
asteroid->setStartYMovement(generateRandomFloat(-0.5f, 0.5f) + j);
planets.push_back(asteroid);
}
}
}
void createGalaxy(glm::vec3 galaxyPosition) {
float planetsSizes[] = { 1.f, 1.5f, 0.8f, 1.2f, 0.2f };
GLuint sunTexId = sunTexturesIds[0];
createSolarSystem(galaxyPosition + glm::vec3(0, 2, 0), sunTexId,3, planetsSizes, 5, 15.f, 0.2f);
float planetsSizes2[] = { 0.6f, 1.1f, 0.9f };
GLuint sunTexId2 = sunTexturesIds[1];
createSolarSystem(galaxyPosition + glm::vec3(150, 5, 0), sunTexId2, 2, planetsSizes2, 3, 15.f, 0.2f);
float planetsSizes3[] = { 0.7f, 1.5f, 1.2f, 1.f };
GLuint sunTexId3 = sunTexturesIds[2];
createSolarSystem(galaxyPosition + glm::vec3(-20, -30, 50), sunTexId3, 4, planetsSizes3, 4, 20.f, 0.2f);
float planetSizes4[] = { 1.f, 0.5f };
GLuint sunTexId4 = sunTexturesIds[3];
createSolarSystem(galaxyPosition + glm::vec3(100, 20, -50), sunTexId4, 5, planetsSizes3, 2, 25.f, 0.2f);
createAsteroids();
}
void createSolarSystem(glm::vec3 sunPos, GLuint sunTexId, float sunScale, float* planetSizes, int numberOfPlanets, float planetsDistance, float planetSpeedCoef) {
GameUtils* gu = GameUtils::getInstance();
sun = new Sun(programSun, models::sphereContext, sunPos, glm::vec3(-0.93633f, 0.351106, 0.003226f), sunTexId, glm::vec3(0.9f, 0.9f, 0.7f) * 5, sunScale);
gu->getSuns()->push_back(sun);
for (int i = 0; i < numberOfPlanets; i++) {
TextureTuple textures = getRandomPlanetTexture();
GLuint texID = textures.textureID;
GLuint norMapID = textures.normalMapID;
float distanceFromSum = (i + 1) * planetsDistance;
Planet* planet = new Planet(sun, distanceFromSum, i * 0.1f + planetSpeedCoef, planetSizes[i], models::sphereContext, texID, norMapID);
planets.push_back(planet);
}
}
void createEnemies() {
//enemies.push_back(new Enemy(100.0f,100.0f, glm::mat4(1.0f), 1.0f, 5.0f));
//enemies.push_back(new Enemy(100.0f,100.0f, glm::translate(glm::mat4(1.0f) , glm::vec3(1.f,1.f,1.f)), 1.0f, 5.0f));
//enemies.push_back(new Enemy(100.0f,100.0f, glm::translate(glm::mat4(1.0f), glm::vec3(-1.f, 2.f, -0.9f)), 1.0f, 5.0f));
int j = 0;
enemies.push_back(new Enemy(100.0f, 100.0f, glm::translate(glm::translate(glm::mat4(1.0f), spaceship->getPosition()), glm::vec3(1.f, 1.f, 2.f)), 1.0f, 5.0f));
for (int i = 0; i < ENEMY_COUNT; ++i) {
glm::mat4 randomModelMatrix = generateRandomMatrix(glm::mat4(1.0f));
enemies.push_back(new Enemy(100.0f, 100.0f, randomModelMatrix, 1.0f, 8.0f));
if (j % 4 == 0) {
hearts.push_back(new Heart(glm::translate(randomModelMatrix, glm::vec3(6.f, 5.f, 8.f)), -5.0f));
nitros.push_back(new Nitro(glm::translate(randomModelMatrix, glm::vec3(2.f, -9.f, 3.f)), 10.0f));
}
j = j + 1;
}
hearts.push_back(new Heart(glm::translate(glm::mat4(1.0f), glm::vec3(25.f, 20.f, 25.f)), 10.0f));
nitros.push_back(new Nitro(glm::translate(glm::mat4(1.0f), glm::vec3(20.f, 20.f, 25.f)), 10.0f));
//obiekty do ktorych bedzie sprawdzana kolizja dla pociskow enemy
gameEntities.push_back(spaceship);
}
void loadPlanetsAndSunTextures() {
planetTextures.clear();
std::vector<std::pair<std::string, std::string>> texturePaths = {
{"./textures/planets/planet1.png", "./textures/planets/planet1normal.png"},
{"./textures/planets/planet2.png", "./textures/planets/planet2normal.png"},
{"./textures/planets/planet3.png", "./textures/planets/planet3normal.png"},
{"./textures/planets/planet4.png", "./textures/planets/planet4normal.png"}
};
std::vector<std::string> sunTexturePaths{
{"./textures/suns/8k_sun.jpg"},
{"./textures/suns/sun2.png"},
{"./textures/suns/sun3.jpg"},
{"./textures/suns/sun4.jpg"}
};
for (const auto& paths : texturePaths) {
GLuint textureID = Core::LoadTexture(paths.first.c_str());
GLuint normalMapID = Core::LoadTexture(paths.second.c_str());
planetTextures.push_back({ textureID, normalMapID });
}
for (const auto& path : sunTexturePaths) {
GLuint sunTextureId = Core::LoadTexture(path.c_str());
sunTexturesIds.push_back(sunTextureId);
}
}
void init(GLFWwindow* window)
{
GameUtils* gameUtils = GameUtils::getInstance();
spriteRenderer = new Core::SpriteRenderer();
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
glEnable(GL_DEPTH_TEST);
program = shaderLoader.CreateProgram("shaders/shader_9_1.vert", "shaders/shader_9_1.frag");
programTest = shaderLoader.CreateProgram("shaders/test.vert", "shaders/test.frag");
programSun = shaderLoader.CreateProgram("shaders/shader_8_sun.vert", "shaders/shader_8_sun.frag");
program = gameUtils->shaderLoader->CreateProgram("shaders/shader_9_1.vert", "shaders/shader_9_1.frag");
programTest = gameUtils->shaderLoader->CreateProgram("shaders/test.vert", "shaders/test.frag");
programSun = gameUtils->shaderLoader->CreateProgram("shaders/shader_8_sun.vert", "shaders/shader_8_sun.frag");
programCubemap = gameUtils->shaderLoader->CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag");
programTex = gameUtils->shaderLoader->CreateProgram("shaders/shader_tex.vert", "shaders/shader_tex.frag");
programSprite = gameUtils->shaderLoader->CreateProgram("shaders/shader_sprite.vert", "shaders/shader_sprite.frag");
programSpriteBar = gameUtils->shaderLoader->CreateProgram("shaders/shader_sprite_bar.vert", "shaders/shader_sprite_bar.frag");
//loadModelToContext("./models/sphere.obj", sphereContext);
//loadModelToContext("./models/spaceship.obj", spaceship.context);
programSprite = gameUtils->shaderLoader->CreateProgram("shaders/shader_sprite.vert", "shaders/shader_sprite.frag");
programParticle = gameUtils->shaderLoader->CreateProgram("shaders/particle.vert", "shaders/particle.frag");
loadModelToContext("./models/marbleBust.obj", models::marbleBustContext);
loadModelToContext("./models/StarShip2.obj", models::spaceshipContext);
loadModelToContext("./models/spaceship.obj", models::spaceshipContext);
loadModelToContext("./models/sphere.obj", models::sphereContext);
loadModelToContext("./models/cube.obj", models::cubeContext);
Core::loadModelToContext("./models/sphere.obj", GameUtils::getInstance()->sphereContext);
Core::loadModelToContext("./models/Asteroid.obj", models::asteroid);
texture::spriteTexture = Core::LoadTexture("textures/blinky1.png");
std::vector<std::string> cubeFaces = {
"bkg2_right1.png",
"bkg2_left2.png",
"bkg2_top3.png",
"bkg2_bottom4.png",
"bkg2_front5.png",
"bkg2_back6.png"
};
loadPlanetsAndSunTextures();
texture::cubemapTexture = Core::LoadCubemap(cubeFaces);
texture::spaceshipTexture = Core::LoadTexture("./textures/spaceship/Material.001_Base_color.jpg");
texture::spaceshipNormal = Core::LoadTexture("./textures/spaceship/Material.001_Normal_DirectX.jpg");
texture::earthTexture = Core::LoadTexture("./textures/planets/8k_earth_daymap.jpg");
texture::asteroidTexture = Core::LoadTexture("./textures/asteroids/asteroidtx.jpg");
texture::asteroidNormal = Core::LoadTexture("./textures/asteroids/asteroidnn.png");
texture::heartTexture = Core::LoadTexture("textures/heart.png");
texture::boosterTexture = Core::LoadTexture("textures/boooster.png");
spaceship->createParticles();
createSuns();
createEnemies();
}
void shutdown(GLFWwindow* window)
{
GameUtils::getInstance()->shaderLoader->DeleteProgram(program);
delete spriteRenderer;
// Dealokacja pamięci po obiektach Enemy
for (const auto& enemy : enemies) {
delete enemy;
}
shaderLoader.DeleteProgram(program);
}
//obsluga wejscia
void processInput(GLFWwindow* window)
{
spaceship->processInput(window, deltaTime, glfwGetTime());
Spaceship::getInstance().processInput(window, deltaTime);
/*if (glfwGetKey(window, GLFW_KEY_1) == GLFW_PRESS)
exposition -= 0.05;
@ -596,8 +225,8 @@ void processInput(GLFWwindow* window)
exposition += 0.05;*/
if (glfwGetKey(window, GLFW_KEY_3) == GLFW_PRESS) {
printf("GameUtils::spaceshipPos = glm::vec3(%ff, %ff, %ff);\n",spaceship->spaceshipPos.x,spaceship->spaceshipPos.y,spaceship->spaceshipPos.z);
printf("GameUtils::spaceshipDir = glm::vec3(%ff, %ff, %ff);\n",spaceship->spaceshipDir.x,spaceship->spaceshipDir.y,spaceship->spaceshipDir.z);
printf("GameUtils::spaceshipPos = glm::vec3(%ff, %ff, %ff);\n",spaceship.spaceshipPos.x,spaceship.spaceshipPos.y,spaceship.spaceshipPos.z);
printf("GameUtils::spaceshipDir = glm::vec3(%ff, %ff, %ff);\n",spaceship.spaceshipDir.x,spaceship.spaceshipDir.y,spaceship.spaceshipDir.z);
}
//cameraDir = glm::normalize(-cameraPos);

View File

@ -1,406 +0,0 @@
#include "glew.h"
#include <GLFW/glfw3.h>
#include "glm.hpp"
#include "ext.hpp"
#include <iostream>
#include <cmath>
#include <list>
#include <vector>
#include "Shader_Loader.h"
#include "Render_Utils.h"
#include "texture.h"
#include "Box.cpp"
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <string>
#include "../Sun.h"
#include "../Spaceship.h"
#include "../Planet.h"
#include "../GameObject.h"
#include "../GameUtils.h"
#include "../SpriteRenderer.h"
#include "../Enemy.h"
#include "../ParticleSystem.h"
#include "Camera.h"
const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;
int WIDTH = 500, HEIGHT = 500;
namespace models {
Core::RenderContext marbleBustContext;
Core::RenderContext spaceshipContext;
Core::RenderContext sphereContext;
Core::RenderContext cubeContext;
}
namespace texture {
GLuint cubemapTexture;
GLuint spaceshipTexture;
GLuint spriteTexture;
GLuint earthTexture;
}
struct TextureTuple {
GLuint textureID;
GLuint normalMapID;
};
std::vector<TextureTuple> planetTextures;
void createGalaxy(glm::vec3 galaxyPosition);
GLuint depthMapFBO;
GLuint depthMap;
GLuint program;
GLuint programSun;
GLuint programTest;
GLuint programSprite;
GLuint programCubemap;
GLuint programParticle;
GLuint programTex;
GLuint programSpriteBar;
std::list<Planet*> planets;
Sun* sun;
GLuint VAO,VBO;
std::vector<Enemy*> enemies;
std::vector<GameEntity*> gameEntities;
float exposition = 1.f;
glm::vec3 pointlightPos = glm::vec3(0, 2, 0);
glm::vec3 pointlightColor = glm::vec3(0.9, 0.6, 0.6);
float lastTime = -1.f;
float deltaTime = 0.f;
Spaceship* spaceship = Spaceship::getInstance();
void createSolarSystem(glm::vec3 sunPos, float sunScale, float* planetSizes, int numberOfPlanets, float planetsDistance, float planetSpeedCoef);
Core::SpriteRenderer* spriteRenderer;
void updateDeltaTime(float time) {
if (lastTime < 0) {
lastTime = time;
return;
}
deltaTime = time - lastTime;
if (deltaTime > 0.1) deltaTime = 0.1;
lastTime = time;
}
void renderHUD() {
glUseProgram(programSpriteBar);
glDisable(GL_DEPTH_TEST);
glm::mat4 spaceshipModelMatrix = spaceship->calculateModelMatrix();
glm::mat4 healthBarPosition = glm::translate(spaceshipModelMatrix, glm::vec3(12.0f, -9.0f, 0.0f));
spriteRenderer->DrawHUDBar(
glm::vec3(0.0f, 1.0f, 0.0f),
glm::scale(healthBarPosition, glm::vec3(9.0f, 1.1f, 1.0f)),
spaceship->currentHP / spaceship->maxHP,
programSpriteBar);
glEnable(GL_DEPTH_TEST);
}
void renderEnemies() {
glUseProgram(programSpriteBar);
for (const auto& enemy : enemies) {
if (enemy->isAlive()) {
spriteRenderer->DrawSpriteBar(
glm::vec3(1.0f, 0.0f, 0.0f),
glm::scale(
glm::translate(enemy->modelMatrix, glm::vec3(0.0f, 0.7f, 0.0f)
),
glm::vec3(1.0f, 0.2f, 1.0f)
),
enemy->currentHP / enemy->maxHP,
programSpriteBar);
}
}
glUseProgram(programSprite);
for (const auto& enemy : enemies) {
if (enemy->isAlive()) {
spriteRenderer->DrawSprite(texture::spriteTexture, enemy->modelMatrix, programSprite);
}
}
glUseProgram(program);
for (const auto& enemy : enemies) {
if (enemy->isAlive()) {
enemy->attack(spaceship->spaceshipPos, glfwGetTime());
enemy->renderBullets(glfwGetTime(), program, gameEntities);
}
}
}
TextureTuple getRandomPlanetTexture() {
int textureIndex = rand() % planetTextures.size();
TextureTuple selectedTextures = planetTextures[textureIndex];
//GLuint textureID = selectedTextures.textureID;
//GLuint normalMapID = selectedTextures.normalMapID;
return planetTextures[textureIndex];
}
void renderShadowapSun() {
float time = glfwGetTime();
glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
//uzupelnij o renderowanie glebokosci do tekstury
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, WIDTH, HEIGHT);
}
void renderScene(GLFWwindow* window)
{
glClearColor(0.4f, 0.4f, 0.8f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
float time = glfwGetTime();
updateDeltaTime(time);
renderShadowapSun();
drawSkybox(models::cubeContext, glm::translate(glm::mat4(), spaceship->cameraPos), texture::cubemapTexture, programCubemap);
//space lamp
glUseProgram(programSun);
std::list<Sun*>* suns = GameUtils::getInstance()->getSuns();
for (Sun* sun : *suns) {
sun->draw();
}
glUseProgram(programTex);
for (Planet* p : planets) {
p->draw(time, programTex);
}
<<<<<<< HEAD
glUseProgram(program);
spaceship->renderBullets(glfwGetTime(), program);
=======
std::vector<GameEntity*> gameEntities(enemies.begin(), enemies.end());
spaceship->renderBullets(glfwGetTime(), program, gameEntities);
>>>>>>> 9586849 (Add collision detection and taking dmg)
drawObjectPBR(models::sphereContext,
glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f)),
glm::vec3(0.5, 0.5, 0.5), 0.7, 0.0, program);
glUseProgram(programTex);
//Core::SetActiveTexture(texture::spaceshipTexture, "textureSampler", programTex, 0);
drawObjectPBRTexture(models::spaceshipContext,
spaceship->calculateModelMatrix(),
texture::spaceshipTexture,
spaceship->roughness, spaceship->metallic, programTex
);
<<<<<<< HEAD
<<<<<<< HEAD
//Core::SetActiveTexture(texture::earthTexture, "textureSampler", programTex, 0);
drawObjectPBRTexture(models::sphereContext, glm::translate(glm::vec3(10.f, 0, 0)) * glm::scale(glm::vec3(1.0f)), texture::earthTexture, 0.3, 0.0, programTex);
//glm::translate(pointlightPos) * glm::scale(glm::vec3(1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(10.f, 0, 0)) *
Core::SetActiveTexture(texture::earthTexture, "textureSampler", programTex, 0);
drawObjectPBRTexture(models::sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(10.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), texture::earthTexture, 0.3, 0.0, programTex);
glUseProgram(programSprite);
for (const auto& enemy : enemies) {
if (enemy->isAlive()) {
spriteRenderer->DrawSprite(texture::spriteTexture, enemy->modelMatrix, programSprite);
}
}
glUseProgram(program);
for (const auto& enemy : enemies) {
if (enemy->isAlive()) {
enemy->attack(spaceship->spaceshipPos, glfwGetTime());
enemy->renderBullets(glfwGetTime(), program);
}
}
glm::vec3 cameraSide = glm::normalize(glm::cross(spaceship->cameraDir, glm::vec3(0.f, 1.f, 0.f)));
glm::vec3 cameraUp = glm::normalize(glm::cross(cameraSide, spaceship->cameraDir));
glm::mat4 viewMatrix = Core::createViewMatrix(spaceship->cameraPos, spaceship->cameraDir, cameraUp);
spaceship->renderParticles(programParticle, viewMatrix, Core::createPerspectiveMatrix(), time);
=======
=======
renderHUD();
>>>>>>> 9586849 (Add collision detection and taking dmg)
renderEnemies();
//drawObjectPBR(sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(10.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), glm::vec3(0.2, 0.7, 0.3), 0.3, 0.0, program);
>>>>>>> 6ccdec5 (Add drawing health bars for enemies)
glUseProgram(0);
glfwSwapBuffers(window);
}
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
{
GameUtils::getInstance()->setAspectRatio(width / float(height));
glViewport(0, 0, width, height);
WIDTH = width;
HEIGHT = height;
}
void createSuns() {
createGalaxy(glm::vec3(0.f));
createGalaxy(glm::vec3(0.f, 50.f, 200.f));
}
void createGalaxy(glm::vec3 galaxyPosition) {
float planetsSizes[] = { 1.f, 1.5f, 0.8f, 1.2f, 0.2f };
createSolarSystem(galaxyPosition + glm::vec3(0, 2, 0), 3, planetsSizes, 5, 15.f, 0.2f);
float planetsSizes2[] = { 0.6f, 1.1f, 0.9f };
createSolarSystem(galaxyPosition + glm::vec3(150, 5, 0), 2, planetsSizes2, 3, 15.f, 0.2f);
float planetsSizes3[] = { 0.7f, 1.5f, 1.2f, 1.f };
createSolarSystem(galaxyPosition + glm::vec3(-20, -30, 50), 4, planetsSizes3, 4, 20.f, 0.2f);
float planetSizes4[] = { 1.f, 0.5f };
createSolarSystem(galaxyPosition + glm::vec3(100, 20, -50), 5, planetsSizes3, 2, 25.f, 0.2f);
}
void createSolarSystem(glm::vec3 sunPos, float sunScale, float* planetSizes, int numberOfPlanets, float planetsDistance, float planetSpeedCoef) {
GameUtils* gu = GameUtils::getInstance();
sun = new Sun(programSun, models::sphereContext, sunPos, glm::vec3(-0.93633f, 0.351106, 0.003226f), glm::vec3(0.9f, 0.9f, 0.7f) * 5, sunScale);
gu->getSuns()->push_back(sun);
for (int i = 0; i < numberOfPlanets; i++) {
TextureTuple textures = getRandomPlanetTexture();
GLuint texID = textures.textureID;
GLuint norMapID = textures.normalMapID;
float distanceFromSum = (i + 1) * planetsDistance;
Planet* planet = new Planet(sun, distanceFromSum, i * 0.1f + planetSpeedCoef, planetSizes[i], models::sphereContext, texID, norMapID);
planets.push_back(planet);
}
}
void createEnemies() {
enemies.push_back(new Enemy(100.0f,100.0f, glm::mat4(1.0f), 1.0f, 5.0f));
enemies.push_back(new Enemy(100.0f,100.0f, glm::translate(glm::mat4(1.0f) , glm::vec3(1.f,1.f,1.f)), 1.0f, 5.0f));
enemies.push_back(new Enemy(100.0f,100.0f, glm::translate(glm::mat4(1.0f), glm::vec3(-1.f, 2.f, -0.9f)), 1.0f, 5.0f));
//obiekty do ktorych bedzie sprawdzana kolizja dla pociskow enemy
gameEntities.push_back(spaceship);
}
void loadPlanetsTextures() {
planetTextures.clear();
std::vector<std::pair<std::string, std::string>> texturePaths = {
{"./textures/planets/planet1.png", "./textures/planets/planet1normal.png"},
{"./textures/planets/planet2.png", "./textures/planets/planet2normal.png"},
{"./textures/planets/planet3.png", "./textures/planets/planet3normal.png"},
{"./textures/planets/planet4.png", "./textures/planets/planet4normal.png"}
};
for (const auto& paths : texturePaths) {
GLuint textureID = Core::LoadTexture(paths.first.c_str());
GLuint normalMapID = Core::LoadTexture(paths.second.c_str());
planetTextures.push_back({ textureID, normalMapID });
}
}
void init(GLFWwindow* window)
{
GameUtils* gameUtils = GameUtils::getInstance();
spriteRenderer = new Core::SpriteRenderer();
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
glEnable(GL_DEPTH_TEST);
program = gameUtils->shaderLoader->CreateProgram("shaders/shader_9_1.vert", "shaders/shader_9_1.frag");
programTest = gameUtils->shaderLoader->CreateProgram("shaders/test.vert", "shaders/test.frag");
programSun = gameUtils->shaderLoader->CreateProgram("shaders/shader_8_sun.vert", "shaders/shader_8_sun.frag");
programCubemap = gameUtils->shaderLoader->CreateProgram("shaders/shader_skybox.vert", "shaders/shader_skybox.frag");
<<<<<<< HEAD
programTex = gameUtils->shaderLoader->CreateProgram("shaders/shader_tex.vert", "shaders/shader_tex.frag");
=======
programSprite = gameUtils->shaderLoader->CreateProgram("shaders/shader_sprite.vert", "shaders/shader_sprite.frag");
programSpriteBar = gameUtils->shaderLoader->CreateProgram("shaders/shader_sprite_bar.vert", "shaders/shader_sprite_bar.frag");
>>>>>>> 6ccdec5 (Add drawing health bars for enemies)
programSprite = gameUtils->shaderLoader->CreateProgram("shaders/shader_sprite.vert", "shaders/shader_sprite.frag");
programParticle = gameUtils->shaderLoader->CreateProgram("shaders/particle.vert", "shaders/particle.frag");
loadModelToContext("./models/marbleBust.obj", models::marbleBustContext);
loadModelToContext("./models/StarShip2.obj", models::spaceshipContext);
loadModelToContext("./models/sphere.obj", models::sphereContext);
loadModelToContext("./models/cube.obj", models::cubeContext);
Core::loadModelToContext("./models/sphere.obj", GameUtils::getInstance()->sphereContext);
texture::spriteTexture = Core::LoadTexture("textures/blinky1.png");
std::vector<std::string> cubeFaces = {
"bkg2_right1.png",
"bkg2_left2.png",
"bkg2_top3.png",
"bkg2_bottom4.png",
"bkg2_front5.png",
"bkg2_back6.png"
};
loadPlanetsTextures();
texture::cubemapTexture = Core::LoadCubemap(cubeFaces);
texture::spaceshipTexture = Core::LoadTexture("./textures/spaceship/Material.001_Base_color.jpg");
texture::earthTexture = Core::LoadTexture("./textures/planets/8k_earth_daymap.jpg");
spaceship->createParticles();
createSuns();
createEnemies();
}
void shutdown(GLFWwindow* window)
{
GameUtils::getInstance()->shaderLoader->DeleteProgram(program);
delete spriteRenderer;
// Dealokacja pamięci po obiektach Enemy
for (const auto& enemy : enemies) {
delete enemy;
}
}
//obsluga wejscia
void processInput(GLFWwindow* window)
{
spaceship->processInput(window, deltaTime, glfwGetTime());
/*if (glfwGetKey(window, GLFW_KEY_1) == GLFW_PRESS)
exposition -= 0.05;
if (glfwGetKey(window, GLFW_KEY_2) == GLFW_PRESS)
exposition += 0.05;*/
if (glfwGetKey(window, GLFW_KEY_3) == GLFW_PRESS) {
printf("GameUtils::spaceshipPos = glm::vec3(%ff, %ff, %ff);\n",spaceship->spaceshipPos.x,spaceship->spaceshipPos.y,spaceship->spaceshipPos.z);
printf("GameUtils::spaceshipDir = glm::vec3(%ff, %ff, %ff);\n",spaceship->spaceshipDir.x,spaceship->spaceshipDir.y,spaceship->spaceshipDir.z);
}
//cameraDir = glm::normalize(-cameraPos);
}
// funkcja jest glowna petla
void renderLoop(GLFWwindow* window) {
while (!glfwWindowShouldClose(window))
{
processInput(window);
renderScene(window);
glfwPollEvents();
}
}
//}

View File

@ -6,13 +6,12 @@
#include <iostream>
#include <cmath>
#include "ex_9_1.hpp"
int WIDTH = 1920, HEIGHT = 1080;
int main(int argc, char** argv)
{
// inicjalizacja glfw
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
@ -24,7 +23,7 @@ int main(int argc, char** argv)
#endif
// tworzenie okna za pomoca glfw
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "FirstWindow", NULL, NULL);
GLFWwindow* window = glfwCreateWindow(500, 500, "FirstWindow", NULL, NULL);
if (window == NULL)
{
std::cout << "Failed to create GLFW window" << std::endl;
@ -35,7 +34,7 @@ int main(int argc, char** argv)
// ladowanie OpenGL za pomoca glew
glewInit();
glViewport(0, 0, WIDTH, HEIGHT);
glViewport(0, 0, 500, 500);
init(window);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 941 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 KiB

Some files were not shown because too many files have changed in this diff Show More