mirror of
https://github.com/Relintai/props.git
synced 2024-11-12 10:15:25 +01:00
Implemented texture rects for the tiled wall mesher.
This commit is contained in:
parent
67e9407188
commit
104a1c63d0
@ -466,7 +466,7 @@ void PropMesher::reset() {
|
||||
_last_tangent = Plane();
|
||||
}
|
||||
|
||||
void PropMesher::add_tiled_wall_simple(const int width, const int height, const Transform &transform, const Ref<TiledWallData> &tiled_wall_data, const Ref<PropMaterialCache> &cache) {
|
||||
void PropMesher::add_tiled_wall_simple(const int width, const int height, const Transform &transform, const Ref<TiledWallData> &tiled_wall_data, Ref<PropMaterialCache> cache) {
|
||||
ERR_FAIL_COND(!tiled_wall_data.is_valid());
|
||||
ERR_FAIL_COND(!cache.is_valid());
|
||||
ERR_FAIL_COND(width < 0);
|
||||
@ -480,6 +480,22 @@ void PropMesher::add_tiled_wall_simple(const int width, const int height, const
|
||||
Vector<Rect2> normal_rects;
|
||||
Vector<Rect2> flavour_rects;
|
||||
|
||||
for (int i = 0; i < tiled_wall_data->get_texture_count(); ++i) {
|
||||
const Ref<Texture> &t = tiled_wall_data->get_texture(i);
|
||||
|
||||
if (t.is_valid()) {
|
||||
normal_rects.push_back(cache->texture_get_uv_rect(t));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < tiled_wall_data->get_flavour_texture_count(); ++i) {
|
||||
const Ref<Texture> &t = tiled_wall_data->get_flavour_texture(i);
|
||||
|
||||
if (t.is_valid()) {
|
||||
flavour_rects.push_back(cache->texture_get_uv_rect(t));
|
||||
}
|
||||
}
|
||||
|
||||
//fallback
|
||||
if (normal_rects.size() == 0) {
|
||||
normal_rects.push_back(Rect2(0, 0, 1, 1));
|
||||
|
@ -145,7 +145,7 @@ public:
|
||||
|
||||
void reset();
|
||||
|
||||
void add_tiled_wall_simple(const int width, const int height, const Transform &transform, const Ref<TiledWallData> &tiled_wall_data, const Ref<PropMaterialCache> &cache);
|
||||
void add_tiled_wall_simple(const int width, const int height, const Transform &transform, const Ref<TiledWallData> &tiled_wall_data, Ref<PropMaterialCache> cache);
|
||||
void add_tiled_wall_mesh_rect_simple(const int x, const int y, const Transform &transform, const Rect2 &texture_rect);
|
||||
Vector2 transform_uv(const Vector2 &uv, const Rect2 &rect) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user