diff options
| author | vimene <vincent.menegaux@gmail.com> | 2025-12-29 21:21:09 +0100 |
|---|---|---|
| committer | vimene <vincent.menegaux@gmail.com> | 2025-12-29 21:21:09 +0100 |
| commit | 8ab4780f134c33a9e11ac0fe0bd866e17d3ee650 (patch) | |
| tree | e59efd8a466312b790a2d68e679700b47e748c75 /src/obj_parser.cpp | |
| parent | dd187445972989dc44428e8cf185964da9e5c0c4 (diff) | |
| download | engine-8ab4780f134c33a9e11ac0fe0bd866e17d3ee650.tar.gz | |
starting to merge vulkan with the engine
- refactored scene_main to be able to share code between software and
hardware renderers, while still sharing code between terminal software
renderer and graphical software renderer
- made the hardware renderer use scene objects vertices and transforms,
instead of hardcoded ones
- made the hardware renderer use the scene's camera
- made .obj parser create Vector3 instead of Vector4, which didn't made
sense
- removed unnecessary std::
- lots of small changes
Diffstat (limited to 'src/obj_parser.cpp')
| -rw-r--r-- | src/obj_parser.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/obj_parser.cpp b/src/obj_parser.cpp index b30eff1..d83d75f 100644 --- a/src/obj_parser.cpp +++ b/src/obj_parser.cpp @@ -104,14 +104,10 @@ o3d::Mesh parse_object(const std::string& obj_path) { // std::cout << "Object: " << line.substr(2) << std::endl; } else if (line.rfind("v ", 0) == 0) { auto s_coords = split(line.substr(2), ' '); - math::Vector4 v{parse_float(s_coords[0]), parse_float(s_coords[1]), parse_float(s_coords[2]), 1.f}; - // std::cout << "Vertex x: " << v.x << " y: " << v.y << " z: " << v.z << std::endl; - mesh.vertices.push_back(v); + mesh.vertices.emplace_back(parse_float(s_coords[0]), parse_float(s_coords[1]), parse_float(s_coords[2])); } else if (line.rfind("vn ", 0) == 0) { auto s_coords = split(line.substr(3), ' '); - math::Vector3 vn{parse_float(s_coords[0]), parse_float(s_coords[1]), parse_float(s_coords[2])}; - // std::cout << "Vertex normal x: " << vn.x << " y: " << vn.y << " z: " << vn.z << std::endl; - mesh.normals.push_back(vn); + mesh.normals.emplace_back(parse_float(s_coords[0]), parse_float(s_coords[1]), parse_float(s_coords[2])); } else if (line.rfind("s ", 0) == 0) { // auto smooth = false; // auto s_smooth = line.substr(2); |
