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)
DLLEXPORT void Release (Ogre::SceneManager *scene)
 Destroys GraphicalObject. More...
- 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
- Public Attributes inherited from Leviathan::Component
bool Marked
 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 297 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 

Definition at line 51 of file Components.cpp.

52  :
53  Component(TYPE),
54  GeneratedMeshName("Plane_Component_Mesh_" + std::to_string(IDFactory::GetID()))
55 {
56  const auto mesh = Ogre::v1::MeshManager::getSingleton().createPlane(
57  GeneratedMeshName + "_v1", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
58  plane, size.X, size.Y, 1, 1,
59  // Normals
60  true, 1, 1.0f, 1.0f, Ogre::Vector3::UNIT_Y,
61  Ogre::v1::HardwareBuffer::HBU_STATIC_WRITE_ONLY,
62  Ogre::v1::HardwareBuffer::HBU_STATIC_WRITE_ONLY, false, false);
64  const auto mesh2 = Ogre::MeshManager::getSingleton().createManual(
65  GeneratedMeshName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
67  // Fourth true is qtangent encoding which is not needed if we don't do normal mapping
68  mesh2->importV1(mesh.get(), true, true, true);
70  Ogre::v1::MeshManager::getSingleton().remove(mesh);
72  GraphicalObject = scene->createItem(mesh2);
73  parent->attachObject(GraphicalObject);
75  // This DOESN'T seem to throw if material is invalid
76  GraphicalObject->setMaterialName(material);
77 }
Component(COMPONENT_TYPE type)
Definition: Component.h:55
static constexpr auto TYPE
Definition: Components.h:312
static int GetID()
Definition: IDFactory.h:17
Ogre::Item * GraphicalObject
The plane that this component creates.
Definition: Components.h:308
const std::string GeneratedMeshName
Definition: Components.h:310

Member Function Documentation



◆ Release()

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

Destroys GraphicalObject.

Definition at line 79 of file Components.cpp.

80 {
82  scene->destroyItem(GraphicalObject);
84  Ogre::MeshManager::getSingleton().remove(GeneratedMeshName);
85 }
Ogre::Item * GraphicalObject
The plane that this component creates.
Definition: Components.h:308
const std::string GeneratedMeshName
Definition: Components.h:310

Member Data Documentation

◆ GeneratedMeshName

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

Definition at line 310 of file Components.h.

◆ GraphicalObject

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

The plane that this component creates.

Definition at line 308 of file Components.h.


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

Definition at line 312 of file Components.h.

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