Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
********************************************************************************************/
const r = require('raylib')
// Initialization
//--------------------------------------------------------------------------------------
const screenWidth = 800
const screenHeight = 450
r.InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards")
// Define the camera to look into our 3d world
const camera = r.Camera()
camera.position = r.Vector3(5.0, 4.0, 5.0)
camera.target = r.Vector3(0.0, 2.0, 0.0)
camera.up = r.Vector3(0.0, 1.0, 0.0)
camera.fovy = 45.0
camera.type = r.CAMERA_PERSPECTIVE
const bill = r.LoadTexture(__dirname + "/resources/billboard.png") // Our texture billboard
const billPosition = r.Vector3(0.0, 2.0, 0.0) // Position where draw billboard
r.SetCameraMode(camera, r.CAMERA_ORBITAL) // Set an orbital camera mode
r.SetTargetFPS(60) // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!r.WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
*
********************************************************************************************/
const r = require('raylib')
// Initialization
//--------------------------------------------------------------------------------------
const screenWidth = 800;
const screenHeight = 450;
r.InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free")
// Define the camera to look into our 3d world
const camera = r.Camera(
r.Vector3(10, 10, 10),
r.Vector3(0, 0, 0),
r.Vector3(0, 1, 0),
45,
r.CAMERA_PERSPECTIVE
)
const cubePosition = r.Vector3()
let cubeScreenPosition = r.Vector2()
r.SetCameraMode(camera, r.CAMERA_FREE); // Set a free camera mode
r.SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!r.WindowShouldClose()) // Detect window close button or ESC key
{
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
const r = require('raylib')
// Initialization
//--------------------------------------------------------------------------------------
const screenWidth = 800;
const screenHeight = 450;
r.InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free")
// Define the camera to look into our 3d world
const camera = r.Camera(
r.Vector3(10, 10, 10),
r.Vector3(0, 0, 0),
r.Vector3(0, 1, 0),
45,
r.CAMERA_PERSPECTIVE
)
const cubePosition = r.Vector3()
let cubeScreenPosition = r.Vector2()
r.SetCameraMode(camera, r.CAMERA_FREE); // Set a free camera mode
r.SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!r.WindowShouldClose()) // Detect window close button or ESC key
********************************************************************************************/
const r = require('raylib')
// Initialization
//--------------------------------------------------------------------------------------
const screenWidth = 800;
const screenHeight = 450;
r.InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free")
// Define the camera to look into our 3d world
const camera = r.Camera(
r.Vector3(10, 10, 10),
r.Vector3(0, 0, 0),
r.Vector3(0, 1, 0),
45,
r.CAMERA_PERSPECTIVE
)
const cubePosition = r.Vector3()
let cubeScreenPosition = r.Vector2()
r.SetCameraMode(camera, r.CAMERA_FREE); // Set a free camera mode
r.SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!r.WindowShouldClose()) // Detect window close button or ESC key
{
// Update
let cubeScreenPosition = r.Vector2()
r.SetCameraMode(camera, r.CAMERA_FREE); // Set a free camera mode
r.SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!r.WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
r.UpdateCamera(camera); // Update camera
// Calculate cube screen space position (with a little offset to be in top)
const cubePositionVector = r.Vector3(cubePosition.x, cubePosition.y + 2.5, cubePosition.z)
cubeScreenPosition = r.GetWorldToScreen(cubePositionVector, camera)
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
r.BeginDrawing()
r.ClearBackground(r.RAYWHITE)
r.BeginMode3D(camera)
r.DrawCube(cubePosition, 2, 2, 2, r.RED);
r.DrawCubeWires(cubePosition, 2, 2, 2, r.MAROON);
r.DrawGrid(10, 1);
*
********************************************************************************************/
const r = require('raylib')
// Initialization
//--------------------------------------------------------------------------------------
const screenWidth = 800
const screenHeight = 450
r.InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards")
// Define the camera to look into our 3d world
const camera = r.Camera()
camera.position = r.Vector3(5.0, 4.0, 5.0)
camera.target = r.Vector3(0.0, 2.0, 0.0)
camera.up = r.Vector3(0.0, 1.0, 0.0)
camera.fovy = 45.0
camera.type = r.CAMERA_PERSPECTIVE
const bill = r.LoadTexture(__dirname + "/resources/billboard.png") // Our texture billboard
const billPosition = r.Vector3(0.0, 2.0, 0.0) // Position where draw billboard
r.SetCameraMode(camera, r.CAMERA_ORBITAL) // Set an orbital camera mode
r.SetTargetFPS(60) // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!r.WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//--------------------------------------------------------------------------------------
const screenWidth = 800
const screenHeight = 450
r.InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards")
// Define the camera to look into our 3d world
const camera = r.Camera()
camera.position = r.Vector3(5.0, 4.0, 5.0)
camera.target = r.Vector3(0.0, 2.0, 0.0)
camera.up = r.Vector3(0.0, 1.0, 0.0)
camera.fovy = 45.0
camera.type = r.CAMERA_PERSPECTIVE
const bill = r.LoadTexture(__dirname + "/resources/billboard.png") // Our texture billboard
const billPosition = r.Vector3(0.0, 2.0, 0.0) // Position where draw billboard
r.SetCameraMode(camera, r.CAMERA_ORBITAL) // Set an orbital camera mode
r.SetTargetFPS(60) // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!r.WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
//r.UpdateCamera(camera); // Update camera
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------