summaryrefslogtreecommitdiff
path: root/ivi-layermanagement-examples
diff options
context:
space:
mode:
authorMichael Rodin <mrodin@de.adit-jv.com>2018-11-15 10:52:12 +0100
committerMichael Rodin <mrodin@de.adit-jv.com>2018-11-27 16:51:39 +0100
commit17ceb14ba5ed50f5f6d9507679f4a089c64644e0 (patch)
tree6476cf12c623b433e84ced98abcedf30f05dc38d /ivi-layermanagement-examples
parent9a808a85c79dd689d343d64fc1d7ab37384aec55 (diff)
downloadwayland-ivi-extension-17ceb14ba5ed50f5f6d9507679f4a089c64644e0.tar.gz
EGLWLMockNavigation: MockNavi.cpp: use textures for the car
Load and use car texture in MockNavi::generateCity() if it is available. Signed-off-by: Michael Rodin <mrodin@de.adit-jv.com>
Diffstat (limited to 'ivi-layermanagement-examples')
-rw-r--r--ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp b/ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp
index a6338e6..e73481c 100644
--- a/ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp
+++ b/ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp
@@ -1,6 +1,7 @@
/***************************************************************************
*
* Copyright 2010,2011 BMW Car IT GmbH
+ * Copyright (C) 2018 Advanced Driver Information Technology Joint Venture GmbH
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,6 +24,7 @@
#include "Ground.h"
#include "Car.h"
#include "ShaderLighting.h"
+#include "ShaderTexture.h"
#include <stdlib.h>
#include <unistd.h>
@@ -68,6 +70,9 @@ void MockNavi::generateCity()
{
float* projection = m_camera.getViewProjectionMatrix();
ShaderLighting* pShader = new ShaderLighting(projection);
+ ShaderTexture* pShaderTexture = new ShaderTexture(projection);
+ TextureLoader* carTexture = new TextureLoader;
+ bool carTextureLoaded = carTexture->loadBMP("/usr/share/wayland-ivi-extension/textures/car.bmp");
// generate base plate
vec4f groundColor(0.8, 0.8, 0.6, 1.0);
@@ -95,10 +100,16 @@ void MockNavi::generateCity()
}
// generate car
- vec3f carPosition(1.4 * CITY_GRID_SIZE, 0.001, -0.3);
vec3f carSize(0.2f, 0.2f, 0.3f);
vec4f carColor(0.7, 0.3, 0.3, 1.0);
- Car* car = new Car(carPosition, carSize, carColor, pShader);
+ Car* car = nullptr;
+ if(carTextureLoaded){
+ vec3f carPosition(1.39 * CITY_GRID_SIZE, 0.002, -0.3);
+ car = new Car(carPosition, carSize, carColor, pShaderTexture, carTexture);
+ } else {
+ vec3f carPosition(1.4 * CITY_GRID_SIZE, 0.002, -0.3);
+ car = new Car(carPosition, carSize, carColor, pShader);
+ }
m_renderList.push_back(car);
// generate houses