Merge branch 'master' of https://git.wmi.amu.edu.pl/s444441/GRK-projekt-2020
This commit is contained in:
commit
5e8f2b8330
@ -59,7 +59,7 @@
|
|||||||
<ProjectGuid>{1B448102-E76C-4347-BDC7-40D02A567DB6}</ProjectGuid>
|
<ProjectGuid>{1B448102-E76C-4347-BDC7-40D02A567DB6}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>grk-cw9</RootNamespace>
|
<RootNamespace>grk-cw9</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
<ProjectName>grk-project</ProjectName>
|
<ProjectName>grk-project</ProjectName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
@ -67,14 +67,14 @@
|
|||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
30
src/main.cpp
30
src/main.cpp
@ -2,6 +2,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/postprocess.h>
|
#include <assimp/postprocess.h>
|
||||||
@ -19,6 +20,12 @@
|
|||||||
#include <WinUser.h>
|
#include <WinUser.h>
|
||||||
#define STB_IMAGE_IMPLEMENTATION
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
#include "stb_image.h"
|
#include "stb_image.h"
|
||||||
|
//Text handling
|
||||||
|
int msgId = 0;
|
||||||
|
int checkTimer = 360;
|
||||||
|
int frames = 0;
|
||||||
|
const char* screenMsg[4] = { "Znajdz zaloganta w pasie asteroid", "Znalazles zaloganta!",
|
||||||
|
"Uszkodzenie oslon termicznych", "Zderzenie z duzym obiektem" };
|
||||||
|
|
||||||
physx::PxRigidDynamic* getActor(std::string name);
|
physx::PxRigidDynamic* getActor(std::string name);
|
||||||
static PxFilterFlags simulationFilterShader(PxFilterObjectAttributes attributes0,
|
static PxFilterFlags simulationFilterShader(PxFilterObjectAttributes attributes0,
|
||||||
@ -48,7 +55,8 @@ public:
|
|||||||
auto actorName2 = ((Object*)ac2->userData)->GetName();
|
auto actorName2 = ((Object*)ac2->userData)->GetName();
|
||||||
if ((actorName1 == "Space Humster" && actorName2 == "Corvette") || (actorName2 == "Space Humster" && actorName1 == "Corvette"))
|
if ((actorName1 == "Space Humster" && actorName2 == "Corvette") || (actorName2 == "Space Humster" && actorName1 == "Corvette"))
|
||||||
{
|
{
|
||||||
cout << "Znalazles chomika! :)" << endl;
|
checkTimer = frames + 240;
|
||||||
|
msgId = 1;
|
||||||
auto humster = getActor("Space Humster");
|
auto humster = getActor("Space Humster");
|
||||||
((Object*)humster->userData)->exists = false;
|
((Object*)humster->userData)->exists = false;
|
||||||
humster->setActorFlag(PxActorFlag::eDISABLE_SIMULATION, true);
|
humster->setActorFlag(PxActorFlag::eDISABLE_SIMULATION, true);
|
||||||
@ -75,6 +83,7 @@ int SCR_HEIGHT = 720;
|
|||||||
int winId;
|
int winId;
|
||||||
Core::Shader_Loader shaderLoader;
|
Core::Shader_Loader shaderLoader;
|
||||||
|
|
||||||
|
|
||||||
//shader programs
|
//shader programs
|
||||||
GLuint programTex;
|
GLuint programTex;
|
||||||
GLuint programSkybox;
|
GLuint programSkybox;
|
||||||
@ -167,6 +176,7 @@ void SortParticles() {
|
|||||||
std::sort(&ParticlesContainer[0], &ParticlesContainer[MaxParticles]);
|
std::sort(&ParticlesContainer[0], &ParticlesContainer[MaxParticles]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int FindUnusedParticle() {
|
int FindUnusedParticle() {
|
||||||
|
|
||||||
for (int i = LastUsedParticle; i < MaxParticles; i++) {
|
for (int i = LastUsedParticle; i < MaxParticles; i++) {
|
||||||
@ -657,6 +667,16 @@ void updateLights(GLuint program)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void output()
|
||||||
|
{
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
glColor3f(0.0, 1.0, 0.0);
|
||||||
|
glRasterPos2f(-0.1, 0);
|
||||||
|
glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24, (unsigned char*)screenMsg[msgId]);
|
||||||
|
}
|
||||||
|
|
||||||
void renderScene()
|
void renderScene()
|
||||||
{
|
{
|
||||||
cameraMatrix = createCameraMatrix();
|
cameraMatrix = createCameraMatrix();
|
||||||
@ -673,9 +693,14 @@ void renderScene()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
frames++;
|
||||||
|
if (frames<checkTimer)
|
||||||
|
{
|
||||||
|
output();
|
||||||
|
}
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, FBO);
|
glBindFramebuffer(GL_FRAMEBUFFER, FBO);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
@ -810,6 +835,7 @@ void renderScene()
|
|||||||
glutSwapBuffers();
|
glutSwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void initPhysics()
|
void initPhysics()
|
||||||
{
|
{
|
||||||
material = pxScene.physics->createMaterial(0.5, 0.5, 0.5);
|
material = pxScene.physics->createMaterial(0.5, 0.5, 0.5);
|
||||||
|
Loading…
Reference in New Issue
Block a user