diff options
author | Michael Rodin <mrodin@de.adit-jv.com> | 2018-11-19 09:48:25 +0100 |
---|---|---|
committer | Michael Rodin <mrodin@de.adit-jv.com> | 2018-11-27 16:51:39 +0100 |
commit | d8f43e6e099176094dc5473d05b5676b84a96336 (patch) | |
tree | 749964d309b56a2b2fef25f14291308b3685ea46 | |
parent | 779ec7e09eae5be7d609f0706d8cd19510fca96c (diff) | |
download | wayland-ivi-extension-d8f43e6e099176094dc5473d05b5676b84a96336.tar.gz |
EGLWLMockNavigation: MockNavi.cpp: use textures for House
Load and use textures for houses in MockNavi::generateCity().
Multiple textures are used if they are available.
Signed-off-by: Michael Rodin <mrodin@de.adit-jv.com>
-rw-r--r-- | ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp b/ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp index 18eb2f2..8a2f928 100644 --- a/ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp +++ b/ivi-layermanagement-examples/EGLWLMockNavigation/src/MockNavi.cpp @@ -75,6 +75,21 @@ void MockNavi::generateCity() bool carTextureLoaded = carTexture->loadBMP("/usr/share/wayland-ivi-extension/textures/car.bmp"); TextureLoader* streetTexture = new TextureLoader; bool streetTextureLoaded = streetTexture->loadBMP("/usr/share/wayland-ivi-extension/textures/street.bmp"); + list<TextureLoader*> houseTextures; + for(int i = 0; i < m_houseCount; i++){ + TextureLoader* houseTexture = new TextureLoader; + std::string houseTexturePathString = "/usr/share/wayland-ivi-extension/textures/skyscrapers/facade0"; + houseTexturePathString.append(std::to_string(i)); + houseTexturePathString.append(".bmp"); + char houseTexturePath[houseTexturePathString.size() + 1]; + houseTexturePathString.copy(houseTexturePath, houseTexturePathString.size() + 1); + houseTexturePath[houseTexturePathString.size()] = '\0'; + bool houseTextureLoaded = houseTexture->loadBMP(houseTexturePath); + if(not houseTextureLoaded){ + break; + } + houseTextures.push_back(houseTexture); + } // generate base plate vec4f groundColor(0.8, 0.8, 0.6, 1.0); @@ -137,7 +152,17 @@ void MockNavi::generateCity() vec3f housePosition(posx, posy, posz); vec3f houseSize(1.0, 1.0, 1.0); - House* obj = new House(housePosition, houseSize, houseColor, pShader); + TextureLoader* houseTexture = houseTextures.front(); + + House* obj = nullptr; + + if(houseTexture == nullptr){ + obj = new House(housePosition, houseSize, houseColor, pShader); + } else { + houseTextures.pop_front(); + obj = new House(housePosition, houseSize, houseColor, pShaderTexture, houseTexture); + houseTextures.push_back(houseTexture); + } m_renderList.push_back(obj); m_updateList.push_back(obj); |