]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Scene.hh
fixed layer bugs; generalized octree
[chaz/yoink] / src / Moof / Scene.hh
diff --git a/src/Moof/Scene.hh b/src/Moof/Scene.hh
deleted file mode 100644 (file)
index ce57bcd..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-
-/*******************************************************************************
-
- Copyright (c) 2009, Charles McGarvey
- All rights reserved.
- Redistribution   and   use  in  source  and  binary  forms,  with  or  without
- modification, are permitted provided that the following conditions are met:
-   * Redistributions  of  source  code  must retain the above copyright notice,
-     this list of conditions and the following disclaimer.
-   * Redistributions  in binary form must reproduce the above copyright notice,
-     this  list of conditions and the following disclaimer in the documentation
-     and/or other materials provided with the distribution.
- THIS  SOFTWARE  IS  PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND  ANY  EXPRESS  OR  IMPLIED  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED.  IN  NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- FOR  ANY  DIRECT,  INDIRECT,  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES  (INCLUDING,  BUT  NOT  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES;  LOSS  OF  USE,  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*******************************************************************************/
-
-#ifndef _MOOF_SCENE_HH_
-#define _MOOF_SCENE_HH_
-
-#include <string>
-
-#include <boost/shared_ptr.hpp>
-
-#include <Moof/Drawable.hh>
-#include <Moof/Entity.hh>
-#include <Moof/Octree.hh>
-#include <Moof/Resource.hh>
-#include <Moof/Tilemap.hh>
-
-
-namespace Mf {
-
-
-OctreeP loadScene(const std::string& name);
-
-
-class Quad : public Entity
-{
-       Scalar          vertices_[12];
-       Scalar          texCoords_[8];
-       
-       Tilemap         tilemap_;
-
-       bool            blending_;
-       bool            fog_;
-
-public:
-
-       enum SURFACE_TYPE
-       {
-               LEFT    = 1,
-               RIGHT   = 2,
-               TOP             = 3
-       };
-
-       Quad(const Vector3 vertices[4], const std::string& texture,
-                       Tilemap::Index tileIndex) :
-               tilemap_(texture),
-               blending_(false),
-               fog_(false)
-       {
-               for (int i = 0, num = 0; i < 4; ++i)
-               {
-                       for (int j = 0; j < 3; ++j, ++num)
-                       {
-                               vertices_[num] = vertices[i][j];
-                       }
-               }
-
-               if (!tilemap_.getTileCoords(tileIndex, texCoords_))
-               {
-                       logWarning("no index %d in texture %s", tileIndex,
-                                       texture.c_str());
-
-                       texCoords_[0] = texCoords_[1] =
-                               texCoords_[3] = texCoords_[6] = 0.0;
-                       texCoords_[2] = texCoords_[4] =
-                               texCoords_[5] = texCoords_[7] = 1.0;
-               }
-
-               aabb_.encloseVertices(vertices, 4);
-               sphere_.point = aabb_.getCenter();
-               sphere_.radius = (aabb_.min - sphere_.point).length();
-       }
-
-       void setBlending(bool blending)
-       {
-               blending_ = blending;
-       }
-
-       void setFog(bool fog)
-       {
-               fog_ = fog;
-       }
-
-       void draw(Scalar alpha = 0.0) const
-       {
-               if (blending_)
-               {
-                       glEnable(GL_BLEND);
-                       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-               }
-
-               if (fog_)
-               {
-                       glEnable(GL_FOG);
-                       glFogi(GL_FOG_MODE, GL_LINEAR);
-               }
-
-               glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
-               tilemap_.bind();
-
-               glVertexPointer(3, GL_SCALAR, 0, vertices_);
-               glTexCoordPointer(2, GL_SCALAR, 0, texCoords_);
-
-               glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
-               glDisable(GL_BLEND);
-               glDisable(GL_FOG);
-       }
-
-       bool isVisible(const Frustum& frustum) const
-       {
-               return sphere_.isVisible(frustum);
-       }
-};
-
-
-} // namespace Mf
-
-#endif // _MOOF_SCENE_HH_
-
-/** vim: set ts=4 sw=4 tw=80: *************************************************/
-
This page took 0.019258 seconds and 4 git commands to generate.