4 #include <SFML/Graphics.hpp>
5 #include <eigen3/Eigen/Dense>
11 #include "Transformable.hpp"
27 void load(std::string str);
33 void load(std::istream& stream);
46 std::vector<std::unique_ptr<Light>>& lights,
47 const std::shared_ptr<Camera>& camera,
72 void translate(
float x,
float y,
float z)
override;
73 void scale(
float m)
override;
74 void rotate(
float x,
float y,
float z)
override;
78 void sortFaces(
const Eigen::Matrix3Xf& projected);
88 std::vector<sf::Vector2f>
uvMap;
92 std::vector<Eigen::Vector3i>
faces;
Eigen::Matrix3Xf verts
The vertices of the object as points in 3D space.
Definition: Object.hpp:86
void loadTexture(sf::Texture texture)
Definition: Object.cpp:111
sf::Texture getTexture()
Definition: Object.hpp:64
sf::VertexArray render(std::vector< std::unique_ptr< Light >> &lights, const std::shared_ptr< Camera > &camera, int winHeight)
Definition: Object.cpp:85
Eigen::Matrix3Xf normals
The object's vertex normals.
Definition: Object.hpp:94
std::vector< sf::Vector2f > uvMap
A list of normalised UV points to map the texture to the mesh.
Definition: Object.hpp:88
void load(std::string str)
Definition: Object.cpp:49
bool textured
Has the object been textured.
Definition: Object.hpp:84
void rotate(float x, float y, float z) override
Definition: Object.cpp:126
Definition: Object.hpp:19
void translate(float x, float y, float z) override
Definition: Object.cpp:121
std::vector< Eigen::Vector3i > texCoords
A list of which UVs to use for each face.
Definition: Object.hpp:96
void sortFaces(const Eigen::Matrix3Xf &projected)
Sort the mesh faces by distance from the camera so they render in the correct order.
Definition: Object.cpp:54
void scale(float m) override
Definition: Object.cpp:135
std::vector< sf::Vector2f > uvTexMap
A list of scaled points to map this object's texture to the mesh.
Definition: Object.hpp:90
std::vector< Eigen::Vector3i > faces
A list of faces made up of three vertices to use.
Definition: Object.hpp:92
void calcNormals()
Calculate vertex normals based on the mesh faces.
Definition: Object.cpp:67
void transform(const Transformation &t) override
Definition: Object.cpp:62
bool isTextured()
Definition: Object.hpp:70
sf::Texture texture
The texture to render with, if any.
Definition: Object.hpp:82