1 /** 2 Camera node, displays from a point of view. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.camera; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.spatial; 25 import godot.environment; 26 /** 27 Camera node, displays from a point of view. 28 29 Camera is a special node that displays what is visible from its current location. Cameras register themselves in the nearest $(D Viewport) node (when ascending the tree). Only one camera can be active per viewport. If no viewport is available ascending the tree, the camera will register in the global viewport. In other words, a camera just provides 3D display capabilities to a $(D Viewport), and, without one, a scene registered in that $(D Viewport) (or higher viewports) can't be displayed. 30 */ 31 @GodotBaseClass struct Camera 32 { 33 package(godot) enum string _GODOT_internal_name = "Camera"; 34 public: 35 @nogc nothrow: 36 union { /** */ godot_object _godot_object; /** */ Spatial _GODOT_base; } 37 alias _GODOT_base this; 38 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 39 package(godot) __gshared bool _classBindingInitialized = false; 40 package(godot) static struct GDNativeClassBinding 41 { 42 __gshared: 43 @GodotName("clear_current") GodotMethod!(void, bool) clearCurrent; 44 @GodotName("get_camera_rid") GodotMethod!(RID) getCameraRid; 45 @GodotName("get_camera_transform") GodotMethod!(Transform) getCameraTransform; 46 @GodotName("get_cull_mask") GodotMethod!(long) getCullMask; 47 @GodotName("get_cull_mask_bit") GodotMethod!(bool, long) getCullMaskBit; 48 @GodotName("get_doppler_tracking") GodotMethod!(Camera.DopplerTracking) getDopplerTracking; 49 @GodotName("get_environment") GodotMethod!(Environment) getEnvironment; 50 @GodotName("get_fov") GodotMethod!(double) getFov; 51 @GodotName("get_frustum") GodotMethod!(Array) getFrustum; 52 @GodotName("get_frustum_offset") GodotMethod!(Vector2) getFrustumOffset; 53 @GodotName("get_h_offset") GodotMethod!(double) getHOffset; 54 @GodotName("get_keep_aspect_mode") GodotMethod!(Camera.KeepAspect) getKeepAspectMode; 55 @GodotName("get_projection") GodotMethod!(Camera.Projection) getProjection; 56 @GodotName("get_size") GodotMethod!(double) getSize; 57 @GodotName("get_v_offset") GodotMethod!(double) getVOffset; 58 @GodotName("get_zfar") GodotMethod!(double) getZfar; 59 @GodotName("get_znear") GodotMethod!(double) getZnear; 60 @GodotName("is_current") GodotMethod!(bool) isCurrent; 61 @GodotName("is_position_behind") GodotMethod!(bool, Vector3) isPositionBehind; 62 @GodotName("make_current") GodotMethod!(void) makeCurrent; 63 @GodotName("project_local_ray_normal") GodotMethod!(Vector3, Vector2) projectLocalRayNormal; 64 @GodotName("project_position") GodotMethod!(Vector3, Vector2, double) projectPosition; 65 @GodotName("project_ray_normal") GodotMethod!(Vector3, Vector2) projectRayNormal; 66 @GodotName("project_ray_origin") GodotMethod!(Vector3, Vector2) projectRayOrigin; 67 @GodotName("set_cull_mask") GodotMethod!(void, long) setCullMask; 68 @GodotName("set_cull_mask_bit") GodotMethod!(void, long, bool) setCullMaskBit; 69 @GodotName("set_current") GodotMethod!(void, bool) setCurrent; 70 @GodotName("set_doppler_tracking") GodotMethod!(void, long) setDopplerTracking; 71 @GodotName("set_environment") GodotMethod!(void, Environment) setEnvironment; 72 @GodotName("set_fov") GodotMethod!(void, double) setFov; 73 @GodotName("set_frustum") GodotMethod!(void, double, Vector2, double, double) setFrustum; 74 @GodotName("set_frustum_offset") GodotMethod!(void, Vector2) setFrustumOffset; 75 @GodotName("set_h_offset") GodotMethod!(void, double) setHOffset; 76 @GodotName("set_keep_aspect_mode") GodotMethod!(void, long) setKeepAspectMode; 77 @GodotName("set_orthogonal") GodotMethod!(void, double, double, double) setOrthogonal; 78 @GodotName("set_perspective") GodotMethod!(void, double, double, double) setPerspective; 79 @GodotName("set_projection") GodotMethod!(void, long) setProjection; 80 @GodotName("set_size") GodotMethod!(void, double) setSize; 81 @GodotName("set_v_offset") GodotMethod!(void, double) setVOffset; 82 @GodotName("set_zfar") GodotMethod!(void, double) setZfar; 83 @GodotName("set_znear") GodotMethod!(void, double) setZnear; 84 @GodotName("unproject_position") GodotMethod!(Vector2, Vector3) unprojectPosition; 85 } 86 /// 87 pragma(inline, true) bool opEquals(in Camera other) const 88 { return _godot_object.ptr is other._godot_object.ptr; } 89 /// 90 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 91 { _godot_object.ptr = n; return null; } 92 /// 93 pragma(inline, true) bool opEquals(typeof(null) n) const 94 { return _godot_object.ptr is n; } 95 /// 96 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 97 mixin baseCasts; 98 /// Construct a new instance of Camera. 99 /// Note: use `memnew!Camera` instead. 100 static Camera _new() 101 { 102 static godot_class_constructor constructor; 103 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Camera"); 104 if(constructor is null) return typeof(this).init; 105 return cast(Camera)(constructor()); 106 } 107 @disable new(size_t s); 108 /// 109 enum KeepAspect : int 110 { 111 /** 112 Preserves the horizontal aspect ratio; also known as Vert- scaling. This is usually the best option for projects running in portrait mode, as taller aspect ratios will benefit from a wider vertical FOV. 113 */ 114 keepWidth = 0, 115 /** 116 Preserves the vertical aspect ratio; also known as Hor+ scaling. This is usually the best option for projects running in landscape mode, as wider aspect ratios will automatically benefit from a wider horizontal FOV. 117 */ 118 keepHeight = 1, 119 } 120 /// 121 enum Projection : int 122 { 123 /** 124 Perspective projection. Objects on the screen becomes smaller when they are far away. 125 */ 126 projectionPerspective = 0, 127 /** 128 Orthogonal projection, also known as orthographic projection. Objects remain the same size on the screen no matter how far away they are. 129 */ 130 projectionOrthogonal = 1, 131 /** 132 Frustum projection. This mode allows adjusting $(D frustumOffset) to create "tilted frustum" effects. 133 */ 134 projectionFrustum = 2, 135 } 136 /// 137 enum DopplerTracking : int 138 { 139 /** 140 Disables $(D url=https://en.wikipedia.org/wiki/Doppler_effect)Doppler effect$(D /url) simulation (default). 141 */ 142 dopplerTrackingDisabled = 0, 143 /** 144 Simulate $(D url=https://en.wikipedia.org/wiki/Doppler_effect)Doppler effect$(D /url) by tracking positions of objects that are changed in `_process`. Changes in the relative velocity of this camera compared to those objects affect how Audio is perceived (changing the Audio's `pitch shift`). 145 */ 146 dopplerTrackingIdleStep = 1, 147 /** 148 Simulate $(D url=https://en.wikipedia.org/wiki/Doppler_effect)Doppler effect$(D /url) by tracking positions of objects that are changed in `_physics_process`. Changes in the relative velocity of this camera compared to those objects affect how Audio is perceived (changing the Audio's `pitch shift`). 149 */ 150 dopplerTrackingPhysicsStep = 2, 151 } 152 /// 153 enum Constants : int 154 { 155 keepWidth = 0, 156 dopplerTrackingDisabled = 0, 157 projectionPerspective = 0, 158 keepHeight = 1, 159 dopplerTrackingIdleStep = 1, 160 projectionOrthogonal = 1, 161 projectionFrustum = 2, 162 dopplerTrackingPhysicsStep = 2, 163 } 164 /** 165 If this is the current camera, remove it from being current. If `enable_next` is `true`, request to make the next camera current, if any. 166 */ 167 void clearCurrent(in bool enable_next = true) 168 { 169 checkClassBinding!(typeof(this))(); 170 ptrcall!(void)(GDNativeClassBinding.clearCurrent, _godot_object, enable_next); 171 } 172 /** 173 Returns the camera's RID from the $(D VisualServer). 174 */ 175 RID getCameraRid() const 176 { 177 checkClassBinding!(typeof(this))(); 178 return ptrcall!(RID)(GDNativeClassBinding.getCameraRid, _godot_object); 179 } 180 /** 181 Gets the camera transform. Subclassed cameras such as $(D InterpolatedCamera) may provide different transforms than the $(D Node) transform. 182 */ 183 Transform getCameraTransform() const 184 { 185 checkClassBinding!(typeof(this))(); 186 return ptrcall!(Transform)(GDNativeClassBinding.getCameraTransform, _godot_object); 187 } 188 /** 189 190 */ 191 long getCullMask() const 192 { 193 checkClassBinding!(typeof(this))(); 194 return ptrcall!(long)(GDNativeClassBinding.getCullMask, _godot_object); 195 } 196 /** 197 Returns `true` if the given `layer` in the $(D cullMask) is enabled, `false` otherwise. 198 */ 199 bool getCullMaskBit(in long layer) const 200 { 201 checkClassBinding!(typeof(this))(); 202 return ptrcall!(bool)(GDNativeClassBinding.getCullMaskBit, _godot_object, layer); 203 } 204 /** 205 206 */ 207 Camera.DopplerTracking getDopplerTracking() const 208 { 209 checkClassBinding!(typeof(this))(); 210 return ptrcall!(Camera.DopplerTracking)(GDNativeClassBinding.getDopplerTracking, _godot_object); 211 } 212 /** 213 214 */ 215 Ref!Environment getEnvironment() const 216 { 217 checkClassBinding!(typeof(this))(); 218 return ptrcall!(Environment)(GDNativeClassBinding.getEnvironment, _godot_object); 219 } 220 /** 221 222 */ 223 double getFov() const 224 { 225 checkClassBinding!(typeof(this))(); 226 return ptrcall!(double)(GDNativeClassBinding.getFov, _godot_object); 227 } 228 /** 229 Returns the camera's frustum planes in world space units as an array of $(D Plane)s in the following order: near, far, left, top, right, bottom. Not to be confused with $(D frustumOffset). 230 */ 231 Array getFrustum() const 232 { 233 checkClassBinding!(typeof(this))(); 234 return ptrcall!(Array)(GDNativeClassBinding.getFrustum, _godot_object); 235 } 236 /** 237 238 */ 239 Vector2 getFrustumOffset() const 240 { 241 checkClassBinding!(typeof(this))(); 242 return ptrcall!(Vector2)(GDNativeClassBinding.getFrustumOffset, _godot_object); 243 } 244 /** 245 246 */ 247 double getHOffset() const 248 { 249 checkClassBinding!(typeof(this))(); 250 return ptrcall!(double)(GDNativeClassBinding.getHOffset, _godot_object); 251 } 252 /** 253 254 */ 255 Camera.KeepAspect getKeepAspectMode() const 256 { 257 checkClassBinding!(typeof(this))(); 258 return ptrcall!(Camera.KeepAspect)(GDNativeClassBinding.getKeepAspectMode, _godot_object); 259 } 260 /** 261 262 */ 263 Camera.Projection getProjection() const 264 { 265 checkClassBinding!(typeof(this))(); 266 return ptrcall!(Camera.Projection)(GDNativeClassBinding.getProjection, _godot_object); 267 } 268 /** 269 270 */ 271 double getSize() const 272 { 273 checkClassBinding!(typeof(this))(); 274 return ptrcall!(double)(GDNativeClassBinding.getSize, _godot_object); 275 } 276 /** 277 278 */ 279 double getVOffset() const 280 { 281 checkClassBinding!(typeof(this))(); 282 return ptrcall!(double)(GDNativeClassBinding.getVOffset, _godot_object); 283 } 284 /** 285 286 */ 287 double getZfar() const 288 { 289 checkClassBinding!(typeof(this))(); 290 return ptrcall!(double)(GDNativeClassBinding.getZfar, _godot_object); 291 } 292 /** 293 294 */ 295 double getZnear() const 296 { 297 checkClassBinding!(typeof(this))(); 298 return ptrcall!(double)(GDNativeClassBinding.getZnear, _godot_object); 299 } 300 /** 301 302 */ 303 bool isCurrent() const 304 { 305 checkClassBinding!(typeof(this))(); 306 return ptrcall!(bool)(GDNativeClassBinding.isCurrent, _godot_object); 307 } 308 /** 309 Returns `true` if the given position is behind the camera. 310 $(B Note:) A position which returns `false` may still be outside the camera's field of view. 311 */ 312 bool isPositionBehind(in Vector3 world_point) const 313 { 314 checkClassBinding!(typeof(this))(); 315 return ptrcall!(bool)(GDNativeClassBinding.isPositionBehind, _godot_object, world_point); 316 } 317 /** 318 Makes this camera the current camera for the $(D Viewport) (see class description). If the camera node is outside the scene tree, it will attempt to become current once it's added. 319 */ 320 void makeCurrent() 321 { 322 checkClassBinding!(typeof(this))(); 323 ptrcall!(void)(GDNativeClassBinding.makeCurrent, _godot_object); 324 } 325 /** 326 Returns a normal vector from the screen point location directed along the camera. Orthogonal cameras are normalized. Perspective cameras account for perspective, screen width/height, etc. 327 */ 328 Vector3 projectLocalRayNormal(in Vector2 screen_point) const 329 { 330 checkClassBinding!(typeof(this))(); 331 return ptrcall!(Vector3)(GDNativeClassBinding.projectLocalRayNormal, _godot_object, screen_point); 332 } 333 /** 334 Returns the 3D point in world space that maps to the given 2D coordinate in the $(D Viewport) rectangle on a plane that is the given `z_depth` distance into the scene away from the camera. 335 */ 336 Vector3 projectPosition(in Vector2 screen_point, in double z_depth) const 337 { 338 checkClassBinding!(typeof(this))(); 339 return ptrcall!(Vector3)(GDNativeClassBinding.projectPosition, _godot_object, screen_point, z_depth); 340 } 341 /** 342 Returns a normal vector in world space, that is the result of projecting a point on the $(D Viewport) rectangle by the camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking. 343 */ 344 Vector3 projectRayNormal(in Vector2 screen_point) const 345 { 346 checkClassBinding!(typeof(this))(); 347 return ptrcall!(Vector3)(GDNativeClassBinding.projectRayNormal, _godot_object, screen_point); 348 } 349 /** 350 Returns a 3D position in world space, that is the result of projecting a point on the $(D Viewport) rectangle by the camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking. 351 */ 352 Vector3 projectRayOrigin(in Vector2 screen_point) const 353 { 354 checkClassBinding!(typeof(this))(); 355 return ptrcall!(Vector3)(GDNativeClassBinding.projectRayOrigin, _godot_object, screen_point); 356 } 357 /** 358 359 */ 360 void setCullMask(in long mask) 361 { 362 checkClassBinding!(typeof(this))(); 363 ptrcall!(void)(GDNativeClassBinding.setCullMask, _godot_object, mask); 364 } 365 /** 366 Enables or disables the given `layer` in the $(D cullMask). 367 */ 368 void setCullMaskBit(in long layer, in bool enable) 369 { 370 checkClassBinding!(typeof(this))(); 371 ptrcall!(void)(GDNativeClassBinding.setCullMaskBit, _godot_object, layer, enable); 372 } 373 /** 374 375 */ 376 void setCurrent(in bool arg0) 377 { 378 checkClassBinding!(typeof(this))(); 379 ptrcall!(void)(GDNativeClassBinding.setCurrent, _godot_object, arg0); 380 } 381 /** 382 383 */ 384 void setDopplerTracking(in long mode) 385 { 386 checkClassBinding!(typeof(this))(); 387 ptrcall!(void)(GDNativeClassBinding.setDopplerTracking, _godot_object, mode); 388 } 389 /** 390 391 */ 392 void setEnvironment(Environment env) 393 { 394 checkClassBinding!(typeof(this))(); 395 ptrcall!(void)(GDNativeClassBinding.setEnvironment, _godot_object, env); 396 } 397 /** 398 399 */ 400 void setFov(in double arg0) 401 { 402 checkClassBinding!(typeof(this))(); 403 ptrcall!(void)(GDNativeClassBinding.setFov, _godot_object, arg0); 404 } 405 /** 406 Sets the camera projection to frustum mode (see $(D constant PROJECTION_FRUSTUM)), by specifying a `size`, an `offset`, and the `z_near` and `z_far` clip planes in world space units. 407 */ 408 void setFrustum(in double size, in Vector2 offset, in double z_near, in double z_far) 409 { 410 checkClassBinding!(typeof(this))(); 411 ptrcall!(void)(GDNativeClassBinding.setFrustum, _godot_object, size, offset, z_near, z_far); 412 } 413 /** 414 415 */ 416 void setFrustumOffset(in Vector2 arg0) 417 { 418 checkClassBinding!(typeof(this))(); 419 ptrcall!(void)(GDNativeClassBinding.setFrustumOffset, _godot_object, arg0); 420 } 421 /** 422 423 */ 424 void setHOffset(in double ofs) 425 { 426 checkClassBinding!(typeof(this))(); 427 ptrcall!(void)(GDNativeClassBinding.setHOffset, _godot_object, ofs); 428 } 429 /** 430 431 */ 432 void setKeepAspectMode(in long mode) 433 { 434 checkClassBinding!(typeof(this))(); 435 ptrcall!(void)(GDNativeClassBinding.setKeepAspectMode, _godot_object, mode); 436 } 437 /** 438 Sets the camera projection to orthogonal mode (see $(D constant PROJECTION_ORTHOGONAL)), by specifying a `size`, and the `z_near` and `z_far` clip planes in world space units. (As a hint, 2D games often use this projection, with values specified in pixels.) 439 */ 440 void setOrthogonal(in double size, in double z_near, in double z_far) 441 { 442 checkClassBinding!(typeof(this))(); 443 ptrcall!(void)(GDNativeClassBinding.setOrthogonal, _godot_object, size, z_near, z_far); 444 } 445 /** 446 Sets the camera projection to perspective mode (see $(D constant PROJECTION_PERSPECTIVE)), by specifying a `fov` (field of view) angle in degrees, and the `z_near` and `z_far` clip planes in world space units. 447 */ 448 void setPerspective(in double fov, in double z_near, in double z_far) 449 { 450 checkClassBinding!(typeof(this))(); 451 ptrcall!(void)(GDNativeClassBinding.setPerspective, _godot_object, fov, z_near, z_far); 452 } 453 /** 454 455 */ 456 void setProjection(in long arg0) 457 { 458 checkClassBinding!(typeof(this))(); 459 ptrcall!(void)(GDNativeClassBinding.setProjection, _godot_object, arg0); 460 } 461 /** 462 463 */ 464 void setSize(in double arg0) 465 { 466 checkClassBinding!(typeof(this))(); 467 ptrcall!(void)(GDNativeClassBinding.setSize, _godot_object, arg0); 468 } 469 /** 470 471 */ 472 void setVOffset(in double ofs) 473 { 474 checkClassBinding!(typeof(this))(); 475 ptrcall!(void)(GDNativeClassBinding.setVOffset, _godot_object, ofs); 476 } 477 /** 478 479 */ 480 void setZfar(in double arg0) 481 { 482 checkClassBinding!(typeof(this))(); 483 ptrcall!(void)(GDNativeClassBinding.setZfar, _godot_object, arg0); 484 } 485 /** 486 487 */ 488 void setZnear(in double arg0) 489 { 490 checkClassBinding!(typeof(this))(); 491 ptrcall!(void)(GDNativeClassBinding.setZnear, _godot_object, arg0); 492 } 493 /** 494 Returns the 2D coordinate in the $(D Viewport) rectangle that maps to the given 3D point in world space. 495 $(B Note:) When using this to position GUI elements over a 3D viewport, use $(D isPositionBehind) to prevent them from appearing if the 3D point is behind the camera: 496 497 498 # This code block is part of a script that inherits from Spatial. 499 # `control` is a reference to a node inheriting from Control. 500 control.visible = not get_viewport().get_camera().is_position_behind(global_transform.origin) 501 control.rect_position = get_viewport().get_camera().unproject_position(global_transform.origin) 502 503 504 */ 505 Vector2 unprojectPosition(in Vector3 world_point) const 506 { 507 checkClassBinding!(typeof(this))(); 508 return ptrcall!(Vector2)(GDNativeClassBinding.unprojectPosition, _godot_object, world_point); 509 } 510 /** 511 The culling mask that describes which 3D render layers are rendered by this camera. 512 */ 513 @property long cullMask() 514 { 515 return getCullMask(); 516 } 517 /// ditto 518 @property void cullMask(long v) 519 { 520 setCullMask(v); 521 } 522 /** 523 If `true`, the ancestor $(D Viewport) is currently using this camera. 524 */ 525 @property bool current() 526 { 527 return isCurrent(); 528 } 529 /// ditto 530 @property void current(bool v) 531 { 532 setCurrent(v); 533 } 534 /** 535 If not $(D constant DOPPLER_TRACKING_DISABLED), this camera will simulate the $(D url=https://en.wikipedia.org/wiki/Doppler_effect)Doppler effect$(D /url) for objects changed in particular `_process` methods. See $(D dopplertracking) for possible values. 536 */ 537 @property Camera.DopplerTracking dopplerTracking() 538 { 539 return getDopplerTracking(); 540 } 541 /// ditto 542 @property void dopplerTracking(long v) 543 { 544 setDopplerTracking(v); 545 } 546 /** 547 The $(D Environment) to use for this camera. 548 */ 549 @property Environment environment() 550 { 551 return getEnvironment(); 552 } 553 /// ditto 554 @property void environment(Environment v) 555 { 556 setEnvironment(v); 557 } 558 /** 559 The distance to the far culling boundary for this camera relative to its local Z axis. 560 */ 561 @property double far() 562 { 563 return getZfar(); 564 } 565 /// ditto 566 @property void far(double v) 567 { 568 setZfar(v); 569 } 570 /** 571 The camera's field of view angle (in degrees). Only applicable in perspective mode. Since $(D keepAspect) locks one axis, `fov` sets the other axis' field of view angle. 572 For reference, the default vertical field of view value (`70.0`) is equivalent to a horizontal FOV of: 573 - ~86.07 degrees in a 4:3 viewport 574 - ~96.50 degrees in a 16:10 viewport 575 - ~102.45 degrees in a 16:9 viewport 576 - ~117.06 degrees in a 21:9 viewport 577 */ 578 @property double fov() 579 { 580 return getFov(); 581 } 582 /// ditto 583 @property void fov(double v) 584 { 585 setFov(v); 586 } 587 /** 588 The camera's frustum offset. This can be changed from the default to create "tilted frustum" effects such as $(D url=https://zdoom.org/wiki/Y-shearing)Y-shearing$(D /url). 589 */ 590 @property Vector2 frustumOffset() 591 { 592 return getFrustumOffset(); 593 } 594 /// ditto 595 @property void frustumOffset(Vector2 v) 596 { 597 setFrustumOffset(v); 598 } 599 /** 600 The horizontal (X) offset of the camera viewport. 601 */ 602 @property double hOffset() 603 { 604 return getHOffset(); 605 } 606 /// ditto 607 @property void hOffset(double v) 608 { 609 setHOffset(v); 610 } 611 /** 612 The axis to lock during $(D fov)/$(D size) adjustments. Can be either $(D constant KEEP_WIDTH) or $(D constant KEEP_HEIGHT). 613 */ 614 @property Camera.KeepAspect keepAspect() 615 { 616 return getKeepAspectMode(); 617 } 618 /// ditto 619 @property void keepAspect(long v) 620 { 621 setKeepAspectMode(v); 622 } 623 /** 624 The distance to the near culling boundary for this camera relative to its local Z axis. 625 */ 626 @property double near() 627 { 628 return getZnear(); 629 } 630 /// ditto 631 @property void near(double v) 632 { 633 setZnear(v); 634 } 635 /** 636 The camera's projection mode. In $(D constant PROJECTION_PERSPECTIVE) mode, objects' Z distance from the camera's local space scales their perceived size. 637 */ 638 @property Camera.Projection projection() 639 { 640 return getProjection(); 641 } 642 /// ditto 643 @property void projection(long v) 644 { 645 setProjection(v); 646 } 647 /** 648 The camera's size measured as 1/2 the width or height. Only applicable in orthogonal mode. Since $(D keepAspect) locks on axis, `size` sets the other axis' size length. 649 */ 650 @property double size() 651 { 652 return getSize(); 653 } 654 /// ditto 655 @property void size(double v) 656 { 657 setSize(v); 658 } 659 /** 660 The vertical (Y) offset of the camera viewport. 661 */ 662 @property double vOffset() 663 { 664 return getVOffset(); 665 } 666 /// ditto 667 @property void vOffset(double v) 668 { 669 setVOffset(v); 670 } 671 }