45 #ifndef __CU_PERSPECTIVE_CAMERA_H__
46 #define __CU_PERSPECTIVE_CAMERA_H__
51 #define DEFAULT_CAMERA_FOV 67
71 #pragma mark Constructors
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