summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Rodin <mrodin@de.adit-jv.com>2018-11-20 13:58:00 +0100
committerMichael Rodin <mrodin@de.adit-jv.com>2018-12-03 10:27:17 +0100
commit61365c002fcd30006337c2dc0ef0bd7abd8ecbc1 (patch)
tree971aa23dd1335e3542b6a80f09a6c5d3aa92ddde
parent3c4b3a7c25c57d00b1d2e1c01327f355ed96e5fc (diff)
downloadwayland-ivi-extension-61365c002fcd30006337c2dc0ef0bd7abd8ecbc1.tar.gz
EGLWLMockNavigation: class MockNavi: render Sky with colors
Use the Sky class in MockNavi::generateCity() for rendering the sky if there was no command line option "-nosky" specified. Signed-off-by: Michael Rodin <mrodin@de.adit-jv.com>
-rw-r--r--ivi-layermanagement-examples/EGLWLMockNavigation/include/MockNavi.h4
-rw-r--r--ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp14
2 files changed, 18 insertions, 0 deletions
diff --git a/ivi-layermanagement-examples/EGLWLMockNavigation/include/MockNavi.h b/ivi-layermanagement-examples/EGLWLMockNavigation/include/MockNavi.h
index 118f38f..679b2ba 100644
--- a/ivi-layermanagement-examples/EGLWLMockNavigation/include/MockNavi.h
+++ b/ivi-layermanagement-examples/EGLWLMockNavigation/include/MockNavi.h
@@ -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");
@@ -25,6 +26,7 @@
#include "Camera.h"
#include "ShaderLighting.h"
#include "ShaderTexture.h"
+#include "ShaderGradient.h"
#include <list>
using std::list;
@@ -50,6 +52,8 @@ private:
list<IUpdateable*> m_updateList;
ShaderLighting* pShader = nullptr;
ShaderTexture* pShaderTexture = nullptr;
+ ShaderGradient* pShaderGradient = nullptr;
+ bool nosky;
};
#endif /* _MOCKNAVI_H */
diff --git a/ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp b/ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp
index 63ed3d3..3c04dc7 100644
--- a/ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp
+++ b/ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp
@@ -23,6 +23,7 @@
#include "Street.h"
#include "Ground.h"
#include "Car.h"
+#include "Sky.h"
#include <stdlib.h>
#include <unistd.h>
@@ -34,6 +35,7 @@ MockNavi::MockNavi(float fps, float animationSpeed, SurfaceConfiguration* config
: OpenGLES2App(fps, animationSpeed, config)
, m_camera(vec3f(-1.5 * CITY_GRID_SIZE, -0.1, 0.0), vec3f(0.0, 0.0, 0.0), config->surfaceWidth, config->surfaceHeight)
, m_houseCount(15)
+, nosky(config->nosky)
{
generateCity();
}
@@ -42,6 +44,7 @@ MockNavi::~MockNavi()
{
delete pShader;
delete pShaderTexture;
+ delete pShaderGradient;
}
void MockNavi::update(int currentTimeInMs, int lastFrameTime)
@@ -75,6 +78,7 @@ void MockNavi::generateCity()
float* projection = m_camera.getViewProjectionMatrix();
pShader = new ShaderLighting(projection);
pShaderTexture = new ShaderTexture(projection);
+ pShaderGradient = new ShaderGradient();
TextureLoader* carTexture = new TextureLoader;
bool carTextureLoaded = carTexture->loadBMP("/usr/share/wayland-ivi-extension/textures/car.bmp");
TextureLoader* streetTexture = new TextureLoader;
@@ -95,6 +99,16 @@ void MockNavi::generateCity()
houseTextures.push_back(houseTexture);
}
+ // generate sky
+ if (not nosky) {
+ vec4f skyColor(0.0, 0.0, 1.0, 1.0);
+ vec3f skyPosition = vec3f(-1.0, -1.0, 1.0);
+ vec3f skySize = vec3f(2.0, 2.0, 0.0);
+ Sky* sky = new Sky(skyPosition, skySize, skyColor, pShaderGradient);
+ m_renderList.push_back(sky);
+ m_updateList.push_back(sky);
+ }
+
// generate base plate
vec4f groundColor(0.8, 0.8, 0.6, 1.0);
vec3f position = vec3f(0.0, -0.001, 0.0);