wojtek #1

Merged
s444341 merged 3 commits from wojtek into master 2021-02-01 10:03:12 +01:00
3 changed files with 37 additions and 4 deletions
Showing only changes of commit c943b35d3c - Show all commits

16
models/plane2.obj Normal file
View File

@ -0,0 +1,16 @@
# Blender v2.91.2 OBJ File: ''
# www.blender.org
mtllib plane2.mtl
o Prostokąt
v 0.000219 5000.000000 5000.000000
v -0.000219 -5000.000000 5000.000000
v 0.000219 5000.000000 -5000.000000
v -0.000219 -5000.000000 -5000.000000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vn 1.0000 -0.0000 0.0000
usemtl None
s off
f 1/1/1 2/2/1 4/3/1 3/4/1

View File

@ -32,9 +32,9 @@ obj::Model craneModel;
obj::Model lampModel;
glm::mat4 boxModelMatrix;
Core::RenderContext planeContext, boxContext, shipContext, boosterContext, platformContext, craneContext, lampContext;
GLuint boxTexture, groundTexture, shipTexture, stoneTexture, redTex;
GLuint boxTexture, groundTexture, shipTexture, stoneTexture, redTex, yellowTex;
glm::vec3 cameraPos = glm::vec3(0, 5, 40);
glm::vec3 cameraPos = glm::vec3(-40, 5, 0);
glm::vec3 cameraDir;
glm::vec3 cameraSide;
float cameraAngle = 0;
@ -84,7 +84,7 @@ std::vector<Renderable*> renderables;
void initRenderables()
{
// load models
planeModel = obj::loadModelFromFile("models/plane.obj");
planeModel = obj::loadModelFromFile("models/plane2.obj");
boxModel = obj::loadModelFromFile("models/box.obj");
shipModel = obj::loadModelFromFile("models/ship.obj");
boosterModel = obj::loadModelFromFile("models/booster.obj");
@ -106,6 +106,7 @@ void initRenderables()
shipTexture = Core::LoadTexture("textures/ship.png");
stoneTexture = Core::LoadTexture("textures/stone.png");
redTex = Core::LoadTexture("textures/redTex.png");
yellowTex = Core::LoadTexture("textures/yellowTex.jpg");
// This time we organize all the renderables in a list
// of basic properties (model, transform, texture),
@ -127,6 +128,22 @@ void initRenderables()
spaceship->context = &shipContext;
spaceship->textureId = shipTexture;
renderables.emplace_back(spaceship);
Renderable* platform = new Renderable();
platform->context = &platformContext;
platform->textureId = stoneTexture;
renderables.emplace_back(platform);
Renderable* crane = new Renderable();
crane->context = &craneContext;
crane->textureId = redTex;
renderables.emplace_back(crane);
Renderable* lamp = new Renderable();
lamp->context = &lampContext;
lamp->textureId = yellowTex;
renderables.emplace_back(lamp);
}
void initPhysicsScene()
@ -219,7 +236,7 @@ void mouse(int x, int y)
glm::mat4 createCameraMatrix()
{
cameraDir = glm::normalize(glm::vec3(cosf(cameraAngle - glm::radians(90.0f)), 0, sinf(cameraAngle - glm::radians(90.0f))));
cameraDir = glm::normalize(glm::vec3(cosf(cameraAngle ), 0, sinf(cameraAngle )));
glm::vec3 up = glm::vec3(0, 1, 0);
cameraSide = glm::cross(cameraDir, up);

BIN
textures/yellowTex.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB