Leviathan  0.8.0.0
Leviathan game engine
Leviathan::Plane Class Reference

Plane component. More...

#include <Components.h>

+ Inheritance diagram for Leviathan::Plane:

Public Member Functions

DLLEXPORT Plane (Ogre::SceneManager *scene, Ogre::SceneNode *parent, const std::string &material, const Ogre::Plane &plane, const Float2 &size, const Ogre::Vector3 &uvupvector=Ogre::Vector3::UNIT_Y)
 
DLLEXPORT void Release (Ogre::SceneManager *scene)
 Destroys GraphicalObject. More...
 
 REFERENCE_HANDLE_UNCOUNTED_TYPE (Plane)
 
- Public Member Functions inherited from Leviathan::Component
 Component (COMPONENT_TYPE type)
 
 Component (const Component &)=delete
 
Componentoperator= (const Component &)=delete
 

Public Attributes

Ogre::Item * GraphicalObject = nullptr
 The plane that this component creates. More...
 
const std::string GeneratedMeshName
 
std::string Material
 
Ogre::Plane PlaneDefinition
 
Float2 Size
 
Float3 UpVector
 
- Public Attributes inherited from Leviathan::Component
bool Marked
 
const COMPONENT_TYPE Type
 Type of this component, used for network serialization. More...
 

Static Public Attributes

static constexpr auto TYPE = COMPONENT_TYPE::Plane
 

Detailed Description

Plane component.

Creates a static mesh for this

Definition at line 304 of file Components.h.

Constructor & Destructor Documentation

◆ Plane()

DLLEXPORT Plane::Plane ( Ogre::SceneManager *  scene,
Ogre::SceneNode *  parent,
const std::string &  material,
const Ogre::Plane &  plane,
const Float2 size,
const Ogre::Vector3 &  uvupvector = Ogre::Vector3::UNIT_Y 
)

Definition at line 63 of file Components.cpp.

65  :
66  Component(TYPE),
67  GeneratedMeshName("Plane_Component_Mesh_" + std::to_string(IDFactory::GetID())),
68  Material(material), PlaneDefinition(plane), Size(size), UpVector(uvupvector)
69 {
70  const auto mesh = Ogre::v1::MeshManager::getSingleton().createPlane(
71  GeneratedMeshName + "_v1", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
72  plane, size.X, size.Y, 1, 1,
73  // Normals
74  true, 1, 1.0f, 1.0f, uvupvector, Ogre::v1::HardwareBuffer::HBU_STATIC_WRITE_ONLY,
75  Ogre::v1::HardwareBuffer::HBU_STATIC_WRITE_ONLY, false, false);
76 
77  const auto mesh2 = Ogre::MeshManager::getSingleton().createManual(
78  GeneratedMeshName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
79 
80  // Fourth true is qtangent encoding which is not needed if we don't do normal mapping
81  mesh2->importV1(mesh.get(), true, true, true);
82 
83  Ogre::v1::MeshManager::getSingleton().remove(mesh);
84 
85  GraphicalObject = scene->createItem(mesh2);
86  parent->attachObject(GraphicalObject);
87 
88  // This DOESN'T seem to throw if material is invalid
89  GraphicalObject->setDatablockOrMaterialName(material);
90 
91  GraphicalObject->setRenderQueueGroup(DEFAULT_RENDER_QUEUE);
92 }
std::string Material
Definition: Components.h:321
Ogre::Plane PlaneDefinition
Definition: Components.h:322
Component(COMPONENT_TYPE type)
Definition: Component.h:54
static constexpr auto TYPE
Definition: Components.h:326
static int GetID()
Definition: IDFactory.h:17
constexpr auto DEFAULT_RENDER_QUEUE
Definition: EntityCommon.h:16
Ogre::Item * GraphicalObject
The plane that this component creates.
Definition: Components.h:316
const std::string GeneratedMeshName
Definition: Components.h:318

Member Function Documentation

◆ REFERENCE_HANDLE_UNCOUNTED_TYPE()

Leviathan::Plane::REFERENCE_HANDLE_UNCOUNTED_TYPE ( Plane  )

◆ Release()

DLLEXPORT void Plane::Release ( Ogre::SceneManager *  scene)

Destroys GraphicalObject.

Definition at line 94 of file Components.cpp.

95 {
96  scene->destroyItem(GraphicalObject);
97 
98  Ogre::MeshManager::getSingleton().remove(GeneratedMeshName);
99 }
Ogre::Item * GraphicalObject
The plane that this component creates.
Definition: Components.h:316
const std::string GeneratedMeshName
Definition: Components.h:318

Member Data Documentation

◆ GeneratedMeshName

const std::string Leviathan::Plane::GeneratedMeshName

Definition at line 318 of file Components.h.

◆ GraphicalObject

Ogre::Item* Leviathan::Plane::GraphicalObject = nullptr

The plane that this component creates.

Definition at line 316 of file Components.h.

◆ Material

std::string Leviathan::Plane::Material

Definition at line 321 of file Components.h.

◆ PlaneDefinition

Ogre::Plane Leviathan::Plane::PlaneDefinition

Definition at line 322 of file Components.h.

◆ Size

Float2 Leviathan::Plane::Size

Definition at line 323 of file Components.h.

◆ TYPE

constexpr auto Leviathan::Plane::TYPE = COMPONENT_TYPE::Plane
static

Definition at line 326 of file Components.h.

◆ UpVector

Float3 Leviathan::Plane::UpVector

Definition at line 324 of file Components.h.


The documentation for this class was generated from the following files: