change texture2d to texture
This commit is contained in:
parent
97c02b2425
commit
1c829e7b81
47 changed files with 73 additions and 73 deletions
|
|
@ -38,8 +38,8 @@ int main(void)
|
|||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
|
||||
|
||||
Texture2D texPs3Pad = LoadTexture("resources/ps3.png");
|
||||
Texture2D texXboxPad = LoadTexture("resources/xbox.png");
|
||||
Texture texPs3Pad = LoadTexture("resources/ps3.png");
|
||||
Texture texXboxPad = LoadTexture("resources/xbox.png");
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ int main(void)
|
|||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Model model = LoadModel("resources/models/iqm/guy.iqm"); // Load the animated model mesh and basic data
|
||||
Texture2D texture = LoadTexture("resources/models/iqm/guytex.png"); // Load model texture and set material
|
||||
Texture texture = LoadTexture("resources/models/iqm/guytex.png"); // Load model texture and set material
|
||||
SetMaterialTexture(&model.materials[0], MATERIAL_MAP_DIFFUSE, texture); // Set model material map texture
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ int main(void)
|
|||
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
|
||||
|
||||
Texture2D bill = LoadTexture("resources/billboard.png"); // Our billboard texture
|
||||
Texture bill = LoadTexture("resources/billboard.png"); // Our billboard texture
|
||||
Vector3 billPositionStatic = { 0.0f, 2.0f, 0.0f }; // Position of static billboard
|
||||
Vector3 billPositionRotating = { 1.0f, 2.0f, 1.0f }; // Position of rotating billboard
|
||||
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ int main(void)
|
|||
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
|
||||
|
||||
Image image = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)
|
||||
Texture2D cubicmap = LoadTextureFromImage(image); // Convert image to texture to display (VRAM)
|
||||
Texture cubicmap = LoadTextureFromImage(image); // Convert image to texture to display (VRAM)
|
||||
|
||||
Mesh mesh = GenMeshCubicmap(image, (Vector3){ 1.0f, 1.0f, 1.0f });
|
||||
Model model = LoadModelFromMesh(mesh);
|
||||
|
||||
// NOTE: By default each cube is mapped to one part of texture atlas
|
||||
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
|
||||
Texture texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
|
||||
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
//------------------------------------------------------------------------------------
|
||||
// Custom Functions Declaration
|
||||
//------------------------------------------------------------------------------------
|
||||
void DrawCubeTexture(Texture2D texture, Vector3 position, float width, float height, float length, Color color); // Draw cube textured
|
||||
void DrawCubeTextureRec(Texture2D texture, Rectangle source, Vector3 position, float width, float height, float length, Color color); // Draw cube with a region of a texture
|
||||
void DrawCubeTexture(Texture texture, Vector3 position, float width, float height, float length, Color color); // Draw cube textured
|
||||
void DrawCubeTextureRec(Texture texture, Rectangle source, Vector3 position, float width, float height, float length, Color color); // Draw cube with a region of a texture
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
|
|
@ -42,7 +42,7 @@ int main(void)
|
|||
camera.projection = CAMERA_PERSPECTIVE;
|
||||
|
||||
// Load texture to be applied to the cubes sides
|
||||
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png");
|
||||
Texture texture = LoadTexture("resources/cubicmap_atlas.png");
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
@ -95,7 +95,7 @@ int main(void)
|
|||
//------------------------------------------------------------------------------------
|
||||
// Draw cube textured
|
||||
// NOTE: Cube position is the center position
|
||||
void DrawCubeTexture(Texture2D texture, Vector3 position, float width, float height, float length, Color color)
|
||||
void DrawCubeTexture(Texture texture, Vector3 position, float width, float height, float length, Color color)
|
||||
{
|
||||
float x = position.x;
|
||||
float y = position.y;
|
||||
|
|
@ -157,7 +157,7 @@ void DrawCubeTexture(Texture2D texture, Vector3 position, float width, float hei
|
|||
}
|
||||
|
||||
// Draw cube with texture piece applied to all faces
|
||||
void DrawCubeTextureRec(Texture2D texture, Rectangle source, Vector3 position, float width, float height, float length, Color color)
|
||||
void DrawCubeTextureRec(Texture texture, Rectangle source, Vector3 position, float width, float height, float length, Color color)
|
||||
{
|
||||
float x = position.x;
|
||||
float y = position.y;
|
||||
|
|
|
|||
|
|
@ -36,12 +36,12 @@ int main(void)
|
|||
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
|
||||
|
||||
Image imMap = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)
|
||||
Texture2D cubicmap = LoadTextureFromImage(imMap); // Convert image to texture to display (VRAM)
|
||||
Texture cubicmap = LoadTextureFromImage(imMap); // Convert image to texture to display (VRAM)
|
||||
Mesh mesh = GenMeshCubicmap(imMap, (Vector3){ 1.0f, 1.0f, 1.0f });
|
||||
Model model = LoadModelFromMesh(mesh);
|
||||
|
||||
// NOTE: By default each cube is mapped to one part of texture atlas
|
||||
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
|
||||
Texture texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
|
||||
// Get map image data to be used for collision detection
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ int main(void)
|
|||
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
|
||||
|
||||
Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
|
||||
Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
|
||||
Texture texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
|
||||
|
||||
Mesh mesh = GenMeshHeightmap(image, (Vector3){ 16, 8, 16 }); // Generate heightmap mesh (RAM and VRAM)
|
||||
Model model = LoadModelFromMesh(mesh); // Load model from generated mesh
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ int main(void)
|
|||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Model model = LoadModel("resources/models/obj/castle.obj"); // Load model
|
||||
Texture2D texture = LoadTexture("resources/models/obj/castle_diffuse.png"); // Load model texture
|
||||
Texture texture = LoadTexture("resources/models/obj/castle_diffuse.png"); // Load model texture
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ int main(void)
|
|||
|
||||
// We generate a checked image for texturing
|
||||
Image checked = GenImageChecked(2, 2, 1, 1, RED, GREEN);
|
||||
Texture2D texture = LoadTextureFromImage(checked);
|
||||
Texture texture = LoadTextureFromImage(checked);
|
||||
UnloadImage(checked);
|
||||
|
||||
Model models[NUM_MODELS] = { 0 };
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ int main(void)
|
|||
Ray ray = { 0 }; // Picking ray
|
||||
|
||||
Model tower = LoadModel("resources/models/obj/turret.obj"); // Load OBJ model
|
||||
Texture2D texture = LoadTexture("resources/models/obj/turret_diffuse.png"); // Load model texture
|
||||
Texture texture = LoadTexture("resources/models/obj/turret_diffuse.png"); // Load model texture
|
||||
tower.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture
|
||||
|
||||
Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#endif
|
||||
|
||||
// Generate cubemap (6 faces) from equirectangular (panorama) texture
|
||||
static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, int format);
|
||||
static TextureCubemap GenTextureCubemap(Shader shader, Texture panorama, int size, int format);
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
|
|
@ -74,7 +74,7 @@ int main(void)
|
|||
TextCopy(skyboxFileName, "resources/dresden_square_2k.hdr");
|
||||
|
||||
// Load HDR panorama (sphere) texture
|
||||
Texture2D panorama = LoadTexture(skyboxFileName);
|
||||
Texture panorama = LoadTexture(skyboxFileName);
|
||||
|
||||
// Generate cubemap (texture with 6 quads-cube-mapping) from panorama HDR texture
|
||||
// NOTE 1: New texture is generated rendering to texture, shader calculates the sphere->cube coordinates mapping
|
||||
|
|
@ -118,7 +118,7 @@ int main(void)
|
|||
if (useHDR)
|
||||
{
|
||||
// Load HDR panorama (sphere) texture
|
||||
Texture2D panorama = LoadTexture(droppedFiles.paths[0]);
|
||||
Texture panorama = LoadTexture(droppedFiles.paths[0]);
|
||||
|
||||
// Generate cubemap from panorama texture
|
||||
skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
|
||||
|
|
@ -182,7 +182,7 @@ int main(void)
|
|||
}
|
||||
|
||||
// Generate cubemap texture from HDR texture
|
||||
static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, int format)
|
||||
static TextureCubemap GenTextureCubemap(Shader shader, Texture panorama, int size, int format)
|
||||
{
|
||||
TextureCubemap cubemap = { 0 };
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ int main(void)
|
|||
camera.projection = CAMERA_PERSPECTIVE; // Camera type
|
||||
|
||||
Model model = LoadModel("resources/models/obj/plane.obj"); // Load model
|
||||
Texture2D texture = LoadTexture("resources/models/obj/plane_diffuse.png"); // Load model texture
|
||||
Texture texture = LoadTexture("resources/models/obj/plane_diffuse.png"); // Load model texture
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
|
||||
float pitch = 0.0f;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ int main(void)
|
|||
};
|
||||
|
||||
// Image converted to Texture (VRAM) to be drawn
|
||||
Texture2D texture = LoadTextureFromImage(image);
|
||||
Texture texture = LoadTextureFromImage(image);
|
||||
|
||||
// With an Image loaded from file, after Texture is loaded, we can unload Image
|
||||
// but in our case, Image is embedded in executable, in program .data segment
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ int main(void)
|
|||
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
|
||||
|
||||
Model model = LoadModel("resources/models/barracks.obj"); // Load OBJ model
|
||||
Texture2D texture = LoadTexture("resources/models/barracks_diffuse.png"); // Load model texture (diffuse map)
|
||||
Texture texture = LoadTexture("resources/models/barracks_diffuse.png"); // Load model texture (diffuse map)
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ int main(void)
|
|||
} break;
|
||||
case DEFERRED_POSITION:
|
||||
{
|
||||
DrawTextureRec((Texture2D){
|
||||
DrawTextureRec((Texture){
|
||||
.id = gBuffer.positionTexture,
|
||||
.width = screenWidth,
|
||||
.height = screenHeight,
|
||||
|
|
@ -287,7 +287,7 @@ int main(void)
|
|||
} break;
|
||||
case DEFERRED_NORMAL:
|
||||
{
|
||||
DrawTextureRec((Texture2D){
|
||||
DrawTextureRec((Texture){
|
||||
.id = gBuffer.normalTexture,
|
||||
.width = screenWidth,
|
||||
.height = screenHeight,
|
||||
|
|
@ -297,7 +297,7 @@ int main(void)
|
|||
} break;
|
||||
case DEFERRED_ALBEDO:
|
||||
{
|
||||
DrawTextureRec((Texture2D){
|
||||
DrawTextureRec((Texture){
|
||||
.id = gBuffer.albedoSpecTexture,
|
||||
.width = screenWidth,
|
||||
.height = screenHeight,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ int main(void)
|
|||
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
|
||||
|
||||
Model model = LoadModel("resources/models/watermill.obj"); // Load OBJ model
|
||||
Texture2D texture = LoadTexture("resources/models/watermill_diffuse.png"); // Load model texture
|
||||
Texture texture = LoadTexture("resources/models/watermill_diffuse.png"); // Load model texture
|
||||
|
||||
// Load shader for model
|
||||
// NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ int main(void)
|
|||
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
|
||||
|
||||
Model model = LoadModel("resources/models/church.obj"); // Load OBJ model
|
||||
Texture2D texture = LoadTexture("resources/models/church_diffuse.png"); // Load model texture (diffuse map)
|
||||
Texture texture = LoadTexture("resources/models/church_diffuse.png"); // Load model texture (diffuse map)
|
||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ int main(void)
|
|||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - shapes and texture shaders");
|
||||
|
||||
Texture2D fudesumi = LoadTexture("resources/fudesumi.png");
|
||||
Texture fudesumi = LoadTexture("resources/fudesumi.png");
|
||||
|
||||
// Load shader to be used on some parts drawing
|
||||
// NOTE 1: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ int main(void)
|
|||
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - texture drawing");
|
||||
|
||||
Image imBlank = GenImageColor(1024, 1024, BLANK);
|
||||
Texture2D texture = LoadTextureFromImage(imBlank); // Load blank texture to fill on shader
|
||||
Texture texture = LoadTextureFromImage(imBlank); // Load blank texture to fill on shader
|
||||
UnloadImage(imBlank);
|
||||
|
||||
// NOTE: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ int main(void)
|
|||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - Apply an outline to a texture");
|
||||
|
||||
Texture2D texture = LoadTexture("resources/fudesumi.png");
|
||||
Texture texture = LoadTexture("resources/fudesumi.png");
|
||||
|
||||
Shader shdrOutline = LoadShader(0, TextFormat("resources/shaders/glsl%i/outline.fs", GLSL_VERSION));
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue