45 #ifndef __CU_PERSPECTIVE_CAMERA_H__
46 #define __CU_PERSPECTIVE_CAMERA_H__
51 #define DEFAULT_CAMERA_FOV 67
71 #pragma mark Constructors
79 _fieldOfView = 0; _initialized =
false;
108 bool init(
const Size& size,
float fieldOfView = DEFAULT_CAMERA_FOV) {
128 bool init(
float width,
float height,
float fieldOfView = DEFAULT_CAMERA_FOV) {
129 return init(0,0,width,height,fieldOfView);
150 bool init(
const Rect& rect,
float fieldOfView = DEFAULT_CAMERA_FOV) {
173 bool init(
const Vec2& origin,
const Size& size,
float fieldOfView = DEFAULT_CAMERA_FOV) {
198 bool init(
float x,
float y,
float width,
float height,
float fieldOfView = DEFAULT_CAMERA_FOV);
201 #pragma mark Static Constructors
217 static std::shared_ptr<PerspectiveCamera>
alloc(
const Size& size,
float fieldOfView = DEFAULT_CAMERA_FOV) {
218 std::shared_ptr<PerspectiveCamera> result = std::make_shared<PerspectiveCamera>();
219 return (result->init(size,fieldOfView) ? result :
nullptr);
238 static std::shared_ptr<PerspectiveCamera>
alloc(
float width,
float height,
239 float fieldOfView = DEFAULT_CAMERA_FOV) {
240 std::shared_ptr<PerspectiveCamera> result = std::make_shared<PerspectiveCamera>();
241 return (result->init(width,height,fieldOfView) ? result :
nullptr);
262 static std::shared_ptr<PerspectiveCamera>
alloc(
const Rect& rect,
float fieldOfView = DEFAULT_CAMERA_FOV) {
263 std::shared_ptr<PerspectiveCamera> result = std::make_shared<PerspectiveCamera>();
264 return (result->init(rect,fieldOfView) ? result :
nullptr);
286 static std::shared_ptr<PerspectiveCamera>
alloc(
const Vec2& origin,
const Size& size,
287 float fieldOfView = DEFAULT_CAMERA_FOV) {
288 std::shared_ptr<PerspectiveCamera> result = std::make_shared<PerspectiveCamera>();
289 return (result->init(origin,size,fieldOfView) ? result :
nullptr);
313 static std::shared_ptr<PerspectiveCamera>
alloc(
float x,
float y,
float width,
float height,
314 float fieldOfView = DEFAULT_CAMERA_FOV) {
315 std::shared_ptr<PerspectiveCamera> result = std::make_shared<PerspectiveCamera>();
316 return (result->init(x,y,width,height,fieldOfView) ? result :
nullptr);
334 void set(
const Size& size,
float fieldOfView = DEFAULT_CAMERA_FOV) {
352 void set(
float width,
float height,
float fieldOfView = DEFAULT_CAMERA_FOV) {
353 set(0, 0, width, height, fieldOfView);
372 void set(
const Rect& rect,
float fieldOfView = DEFAULT_CAMERA_FOV) {
393 void set(
const Vec2& origin,
const Size& size,
float fieldOfView = DEFAULT_CAMERA_FOV) {
416 void set(
float x,
float y,
float width,
float height,
float fieldOfView = DEFAULT_CAMERA_FOV);
426 #pragma mark Attributes
bool _initialized
Definition: CUPerspectiveCamera.h:68
float x
Definition: CUVec2.h:66
void setFieldOfView(float fov)
float y
Definition: CUVec2.h:68
bool init(const Rect &rect, float fieldOfView=DEFAULT_CAMERA_FOV)
Definition: CUPerspectiveCamera.h:150
static std::shared_ptr< PerspectiveCamera > alloc(float width, float height, float fieldOfView=DEFAULT_CAMERA_FOV)
Definition: CUPerspectiveCamera.h:238
void set(float width, float height, float fieldOfView=DEFAULT_CAMERA_FOV)
Definition: CUPerspectiveCamera.h:352
void set(const Size &size, float fieldOfView=DEFAULT_CAMERA_FOV)
Definition: CUPerspectiveCamera.h:334
float width
Definition: CUSize.h:61
void set(const Rect &rect, float fieldOfView=DEFAULT_CAMERA_FOV)
Definition: CUPerspectiveCamera.h:372
static std::shared_ptr< PerspectiveCamera > alloc(const Vec2 &origin, const Size &size, float fieldOfView=DEFAULT_CAMERA_FOV)
Definition: CUPerspectiveCamera.h:286
static std::shared_ptr< PerspectiveCamera > alloc(float x, float y, float width, float height, float fieldOfView=DEFAULT_CAMERA_FOV)
Definition: CUPerspectiveCamera.h:313
bool init(const Vec2 &origin, const Size &size, float fieldOfView=DEFAULT_CAMERA_FOV)
Definition: CUPerspectiveCamera.h:173
static std::shared_ptr< PerspectiveCamera > alloc(const Rect &rect, float fieldOfView=DEFAULT_CAMERA_FOV)
Definition: CUPerspectiveCamera.h:262
bool init(float width, float height, float fieldOfView=DEFAULT_CAMERA_FOV)
Definition: CUPerspectiveCamera.h:128
float height
Definition: CUSize.h:63
~PerspectiveCamera()
Definition: CUPerspectiveCamera.h:85
Vec2 origin
Definition: CURect.h:49
float getFieldOfView() const
Definition: CUPerspectiveCamera.h:437
Size size
Definition: CURect.h:51
Definition: CUPerspectiveCamera.h:62
static std::shared_ptr< PerspectiveCamera > alloc(const Size &size, float fieldOfView=DEFAULT_CAMERA_FOV)
Definition: CUPerspectiveCamera.h:217
Definition: CUCamera.h:56
float _fieldOfView
Definition: CUPerspectiveCamera.h:65
Definition: CUAnimationNode.h:52
bool init(const Size &size, float fieldOfView=DEFAULT_CAMERA_FOV)
Definition: CUPerspectiveCamera.h:108
PerspectiveCamera()
Definition: CUPerspectiveCamera.h:78
void set(const Vec2 &origin, const Size &size, float fieldOfView=DEFAULT_CAMERA_FOV)
Definition: CUPerspectiveCamera.h:393