mirror of
https://github.com/allankoechke/raylib-cpp.git
synced 2026-11-30 10:59:00 +00:00
Merge pull request #24 from RobLoach/fixtests
Update Mesh, Image, Rectangle, and Texture operators
This commit is contained in:
@@ -34,7 +34,7 @@ namespace raylib {
|
||||
Image(::Texture2D texture) {
|
||||
set(::GetTextureData(texture));
|
||||
}
|
||||
Image(int width, int height, Color color) {
|
||||
Image(int width, int height, Color color = raylib::Color::RayWhite) {
|
||||
set(::GenImageColor(width, height, color));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ extern "C"{
|
||||
#include "utils.hpp"
|
||||
|
||||
#include "BoundingBox.hpp"
|
||||
#include "Model.hpp"
|
||||
|
||||
namespace raylib {
|
||||
class Mesh : public ::Mesh {
|
||||
@@ -60,17 +61,21 @@ namespace raylib {
|
||||
Unload();
|
||||
}
|
||||
|
||||
inline void Export(const std::string& fileName) {
|
||||
inline Mesh& Export(const std::string& fileName) {
|
||||
ExportMesh(*this, fileName.c_str());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void Unload() {
|
||||
::UnloadMesh(*this);
|
||||
}
|
||||
|
||||
inline BoundingBox BoundingBox() {
|
||||
inline raylib::BoundingBox BoundingBox() {
|
||||
return ::MeshBoundingBox(*this);
|
||||
}
|
||||
operator raylib::BoundingBox() {
|
||||
return BoundingBox();
|
||||
}
|
||||
|
||||
inline Mesh& Tangents() {
|
||||
::MeshTangents(this);
|
||||
@@ -81,6 +86,13 @@ namespace raylib {
|
||||
::MeshBinormals(this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline raylib::Model LoadModelFrom() {
|
||||
return ::LoadModelFromMesh(*this);
|
||||
}
|
||||
operator raylib::Model() {
|
||||
return LoadModelFrom();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ extern "C"{
|
||||
#endif
|
||||
|
||||
#include "utils.hpp"
|
||||
#include "Vector2.hpp"
|
||||
|
||||
namespace raylib {
|
||||
class Rectangle : public ::Rectangle {
|
||||
|
||||
@@ -81,6 +81,9 @@ namespace raylib {
|
||||
inline Image GetTextureData() {
|
||||
return ::GetTextureData(*this);
|
||||
}
|
||||
inline operator raylib::Image() {
|
||||
return GetTextureData();
|
||||
}
|
||||
|
||||
inline Texture2D& GenMipmaps() {
|
||||
::GenTextureMipmaps(this);
|
||||
|
||||
Reference in New Issue
Block a user