Raylib setup with model loading.
Added some fish, too.
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*.o
|
||||||
|
neofish
|
||||||
31
Makefile
Normal file
31
Makefile
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
SRC = neofish.c
|
||||||
|
OBJ = ${SRC:.c=.o}
|
||||||
|
CFLAGS = -std=c99 -pedantic -Wall -Wextra -O2
|
||||||
|
LIBS = ${shell pkg-config --libs raylib}
|
||||||
|
CC = cc
|
||||||
|
PREFIX = /usr/local
|
||||||
|
|
||||||
|
all: neofish
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
${CC} -c ${CFLAGS} ${LIBS} $<
|
||||||
|
|
||||||
|
neofish: ${OBJ}
|
||||||
|
${CC} -o $@ ${OBJ} ${LIBS}
|
||||||
|
|
||||||
|
install: all
|
||||||
|
mkdir -p ${PREFIX}/bin
|
||||||
|
cp -f neofish ${PREFIX}/bin
|
||||||
|
chmod 755 ${PREFIX}/bin/neofish
|
||||||
|
cp -r assets ${PREFIX}/bin
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f neofish ${OBJ}
|
||||||
|
|
||||||
|
test: neofish
|
||||||
|
./neofish
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f ${PREFIX}/bin/neofish
|
||||||
|
|
||||||
|
.PHONY: all clean install uninstall
|
||||||
BIN
assets/fish/blush.glb
Normal file
BIN
assets/fish/blush.glb
Normal file
Binary file not shown.
BIN
assets/fish/first.glb
Normal file
BIN
assets/fish/first.glb
Normal file
Binary file not shown.
BIN
assets/fish/goldfish.glb
Normal file
BIN
assets/fish/goldfish.glb
Normal file
Binary file not shown.
42
neofish.c
Normal file
42
neofish.c
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#include <raylib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define WIN_HEIGHT 600
|
||||||
|
#define WIN_WIDTH 800
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
|
||||||
|
InitWindow(WIN_WIDTH, WIN_HEIGHT, "NEOFISH");
|
||||||
|
|
||||||
|
Camera camera = { 0 };
|
||||||
|
camera.position = (Vector3){ 6.0f, 6.0f, 6.0f };
|
||||||
|
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f };
|
||||||
|
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
|
||||||
|
camera.fovy = 45.0f;
|
||||||
|
camera.projection = CAMERA_PERSPECTIVE;
|
||||||
|
|
||||||
|
Model model = LoadModel("assets/fish/frog.glb");
|
||||||
|
Vector3 position = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
|
while (!WindowShouldClose()) {
|
||||||
|
UpdateCamera(&camera, CAMERA_ORBITAL);
|
||||||
|
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(BLACK);
|
||||||
|
BeginMode3D(camera);
|
||||||
|
DrawModel(model, position, 1.0f, WHITE);
|
||||||
|
DrawGrid(10, 1.0f);
|
||||||
|
EndMode3D();
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
}
|
||||||
|
|
||||||
|
UnloadModel(model);
|
||||||
|
CloseWindow();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user