summaryrefslogtreecommitdiff
path: root/src/example/03_texture/03_texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/example/03_texture/03_texture.c')
-rw-r--r--src/example/03_texture/03_texture.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/example/03_texture/03_texture.c b/src/example/03_texture/03_texture.c
index 2e9d6f1..23597c9 100644
--- a/src/example/03_texture/03_texture.c
+++ b/src/example/03_texture/03_texture.c
@@ -43,16 +43,20 @@ static Mesh* cyborg_mesh;
static Texture* ball_albedo;
static Mesh* ball_mesh;
+Texture* base_color_texs[];
+
EXAMPLE void onload_texture(void* data) {
- CameraConfig* conf = (CameraConfig*)data;
+ CameraConfig* conf = (CameraConfig*)data;
//mech_albedo = texture_loadfromfile("res/dieselpunk/mech_basecolor.tga");
- mech_albedo = texture_loadfromfile("res/gun/gun.png");
+ //mech_albedo = texture_loadfromfile("res/station/textures/projekt_Gas_BaseColor.png");
+ mech_albedo = texture_loadfromfile("res/townscaper/town_diffuse.jpg");
mech_normal = texture_loadfromfile("res/dieselpunk/mech_normal.tga");
mech_roughness = texture_loadfromfile("res/dieselpunk/mech_roughness.tga");
mech_metalness = texture_loadfromfile("res/dieselpunk/mech_metalness.tga");
- //mech_mesh = mesh_loadfromobj("res/dieselpunk/mech.obj");
- mech_mesh = mesh_loadfromobj("res/gun/gun.obj");
+ mech_mesh = mesh_loadfromobj("res/townscaper/town.obj");
+ //mech_mesh = mesh_loadfromobj("res/gun/gun.obj");
+ //mech_mesh = mesh_loadfromobj("res/station/station.obj");
//mech_mesh = mesh_loadfromobj("res/gun/triangle.obj");
ground_albedo = texture_loadfromfile("res/dieselpunk/ground_basecolor.tga");
ground_mesh = mesh_loadfromobj("res/dieselpunk/ground.obj");
@@ -70,6 +74,7 @@ EXAMPLE void onevent_texture(void* data) {
EXAMPLE void onupdate_texture(void*data) {
ssr_matrixmode(MATRIX_MODEL);
ssr_loadidentity();
+ ssr_scale(100,100,100);
Vec3 light = {1, 0, 0};
ssr_setuniformvec3(0, &light);
@@ -101,8 +106,14 @@ EXAMPLE void ondraw_texture(void*data) {
ssr_setuniformtex(1, mech_normal);
ssr_setuniformtex(2, mech_roughness);
ssr_setuniformtex(3, mech_metalness);
- ssr_bindvertices(mech_mesh->vertices, mech_mesh->vert_count, mech_mesh->triangles, mech_mesh->tris_count);
- ssr_draw(PRIMITIVE_TRIANGLE);
+ ssr_bindvertices(mech_mesh->vertices, mech_mesh->vert_count);
+ for (int i = 0; i < mech_mesh->submesh_count; ++i) {
+ ssr_bindindices(mech_mesh->submesh[i].triangles, mech_mesh->submesh[i].tris_count);
+ ssr_draw(PRIMITIVE_TRIANGLE);
+ }
+
+ ssr_unbindvertices();
+ ssr_unbindindices();
/*
ssr_setstencilfunc(STENCILFUNC_EQUAL, 1, 0xff);