mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 00:53:52 +00:00
- Punch Hole / Fill Hole buttons in Sculpt panel: creates terrain holes (4x4 bitmask) for cave entrances, mine shafts, etc. Uses brush radius to determine affected area. - Recent Textures: paint panel shows last 6 used textures as quick- select buttons (no need to re-search the full list) - Holes saved in ADT format (MCNK holes field) and respected by the mesh generator (triangles skipped at hole positions)
44 lines
1.5 KiB
C++
44 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include "editor_brush.hpp"
|
|
#include "pipeline/adt_loader.hpp"
|
|
#include <string>
|
|
#include <vector>
|
|
#include <glm/glm.hpp>
|
|
|
|
namespace wowee {
|
|
namespace editor {
|
|
|
|
class TexturePainter {
|
|
public:
|
|
void setTerrain(pipeline::ADTTerrain* terrain) { terrain_ = terrain; }
|
|
|
|
void setActiveTexture(const std::string& texturePath);
|
|
const std::string& getActiveTexture() const { return activeTexture_; }
|
|
const std::vector<std::string>& getRecentTextures() const { return recentTextures_; }
|
|
|
|
// Paint the active texture at the given world position
|
|
// Returns list of modified chunk indices
|
|
std::vector<int> paint(const glm::vec3& center, float radius, float strength, float falloff);
|
|
|
|
// Erase a texture layer at the given position
|
|
std::vector<int> erase(const glm::vec3& center, float radius, float strength, float falloff);
|
|
|
|
private:
|
|
uint32_t ensureTextureInList(const std::string& path);
|
|
int ensureLayerOnChunk(int chunkIdx, uint32_t textureId);
|
|
void modifyAlpha(int chunkIdx, int layerIdx, const glm::vec3& center,
|
|
float radius, float strength, float falloff, bool erasing);
|
|
|
|
glm::vec2 worldToChunkUV(int chunkIdx, const glm::vec3& worldPos) const;
|
|
|
|
pipeline::ADTTerrain* terrain_ = nullptr;
|
|
std::string activeTexture_;
|
|
std::vector<std::string> recentTextures_;
|
|
|
|
static constexpr float TILE_SIZE = 533.33333f;
|
|
static constexpr float CHUNK_SIZE = TILE_SIZE / 16.0f;
|
|
};
|
|
|
|
} // namespace editor
|
|
} // namespace wowee
|