From 17ceb14ba5ed50f5f6d9507679f4a089c64644e0 Mon Sep 17 00:00:00 2001 From: Michael Rodin Date: Thu, 15 Nov 2018 10:52:12 +0100 Subject: 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 --- .../EGLWLMockNavigation/src/MockNavi.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ivi-layermanagement-examples') 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 #include @@ -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 -- cgit v1.2.1