Jump to content

3D Camera Create Problem

- - - - -

  • Please log in to reply
No replies to this topic

#1
Trenton Kidder

Trenton Kidder

    Newbie

  • Members
  • Pip
  • 1 posts
// Create the fade out sprite so that we can fade out

//  the various 3d objects in the game.  This function

//  uses surfaces to create the sprite so it must go before

//  we enter 3d mode, because surfaces don't work in 3d

//  mode.

if (!variable_global_exists("fadeSprite"))

    global.fadeSprite = generate_fade_texture(16, 1, 0);


// Start 3d mode.

d3d_start();

// This speeds up the game by only drawing the outside

//  of the objects in the room and skipping the inside.

d3d_set_culling(true);

// This turns off lighting because we will not be using it.

d3d_set_lighting(false);

// This speeds up the game by not drawing objects that are

//  hidden behind other objects.

d3d_set_hidden(true);

// This makes textures on objects look better close up and far

//  away.

texture_set_interpolation(true);


// Create the place to store all the models for the game

//  so we can call them by name later.

global.models = ds_map_create();


// This loads the wall texture (defined by objectLoadTextures)

//  into memory.

wallTexture = background_get_texture(global.walls);


// Creates a model of the wall around the arena.

wallModel = d3d_model_create();


// Adds the wall for the left side of the room to the model.

d3d_model_wall(wallModel, 0, 0, 0, 0, room_height, 32, 36, 1);

d3d_model_wall(wallModel, -32, -32, 32, -32, room_height + 32, 0, 38, 1);

d3d_model_floor(wallModel, 0, -32, 32, -32, room_height + 32, 32, 1, 38);


// Adds the wall for the top of the room to the model.

d3d_model_wall(wallModel, 0, 0, 32, room_width, 0, 0, 36, 1);

d3d_model_wall(wallModel, -32, -32, 0, room_width + 32, -32, 32, 38, 1);

d3d_model_floor(wallModel, 0, 0, 32, room_width + 32, -32, 32, 38, 1);


// Adds the wall for the right side of the room to the model.

d3d_model_wall(wallModel, room_width, 0, 32, room_width, room_height, 0, 38, 1);

d3d_model_wall(wallModel, room_width + 32, -32, 0, room_width + 32, room_height + 32, 32, 36, 1);

d3d_model_floor(wallModel, room_width + 32, 0, 32, room_width, room_height + 32, 32, 1, 38);


// Adds the wall for the bottom of the room to the model.

d3d_model_wall(wallModel, 0, room_height, 0, room_width, room_height, 32, 38, 1);

d3d_model_wall(wallModel, -32, room_height + 32, 32, room_width + 32, room_height + 32, 0, 38, 1);

d3d_model_floor(wallModel, 0, room_height + 32, 32, room_width, room_height, 32, 38, 1);


// If a skybox has been set up (by objectLoadTextures), then load the

//  skybox textures into memory.

if (variable_global_exists("skyFront"))

{

    skyFrontTexture = background_get_texture(global.skyFront);

    skyBackTexture = background_get_texture(global.skyBack);

    skyLeftTexture = background_get_texture(global.skyLeft);

    skyRightTexture = background_get_texture(global.skyRight);

}


// This creates variables to remember where the main character is 

//  and where it is facing.

global.playerX = 0;

global.playerY = 0;

global.playerDir = 0;


// These variable store the camera position and direction so other

//  objects can see it.

global.cameraX = 0;

global.cameraY = 0;

global.cameraSin = 0;

global.cameraCos = 0;


// This counts the models drawn in a given frame.

global.drawnThisFrame = 0;

// This sets the limit of how many models to draw in a frame.

global.drawingCap = 15;

For some reason its not showing the game in 3D mode and all I'm getting is an error while using this code. Any suggestions?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users