Rendering Engine 0.2.9
Modular Graphics Rendering Engine | v0.2.9
model_tests.cpp
Go to the documentation of this file.
1#include <stdio.h>
2#include <cstdint>
3#include "gtest/gtest.h"
4
5#include "../RenderingLibrary/Include/image_data.hpp"
6#include "../RenderingLibrary/Include/model.hpp"
7#include "../RenderingLibrary/Include/mesh.hpp"
8
9using ::testing::EmptyTestEventListener;
10using ::testing::InitGoogleTest;
11using ::testing::Test;
12using ::testing::TestEventListeners;
13using ::testing::TestInfo;
14using ::testing::TestPartResult;
15using ::testing::TestSuite;
16using ::testing::UnitTest;
17
18using namespace rendering_engine;
19
20TEST(ImageDataTest, ModelsLoading)
21{
22 std::string const modelFilepath{ "../Content/Models/TestCube/test_cube.fbx" };
23 std::string const textureFilepath{ "../Content/Models/TestCube/test_cube_color.png" };
24
25 ImageData textureImageData(textureFilepath);
26 textureImageData.GetHeight();
27
28 Model model(modelFilepath);
29 ASSERT_TRUE(model.HasMeshes());
30
31 auto const meshName = model.Meshes().at(0)->Name();
32 auto const vertices = model.Meshes().at(0)->Vertices();
33 auto const indices = model.Meshes().at(0)->Indices();
34 auto const normals = model.Meshes().at(0)->Normals();
35 auto const texCoord = model.Meshes().at(0)->TextureCoordinates();
36 EXPECT_NE(0, vertices.size());
37}
Represents raw 2D image data stored in memory.
Definition: image_data.hpp:80
unsigned int GetHeight() const
Returns the image height.
Definition: image_data.hpp:145
Represents a 3D model composed of multiple meshes and materials.
Definition: model.hpp:30
bool HasMeshes() const
Checks whether this model contains any meshes.
Definition: model.cpp:76
const std::vector< std::shared_ptr< Mesh > > & Meshes() const
Returns the list of meshes belonging to this model.
Definition: model.cpp:84
TEST(ImageDataTest, ModelsLoading)
Definition: model_tests.cpp:20