diff --git a/Faceball2030/assets/dot.png b/Faceball2030/assets/dot.png index cd677ee..c4a2634 100644 Binary files a/Faceball2030/assets/dot.png and b/Faceball2030/assets/dot.png differ diff --git a/Faceball2030/assets/enemies/Cube2_auv.png b/Faceball2030/assets/enemies/Cube2_auv.png new file mode 100644 index 0000000..e8792c5 Binary files /dev/null and b/Faceball2030/assets/enemies/Cube2_auv.png differ diff --git a/Faceball2030/assets/enemies/Cylinder2_auv.png b/Faceball2030/assets/enemies/Cylinder2_auv.png new file mode 100644 index 0000000..f0a9a8a Binary files /dev/null and b/Faceball2030/assets/enemies/Cylinder2_auv.png differ diff --git a/Faceball2030/assets/enemies/ShootMe.mtl b/Faceball2030/assets/enemies/ShootMe.mtl index df63c2a..a356d51 100644 --- a/Faceball2030/assets/enemies/ShootMe.mtl +++ b/Faceball2030/assets/enemies/ShootMe.mtl @@ -1,5 +1,5 @@ # Exported from Wings 3D 2.2.9 -newmtl Cylinder1_auv +newmtl Cylinder2_auv Ns 19.999999999999996 d 1.0 illum 2 @@ -7,5 +7,5 @@ Kd 1.0 1.0 1.0 Ka 0.0 0.0 0.0 Ks 0.19 0.19 0.19 Ke 0.0 0.0 0.0 -map_Kd Cylinder1_auv.png +map_Kd Cylinder2_auv.png diff --git a/Faceball2030/assets/enemies/ShootMe.png b/Faceball2030/assets/enemies/ShootMe.png index 928d6cf..51ed78d 100644 Binary files a/Faceball2030/assets/enemies/ShootMe.png and b/Faceball2030/assets/enemies/ShootMe.png differ diff --git a/Faceball2030/assets/enemies/ShootMe.wings b/Faceball2030/assets/enemies/ShootMe.wings new file mode 100644 index 0000000..b3d0dbf Binary files /dev/null and b/Faceball2030/assets/enemies/ShootMe.wings differ diff --git a/Faceball2030/assets/enemies/ShootMe.xcf b/Faceball2030/assets/enemies/ShootMe.xcf new file mode 100644 index 0000000..4fee5c2 Binary files /dev/null and b/Faceball2030/assets/enemies/ShootMe.xcf differ diff --git a/Faceball2030/assets/enemies/dirt.png b/Faceball2030/assets/enemies/dirt.png new file mode 100644 index 0000000..7951b56 Binary files /dev/null and b/Faceball2030/assets/enemies/dirt.png differ diff --git a/Faceball2030/assets/enemies/untitled.mtl b/Faceball2030/assets/enemies/untitled.mtl new file mode 100644 index 0000000..a13b94f --- /dev/null +++ b/Faceball2030/assets/enemies/untitled.mtl @@ -0,0 +1,11 @@ +# Exported from Wings 3D 2.2.9 +newmtl Cube2_auv +Ns 19.999999999999996 +d 1.0 +illum 2 +Kd 1.0 1.0 1.0 +Ka 0.0 0.0 0.0 +Ks 0.19 0.19 0.19 +Ke 0.0 0.0 0.0 +map_Kd Cube2_auv.png + diff --git a/Faceball2030/main.cpp b/Faceball2030/main.cpp index 1b4de39..6063ec5 100644 --- a/Faceball2030/main.cpp +++ b/Faceball2030/main.cpp @@ -35,6 +35,7 @@ struct triangle vec3d p[3]; vec2d uv[3]; Pixel col; + Decal* tex; }; struct MapSquare { @@ -77,14 +78,14 @@ struct mesh float x, y, z; f >> x >> y >> z; verts.push_back({ x,y,z }); - //std::cout<> u >> v; - uvs.push_back({ u,v }); - //std::cout<coords; + for (auto& t : listTriangles) { // Rasterize triangle SetDecalStructure(DecalStructure::LIST); SetDecalMode(DecalMode::NORMAL); - DrawPolygonDecal(mapMesh.texture, { + DrawPolygonDecal(t.tex, { {t.p[0].x, t.p[0].y}, {t.p[1].x, t.p[1].y}, {t.p[2].x, t.p[2].y} @@ -626,7 +633,7 @@ private: {t.uv[1].u,t.uv[1].v}, {t.uv[2].u,t.uv[2].v}, }, { t.uv[0].w,t.uv[1].w,t.uv[2].w }, { t.p[0].z,t.p[1].z,t.p[2].z }, { t.col,t.col,t.col }); - SetDecalMode(DecalMode::WIREFRAME); + /*SetDecalMode(DecalMode::WIREFRAME); DrawPolygonDecal(nullptr,{ {t.p[0].x, t.p[0].y}, {t.p[1].x, t.p[1].y}, @@ -635,10 +642,16 @@ private: {0,0}, {0,0}, {0,0}, - }, { t.uv[0].w,t.uv[1].w,t.uv[2].w }, { t.p[0].z,t.p[1].z,t.p[2].z }, { BLACK,BLACK,BLACK }); + }, { t.uv[0].w,t.uv[1].w,t.uv[2].w }, { t.p[0].z,t.p[1].z,t.p[2].z }, { BLACK,BLACK,BLACK });*/ SetDecalStructure(DecalStructure::FAN); triRenderCount++; } + + for (const auto&key:coords){ + vf2d coord = key.first; + vf2d val = key.second; + DrawStringDecal({ coord.x,coord.y }, val.str()); + } } SetDecalMode(DecalMode::NORMAL); @@ -702,7 +715,7 @@ private: } } - Decal* dot; + Decal* dot,*enemy_ShootMe_tex; vi2d MAP_SIZE = { 10,10 }; std::vector>map; std::vectorobjects; @@ -713,9 +726,16 @@ public: sAppName = "Faceball 2030"; matProj = Matrix_MakeProjection(90.0f, (float)ScreenHeight() / (float)ScreenWidth(), 0.1f, 1000.0f); dot = new Decal(new Sprite("assets/dot.png")); + enemy_ShootMe_tex = new Decal(new Sprite("assets/enemies/ShootMe.png")); mapMesh.texture = dot; + mesh testEnemy; + testEnemy.LoadFromObjectFile("assets/enemies/ShootMe.obj"); + testEnemy.texture = enemy_ShootMe_tex; + + objects.push_back(testEnemy); + for (int y = 0; y < MAP_SIZE.y; y++) { std::vectorrow; for (int x = 0; x < MAP_SIZE.x; x++) { @@ -803,13 +823,14 @@ public: } } - objects.push_back(mapMesh); + //objects.push_back(mapMesh); return true; } bool OnUserUpdate(float fElapsedTime) override { + objects[0].rot += PI / 8 * fElapsedTime; HandleKeys(fElapsedTime); RenderWorld(); return true;