This commit is contained in:
xkamikoo 2021-02-25 01:37:56 +01:00
commit 5e8f2b8330
2 changed files with 31 additions and 5 deletions

View File

@ -59,7 +59,7 @@
<ProjectGuid>{1B448102-E76C-4347-BDC7-40D02A567DB6}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>grk-cw9</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>grk-project</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
@ -67,14 +67,14 @@
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">

View File

@ -2,6 +2,7 @@
#include <cmath>
#include <ctime>
#include <vector>
#include <string>
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
@ -19,6 +20,12 @@
#include <WinUser.h>
#define STB_IMAGE_IMPLEMENTATION
#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);
static PxFilterFlags simulationFilterShader(PxFilterObjectAttributes attributes0,
@ -48,7 +55,8 @@ public:
auto actorName2 = ((Object*)ac2->userData)->GetName();
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");
((Object*)humster->userData)->exists = false;
humster->setActorFlag(PxActorFlag::eDISABLE_SIMULATION, true);
@ -75,6 +83,7 @@ int SCR_HEIGHT = 720;
int winId;
Core::Shader_Loader shaderLoader;
//shader programs
GLuint programTex;
GLuint programSkybox;
@ -167,6 +176,7 @@ void SortParticles() {
std::sort(&ParticlesContainer[0], &ParticlesContainer[MaxParticles]);
}
int FindUnusedParticle() {
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()
{
cameraMatrix = createCameraMatrix();
@ -673,9 +693,14 @@ void renderScene()
}
}
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
frames++;
if (frames<checkTimer)
{
output();
}
glBindFramebuffer(GL_FRAMEBUFFER, FBO);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@ -810,6 +835,7 @@ void renderScene()
glutSwapBuffers();
}
void initPhysics()
{
material = pxScene.physics->createMaterial(0.5, 0.5, 0.5);