CellGrid+Frames done
This commit is contained in:
@@ -134,11 +134,11 @@ struct CellGridComponent {
|
||||
std::string ceilingRectName;
|
||||
std::string extWallRectName;
|
||||
std::string intWallRectName;
|
||||
std::string doorRectName;
|
||||
std::string windowRectName;
|
||||
std::string roofRectName;
|
||||
std::string windowFrameRectName;
|
||||
std::string doorFrameRectName;
|
||||
// Frame texture rectangles
|
||||
std::string extDoorFrameRectName;
|
||||
std::string intDoorFrameRectName;
|
||||
std::string extWindowFrameRectName;
|
||||
std::string intWindowFrameRectName;
|
||||
|
||||
// Dirty flag - triggers rebuild
|
||||
bool dirty = true;
|
||||
|
||||
@@ -217,7 +217,7 @@ void CellGridSystem::buildCellGrid(flecs::entity entity,
|
||||
materialEntity);
|
||||
applyUVMappingToBuffer(intDoorsTb, grid.intWallRectName,
|
||||
materialEntity);
|
||||
applyUVMappingToBuffer(roofTb, grid.roofRectName, materialEntity);
|
||||
applyUVMappingToBuffer(roofTb, grid.extWallRectName, materialEntity);
|
||||
|
||||
// Generate unique base name
|
||||
std::string baseName = "CellGrid_" + std::to_string(entity.id()) + "_" +
|
||||
@@ -2761,7 +2761,7 @@ void CellGridSystem::createWindowFrameMeshes(const CellGridComponent &grid,
|
||||
.addToTriangleBuffer(extFrameTb);
|
||||
|
||||
// Apply UV mapping and create mesh
|
||||
applyUVMappingToBuffer(extFrameTb, grid.windowFrameRectName,
|
||||
applyUVMappingToBuffer(extFrameTb, grid.extWindowFrameRectName,
|
||||
materialEntity);
|
||||
Ogre::MeshPtr extMesh = extFrameTb.transformToMesh(extFrameMeshName);
|
||||
if (!materialName.empty() && extMesh->getNumSubMeshes() > 0) {
|
||||
@@ -2812,7 +2812,7 @@ void CellGridSystem::createWindowFrameMeshes(const CellGridComponent &grid,
|
||||
.setEnableNormals(true)
|
||||
.addToTriangleBuffer(intFrameTb);
|
||||
|
||||
applyUVMappingToBuffer(intFrameTb, grid.windowFrameRectName,
|
||||
applyUVMappingToBuffer(intFrameTb, grid.intWindowFrameRectName,
|
||||
materialEntity);
|
||||
Ogre::MeshPtr intMesh = intFrameTb.transformToMesh(intFrameMeshName);
|
||||
if (!materialName.empty() && intMesh->getNumSubMeshes() > 0) {
|
||||
@@ -2904,7 +2904,7 @@ void CellGridSystem::createDoorFrameMeshes(const CellGridComponent &grid,
|
||||
.setEnableNormals(true)
|
||||
.addToTriangleBuffer(extFrameTb);
|
||||
|
||||
applyUVMappingToBuffer(extFrameTb, grid.doorFrameRectName,
|
||||
applyUVMappingToBuffer(extFrameTb, grid.extDoorFrameRectName,
|
||||
materialEntity);
|
||||
Ogre::MeshPtr extMesh = extFrameTb.transformToMesh(extFrameMeshName);
|
||||
if (!materialName.empty() && extMesh->getNumSubMeshes() > 0) {
|
||||
@@ -2951,7 +2951,7 @@ void CellGridSystem::createDoorFrameMeshes(const CellGridComponent &grid,
|
||||
.setEnableNormals(true)
|
||||
.addToTriangleBuffer(intFrameTb);
|
||||
|
||||
applyUVMappingToBuffer(intFrameTb, grid.doorFrameRectName,
|
||||
applyUVMappingToBuffer(intFrameTb, grid.intDoorFrameRectName,
|
||||
materialEntity);
|
||||
Ogre::MeshPtr intMesh = intFrameTb.transformToMesh(intFrameMeshName);
|
||||
if (!materialName.empty() && intMesh->getNumSubMeshes() > 0) {
|
||||
|
||||
@@ -1274,9 +1274,10 @@ nlohmann::json SceneSerializer::serializeCellGrid(flecs::entity entity)
|
||||
json["ceilingRectName"] = grid.ceilingRectName;
|
||||
json["extWallRectName"] = grid.extWallRectName;
|
||||
json["intWallRectName"] = grid.intWallRectName;
|
||||
json["doorRectName"] = grid.doorRectName;
|
||||
json["windowRectName"] = grid.windowRectName;
|
||||
json["roofRectName"] = grid.roofRectName;
|
||||
json["extDoorFrameRectName"] = grid.extDoorFrameRectName;
|
||||
json["intDoorFrameRectName"] = grid.intDoorFrameRectName;
|
||||
json["extWindowFrameRectName"] = grid.extWindowFrameRectName;
|
||||
json["intWindowFrameRectName"] = grid.intWindowFrameRectName;
|
||||
|
||||
// Serialize cells
|
||||
nlohmann::json cellsJson = nlohmann::json::array();
|
||||
@@ -1447,9 +1448,10 @@ void SceneSerializer::deserializeCellGrid(flecs::entity entity, const nlohmann::
|
||||
grid.ceilingRectName = json.value("ceilingRectName", "");
|
||||
grid.extWallRectName = json.value("extWallRectName", "");
|
||||
grid.intWallRectName = json.value("intWallRectName", "");
|
||||
grid.doorRectName = json.value("doorRectName", "");
|
||||
grid.windowRectName = json.value("windowRectName", "");
|
||||
grid.roofRectName = json.value("roofRectName", "");
|
||||
grid.extDoorFrameRectName = json.value("extDoorFrameRectName", "");
|
||||
grid.intDoorFrameRectName = json.value("intDoorFrameRectName", "");
|
||||
grid.extWindowFrameRectName = json.value("extWindowFrameRectName", "");
|
||||
grid.intWindowFrameRectName = json.value("intWindowFrameRectName", "");
|
||||
|
||||
// Deserialize cells
|
||||
if (json.contains("cells") && json["cells"].is_array()) {
|
||||
|
||||
@@ -340,13 +340,16 @@ void CellGridEditor::renderTextureRectEditor(flecs::entity entity, CellGridCompo
|
||||
if (renderRectCombo("Internal Walls", grid.intWallRectName)) {
|
||||
grid.markDirty();
|
||||
}
|
||||
if (renderRectCombo("Doors", grid.doorRectName)) {
|
||||
if (renderRectCombo("Ext Door Frames", grid.extDoorFrameRectName)) {
|
||||
grid.markDirty();
|
||||
}
|
||||
if (renderRectCombo("Windows", grid.windowRectName)) {
|
||||
if (renderRectCombo("Int Door Frames", grid.intDoorFrameRectName)) {
|
||||
grid.markDirty();
|
||||
}
|
||||
if (renderRectCombo("Roof", grid.roofRectName)) {
|
||||
if (renderRectCombo("Ext Window Frames", grid.extWindowFrameRectName)) {
|
||||
grid.markDirty();
|
||||
}
|
||||
if (renderRectCombo("Int Window Frames", grid.intWindowFrameRectName)) {
|
||||
grid.markDirty();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user