diff options
author | Jesse Barker <jesse.barker@linaro.org> | 2012-10-19 06:19:19 -0700 |
---|---|---|
committer | Jesse Barker <jesse.barker@linaro.org> | 2012-10-19 06:19:19 -0700 |
commit | bd764cff0bd3ee3def85317ec4e84cd2d941824d (patch) | |
tree | 07d58f5a3f6a17b9bc18e86885fc05fc1762f11f | |
parent | 0cd473c5d57f26fbbe49a2ad8a27d95bd735c723 (diff) | |
download | glmark2-bd764cff0bd3ee3def85317ec4e84cd2d941824d.tar.gz |
SceneShadow: Add the skeleton (stubs for derived scene members only) of a new
shadow mapping scene. When complete, the scene will render geometry into a
depth texture from the point of view of the light source for the scene, then
render the "ground" onto which a shadow of the object would be projected (the
depth values from the texture will be used for a distance-from-light
comparison with the actual object), and finally render the actual object, which
appears to be casting a shadow.
-rw-r--r-- | src/android.cpp | 1 | ||||
-rw-r--r-- | src/default-benchmarks.h | 1 | ||||
-rw-r--r-- | src/main.cpp | 1 | ||||
-rw-r--r-- | src/scene-shadow.cpp | 97 | ||||
-rw-r--r-- | src/scene.h | 18 |
5 files changed, 118 insertions, 0 deletions
diff --git a/src/android.cpp b/src/android.cpp index d9678f4..53a17f7 100644 --- a/src/android.cpp +++ b/src/android.cpp @@ -275,6 +275,7 @@ create_and_add_scenes(std::vector<Scene*>& scenes, Canvas& canvas) scenes.push_back(new SceneIdeas(canvas)); scenes.push_back(new SceneTerrain(canvas)); scenes.push_back(new SceneJellyfish(canvas)); + scenes.push_back(new SceneShadow(canvas)); } diff --git a/src/default-benchmarks.h b/src/default-benchmarks.h index d121e30..45f7672 100644 --- a/src/default-benchmarks.h +++ b/src/default-benchmarks.h @@ -63,6 +63,7 @@ private: benchmarks.push_back("ideas:speed=duration"); benchmarks.push_back("jellyfish"); benchmarks.push_back("terrain"); + benchmarks.push_back("shadow"); benchmarks.push_back("conditionals:vertex-steps=0:fragment-steps=0"); benchmarks.push_back("conditionals:vertex-steps=0:fragment-steps=5"); benchmarks.push_back("conditionals:vertex-steps=5:fragment-steps=0"); diff --git a/src/main.cpp b/src/main.cpp index 36cdf7b..d310a51 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -63,6 +63,7 @@ add_and_register_scenes(vector<Scene*>& scenes, Canvas& canvas) scenes.push_back(new SceneIdeas(canvas)); scenes.push_back(new SceneTerrain(canvas)); scenes.push_back(new SceneJellyfish(canvas)); + scenes.push_back(new SceneShadow(canvas)); for (vector<Scene*>::const_iterator iter = scenes.begin(); iter != scenes.end(); diff --git a/src/scene-shadow.cpp b/src/scene-shadow.cpp new file mode 100644 index 0000000..f7c303c --- /dev/null +++ b/src/scene-shadow.cpp @@ -0,0 +1,97 @@ +// +// Copyright © 2012 Linaro Limited +// +// This file is part of the glmark2 OpenGL (ES) 2.0 benchmark. +// +// glmark2 is free software: you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the Free Software +// Foundation, either version 3 of the License, or (at your option) any later +// version. +// +// glmark2 is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// glmark2. If not, see <http://www.gnu.org/licenses/>. +// +// Authors: +// Jesse Barker +// +#include "scene.h" +#include "util.h" + +class ShadowPrivate +{ +}; + +SceneShadow::SceneShadow(Canvas& canvas) : + Scene(canvas, "shadow"), + priv_(0) +{ +} + +SceneShadow::~SceneShadow() +{ + delete priv_; +} + +bool +SceneShadow::supported(bool show_errors) +{ + return show_errors; +} + +bool +SceneShadow::load() +{ + running_ = false; + return true; +} + +void +SceneShadow::unload() +{ +} + +bool +SceneShadow::setup() +{ + if (!Scene::setup()) + return false; + + priv_ = new ShadowPrivate(); + // Set core scene timing after actual initialization so we don't measure + // set up time. + startTime_ = Util::get_timestamp_us() / 1000000.0; + lastUpdateTime_ = startTime_; + running_ = true; + + return true; +} + +void +SceneShadow::teardown() +{ + // Add scene-specific teardown here + Scene::teardown(); +} + +void +SceneShadow::update() +{ + Scene::update(); + // Add scene-specific update here +} + +void +SceneShadow::draw() +{ +} + +Scene::ValidationResult +SceneShadow::validate() +{ + return Scene::ValidationUnknown; +} diff --git a/src/scene.h b/src/scene.h index a455fbd..dd77ba9 100644 --- a/src/scene.h +++ b/src/scene.h @@ -556,4 +556,22 @@ public: void draw(); ValidationResult validate(); }; + +class ShadowPrivate; +class SceneShadow : public Scene +{ + ShadowPrivate* priv_; +public: + SceneShadow(Canvas& canvas); + ~SceneShadow(); + bool supported(bool show_errors); + bool load(); + void unload(); + bool setup(); + void teardown(); + void update(); + void draw(); + ValidationResult validate(); +}; + #endif |