Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
BatchPage.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------------------
2Copyright (c) 2006 John Judnich
3
4This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
5Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
61. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
72. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
83. This notice may not be removed or altered from any source distribution.
9-------------------------------------------------------------------------------------*/
10
13//-------------------------------------------------------------------------------------
14#ifndef __BatchPage_H__
15#define __BatchPage_H__
16
17#include "PagedGeometry.h"
18#include "BatchedGeometry.h"
19
20#include <OgrePrerequisites.h>
21#include <OgreStringConverter.h>
22
23namespace Forests
24{
25
47 class BatchPage: public GeometryPage
48 {
49 typedef std::vector<Ogre::MaterialPtr> TMaterials;
50 public:
52 BatchPage();
53 ~BatchPage();
54
56 void init(PagedGeometry *geom, const Ogre::Any &data);
57
58 void addEntity(Ogre::Entity *ent, const Ogre::Vector3 &position, const Ogre::Quaternion &rotation,
59 const Ogre::Vector3 &scale, const Ogre::ColourValue &color);
60 void removeEntities();
61
62 void build();
63
64 void setVisible(bool visible);
65 void setFade(bool enabled, Ogre::Real visibleDist, Ogre::Real invisibleDist);
66
68 {
69 int a = 0;
70 a++;
71 }
72
74 {
75 int a = 0;
76 a++;
77 }
78
79 const Ogre::AxisAlignedBox &getBoundingBox() { return m_pBatchGeom->getBoundingBox(); }
80
81 protected :
82 virtual void _updateShaders();
83
84 private:
85 static Ogre::String getUniqueID(const Ogre::String &prefix)
86 {
87 return prefix + Ogre::StringConverter::toString(++s_nGUID);
88 }
89
90 // Data section of class BatchPage
91 protected:
93 Ogre::SceneManager* m_pSceneMgr;
98 Ogre::Real m_fVisibleDist;
99 Ogre::Real m_fInvisibleDist;
101
102 protected:
103 static unsigned long s_nRefCount;
104 static unsigned long s_nGUID;
105 };
106
107}
108
109#endif
The BatchPage class renders entities as StaticGeometry.
Definition BatchPage.h:48
virtual void _updateShaders()
void init(PagedGeometry *geom, const Ogre::Any &data)
Replace pure virtual GeometryPage::init.
Definition BatchPage.cpp:58
static Ogre::String getUniqueID(const Ogre::String &prefix)
Definition BatchPage.h:85
static unsigned long s_nGUID
Definition BatchPage.h:104
PagedGeometry * m_pPagedGeom
Definition BatchPage.h:92
void addEntity(Ogre::Entity *ent, const Ogre::Vector3 &position, const Ogre::Quaternion &rotation, const Ogre::Vector3 &scale, const Ogre::ColourValue &color)
Add an entity to the page, at the specified position, rotation, and scale.
Definition BatchPage.cpp:96
Ogre::Real m_fVisibleDist
Definition BatchPage.h:98
void removeEntities()
Remove all geometry/entities from the page completely.
BatchPage()
Default constructor.
Definition BatchPage.cpp:42
void addEntityToBoundingBox()
Definition BatchPage.h:67
BatchedGeometry * m_pBatchGeom
Definition BatchPage.h:94
TMaterials m_vecUnfadedMaterials
Definition BatchPage.h:100
Ogre::SceneManager * m_pSceneMgr
Definition BatchPage.h:93
void build()
Perform any final steps to make added entities appear in the scene.
static unsigned long s_nRefCount
Definition BatchPage.h:103
const Ogre::AxisAlignedBox & getBoundingBox()
Advanced: Return the bounding box computed with addEntityToBoundingBox()
Definition BatchPage.h:79
std::vector< Ogre::MaterialPtr > TMaterials
Definition BatchPage.h:49
Ogre::Real m_fInvisibleDist
Definition BatchPage.h:99
void setFade(bool enabled, Ogre::Real visibleDist, Ogre::Real invisibleDist)
Sets fade behavior for this page.
void clearBoundingBox()
Advanced: Reset the bounding box used by addEntityToBoundingBox()
Definition BatchPage.h:73
void setVisible(bool visible)
Toggle the entire page's visibility.
A "lightweight" version of Ogre::StaticGeometry, which gives you a little more control over the batch...
const Ogre::AxisAlignedBox & getBoundingBox(void) const
This base-class can be extended to provide different ways of representing entities.
A class providing highly optimized methods for rendering massive amounts of geometry.