couch/core/Spatial.h

94 lines
2.5 KiB
C
Raw Permalink Normal View History

2021-01-26 23:28:20 -06:00
/**
@file
@author Dane Johnson <dane@danejohnson.org>
@section LICENSE
Couch Copyright (C) 2021 Dane Johnson
This program comes with ABSOLUTELY NO WARRANTY; without event the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for details at
https://www.gnu.org/licenses/gpl-3.0.html
This is free software, and you are welcome to redistribute 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.
@section DESCRIPTION
A spatial is a node with a transform property, i.e. position, scale or rotation.
They can be instanced on the scene tree as an anchor for some other nodes.
*/
2021-01-14 11:52:01 -06:00
#ifndef SPATIAL_H
#define SPATIAL_H
2021-01-26 23:28:20 -06:00
#include "types.h"
2021-01-14 11:52:01 -06:00
#include "Node.h"
#include "Transform.h"
2021-01-26 23:28:20 -06:00
/**
Spatial nodes have a transform property. They can be subclassed or instanced
as an anchor for their children.
*/
class Spatial : public Node {
2021-01-14 11:52:01 -06:00
public:
2021-01-21 15:26:39 -06:00
virtual Name GetType() const;
2021-01-26 23:28:20 -06:00
/**
Gets the transform property of this spatial
@return The transform
*/
Transform GetTransform();
/**
Sets the transform property of this spatial.
@param transform The transform property
*/
void SetTransform(Transform transform);
2021-01-30 19:39:25 -06:00
/**
Gets the translation with relation to the world origin
@returns the global transform
*/
Transform GetGlobalTransform();
/**
Sets the transform with relation to the world origin
@param globalTransform The global transform property
*/
void SetGlobalTransform(Transform globalTransform);
2021-01-26 23:28:20 -06:00
/**
Directly translates the spatial by offset
@param offset The offset of the transform operation
*/
2021-01-27 00:01:17 -06:00
virtual void Translate(Vector3 offset);
2021-01-26 23:28:20 -06:00
/**
Rotates the Camera phi radians about the X axis
@param phi The amount to rotate in radians
*/
void RotateX(float phi);
2021-01-26 23:28:20 -06:00
/**
Rotates the Camera phi radians about the Y axis
@param phi The amount to rotate in radians
*/
void RotateY(float phi);
2021-01-26 23:28:20 -06:00
/**
Rotates the Camera phi radians about the Z axis
@param phi The amount to rotate in radians
*/
void RotateZ(float phi);
2021-01-26 23:28:20 -06:00
/**
Scales the spatial by scale uniformly
@param scale The amount to scale by.
*/
void UniformScale(float scale);
2021-01-26 23:28:20 -06:00
2021-01-24 16:37:35 -06:00
virtual Spatial *Create();
virtual Spatial *Duplicate();
virtual Spatial *Instance();
2021-01-26 23:28:20 -06:00
private:
Transform transform;
2021-01-14 11:52:01 -06:00
};
#endif /* SPATIAL_H */