Creates a new camera entity for viewing the 3D scene.
Takes no parameters.
Returns camera entity handle.
3D Graphics
Parameters & Returns
Parameters
This function takes no parameters.
Returns
Int
Quick Summary
Creates a new camera entity for viewing the 3D scene.
Takes no parameters.
Returns camera entity handle.
Technical Exegesis...
Creates a new camera entity for viewing the 3D scene. Takes no parameters. Returns camera entity handle. Increments g_nextEntityHandle. Initializes Entity3D with type ENTITY_CAMERA. Sets default position (0,0,0), rotation (0,0,0), scale (1,1,1). Allocates Camera3D struct with default FOV, near/far planes. Stores in g_entities map. If g_activeCamera is 0 (no active camera), automatically sets this camera as active via g_activeCamera = handle.
Creates a new camera entity for viewing the 3D scene. Takes no parameters. Returns camera entity handle. Increments g_nextEntityHandle. Initializes Entity3D with type ENTITY_CAMERA. Sets default position (0,0,0), rotation (0,0,0), scale (1,1,1). Allocates Camera3D struct with default FOV, near/far planes. Stores in g_entities map. If g_activeCamera is 0 (no active camera), automatically sets this camera as active via g_activeCamera = handle. Multiple cameras can exist - use b3dSetCamera to switch between them for different viewports or perspectives. Camera has no mesh data - purely for viewpoint. Use b3dSetPosition, b3dSetRotation to move/aim camera. Use b3dCameraFOV, b3dCameraClsRange to configure projection. Use b3dRenderWorld to render from active camera's perspective. Returns entity handle, never fails (always allocates).
This function initializes camera for scene viewing. Camera3D structure contains: FOV (field of view, default 70 degrees), near plane (default 0.1), far plane (default 1000.0), projection matrix, view matrix. View matrix calculated from camera position/rotation each frame. Projection matrix calculated from FOV, aspect ratio, near/far planes. Active camera determines viewpoint for b3dRenderWorld. Only one camera active at a time per rendering context (main window vs canvas). Common pattern: camera = b3dCreateCamera(), b3dSetPosition(camera, 0, 5, -10), b3dSetRotation(camera, 30, 0, 0) for elevated angled view. Use b3dPointEntity or b3dPointEntityAt for camera tracking. Cameras support parenting - attach to entity for first-person view. Default camera at origin looking down +Z axis (OpenGL convention). Cameras don't render themselves. Can create multiple for cinematic cuts, picture-in-picture, mirrors. Use b3dSetCamera to activate different camera. Essential first step for any 3D rendering.