diff options
author | chai <chaifix@163.com> | 2020-07-28 00:30:33 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-07-28 00:30:33 +0800 |
commit | 5dfdb6b58b2dc7bbd3348004c1fcd17e23fea48b (patch) | |
tree | a03f1a01382595ed50cc4780a728b22013f6d5a0 /src/example/03_texture | |
parent | 690f20cdbe8dad3fce7a547934a5a8322303342d (diff) |
Diffstat (limited to 'src/example/03_texture')
-rw-r--r-- | src/example/03_texture/03_texture.c | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/src/example/03_texture/03_texture.c b/src/example/03_texture/03_texture.c index 23597c9..66643bb 100644 --- a/src/example/03_texture/03_texture.c +++ b/src/example/03_texture/03_texture.c @@ -48,23 +48,24 @@ Texture* base_color_texs[]; EXAMPLE void onload_texture(void* data) { CameraConfig* conf = (CameraConfig*)data; - //mech_albedo = texture_loadfromfile("res/dieselpunk/mech_basecolor.tga"); - //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/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"); - yingham_albedo = texture_loadfromfile("res/dieselpunk/yingham_basecolor.tga"); - yingham_mesh = mesh_loadfromobj("res/dieselpunk/yingham.obj"); - - cyborg_albedo = texture_loadfromfile("res/cyborg/cyborg_diffuse.png"); - cyborg_mesh = mesh_loadfromobj("res/cyborg/cyborg.obj"); + mech_albedo = texture_loadfromfile("assets/dieselpunk/mech_basecolor.tga"); + //mech_albedo = texture_loadfromfile("assets/station/textuassets/projekt_Gas_BaseColor.png"); + //mech_albedo = texture_loadfromfile("assets/townscaper/town_diffuse.jpg"); + mech_normal = texture_loadfromfile("assets/dieselpunk/mech_normal.tga"); + mech_roughness = texture_loadfromfile("assets/dieselpunk/mech_roughness.tga"); + mech_metalness = texture_loadfromfile("assets/dieselpunk/mech_metalness.tga"); + mech_mesh = mesh_loadfromobj("assets/dieselpunk/mech.obj"); + //mech_mesh = mesh_loadfromobj("assets/townscaper/town.obj"); + //mech_mesh = mesh_loadfromobj("assets/gun/gun.obj"); + //mech_mesh = mesh_loadfromobj("assets/station/station.obj"); + //mech_mesh = mesh_loadfromobj("assets/gun/triangle.obj"); + ground_albedo = texture_loadfromfile("assets/dieselpunk/ground_basecolor.tga"); + ground_mesh = mesh_loadfromobj("assets/dieselpunk/ground.obj"); + yingham_albedo = texture_loadfromfile("assets/dieselpunk/yingham_basecolor.tga"); + yingham_mesh = mesh_loadfromobj("assets/dieselpunk/yingham.obj"); + + cyborg_albedo = texture_loadfromfile("assets/cyborg/cyborg_diffuse.png"); + cyborg_mesh = mesh_loadfromobj("assets/cyborg/cyborg.obj"); } EXAMPLE void onevent_texture(void* data) { @@ -74,7 +75,7 @@ EXAMPLE void onevent_texture(void* data) { EXAMPLE void onupdate_texture(void*data) { ssr_matrixmode(MATRIX_MODEL); ssr_loadidentity(); - ssr_scale(100,100,100); + //ssr_scale(100,100,100); Vec3 light = {1, 0, 0}; ssr_setuniformvec3(0, &light); @@ -120,14 +121,16 @@ EXAMPLE void ondraw_texture(void*data) { ssr_setstencilop(STENCILOP_KEEP, STENCILOP_KEEP, STENCILOP_KEEP); */ /*render yingham*/ - //ssr_setuniformtex(0, yingham_albedo); - //ssr_bindvertices(yingham_mesh->vertices, yingham_mesh->vert_count, yingham_mesh->triangles, yingham_mesh->tris_count); - //ssr_draw(PRIMITIVE_TRIANGLE); + ssr_setuniformtex(0, yingham_albedo); + ssr_bindvertices(yingham_mesh->vertices, yingham_mesh->vert_count); + ssr_bindindices(yingham_mesh->triangles, yingham_mesh->tris_count); + ssr_draw(PRIMITIVE_TRIANGLE); /*render ground*/ - //ssr_setuniformtex(0, ground_albedo); - //ssr_bindvertices(ground_mesh->vertices, ground_mesh->vert_count, ground_mesh->triangles, ground_mesh->tris_count); - //ssr_draw(PRIMITIVE_TRIANGLE); + ssr_setuniformtex(0, ground_albedo); + ssr_bindvertices(ground_mesh->vertices, ground_mesh->vert_count); + ssr_bindindices(ground_mesh->triangles, ground_mesh->tris_count); + ssr_draw(PRIMITIVE_TRIANGLE); //draw_tbn(mech_mesh, VISUAL_ALL, 4); |