void ConstructRegionBrushes(scene::INodePtr brushes[6], const Vector3& region_mins, const Vector3& region_maxs) { const float THICKNESS = 10; { // set mins Vector3 mins(region_mins[0]-THICKNESS, region_mins[1]-THICKNESS, region_mins[2]-THICKNESS); // vary maxs for(std::size_t i=0; i<3; i++) { Vector3 maxs(region_maxs[0]+THICKNESS, region_maxs[1]+THICKNESS, region_maxs[2]+THICKNESS); maxs[i] = region_mins[i]; Brush_ConstructCuboid(*Node_getBrush(brushes[i]), AABB::createFromMinMax(mins, maxs), texdef_name_default(), TextureProjection()); } } { // set maxs Vector3 maxs(region_maxs[0]+THICKNESS, region_maxs[1]+THICKNESS, region_maxs[2]+THICKNESS); // vary mins for(std::size_t i=0; i<3; i++) { Vector3 mins(region_mins[0]-THICKNESS, region_mins[1]-THICKNESS, region_mins[2]-THICKNESS); mins[i] = region_maxs[i]; Brush_ConstructCuboid(*Node_getBrush(brushes[i+3]), AABB::createFromMinMax(mins, maxs), texdef_name_default(), TextureProjection()); } } }
void ConstructRegionBrushes(scene::Node* brushes[6], const Vector3& region_mins, const Vector3& region_maxs) { { // set mins Vector3 mins(region_mins[0]-32, region_mins[1]-32, region_mins[2]-32); // vary maxs for(std::size_t i=0; i<3; i++) { Vector3 maxs(region_maxs[0]+32, region_maxs[1]+32, region_maxs[2]+32); maxs[i] = region_mins[i]; Brush_ConstructCuboid(*Node_getBrush(*brushes[i]), aabb_for_minmax(mins, maxs), texdef_name_default(), TextureProjection()); } } { // set maxs Vector3 maxs(region_maxs[0]+32, region_maxs[1]+32, region_maxs[2]+32); // vary mins for(std::size_t i=0; i<3; i++) { Vector3 mins(region_mins[0]-32, region_mins[1]-32, region_mins[2]-32); mins[i] = region_maxs[i]; Brush_ConstructCuboid(*Node_getBrush(*brushes[i+3]), aabb_for_minmax(mins, maxs), texdef_name_default(), TextureProjection()); } } }
void Scene_BrushResize_Selected(scene::Graph& graph, const AABB& bounds, const std::string& shader) { if(GlobalSelectionSystem().countSelected() != 0) { const scene::INodePtr& node = GlobalSelectionSystem().ultimateSelected(); Brush* brush = Node_getBrush(node); if(brush != 0) { Brush_ConstructCuboid(*brush, bounds, shader, TextureTransform_getDefault()); SceneChangeNotify(); } } }
void Scene_BrushResize_Selected(scene::Graph& graph, const AABB& bounds, const char* shader) { if(GlobalSelectionSystem().countSelected() != 0) { const scene::Path& path = GlobalSelectionSystem().ultimateSelected().path(); Brush* brush = Node_getBrush(path.top()); if(brush != 0) { TextureProjection projection; TexDef_Construct_Default(projection); Brush_ConstructCuboid(*brush, bounds, shader, projection); SceneChangeNotify(); } } }
void Brush_ConstructPrefab(Brush& brush, EBrushPrefab type, const AABB& bounds, std::size_t sides, const std::string& shader, const TextureProjection& projection) { switch(type) { case eBrushCuboid: { UndoableCommand undo("brushCuboid"); Brush_ConstructCuboid(brush, bounds, shader, projection); } break; case eBrushPrism: { int axis = GetViewAxis(); std::ostringstream command; command << c_brushPrism_name << " -sides " << sides << " -axis " << axis; UndoableCommand undo(command.str()); Brush_ConstructPrism(brush, bounds, sides, axis, shader, projection); } break; case eBrushCone: { std::ostringstream command; command << c_brushCone_name << " -sides " << sides; UndoableCommand undo(command.str()); Brush_ConstructCone(brush, bounds, sides, shader, projection); } break; case eBrushSphere: { std::ostringstream command; command << c_brushSphere_name << " -sides " << sides; UndoableCommand undo(command.str()); Brush_ConstructSphere(brush, bounds, sides, shader, projection); } break; default: break; } }
void Brush_ConstructPrefab(Brush& brush, EBrushPrefab type, const AABB& bounds, std::size_t sides, const char* shader, const TextureProjection& projection) { switch(type) { case eBrushCuboid: { UndoableCommand undo("brushCuboid"); Brush_ConstructCuboid(brush, bounds, shader, projection); } break; case eBrushPrism: { int axis = GetViewAxis(); StringOutputStream command; command << c_brushPrism_name << " -sides " << Unsigned(sides) << " -axis " << axis; UndoableCommand undo(command.c_str()); Brush_ConstructPrism(brush, bounds, sides, axis, shader, projection); } break; case eBrushCone: { StringOutputStream command; command << c_brushCone_name << " -sides " << Unsigned(sides); UndoableCommand undo(command.c_str()); Brush_ConstructCone(brush, bounds, sides, shader, projection); } break; case eBrushSphere: { StringOutputStream command; command << c_brushSphere_name << " -sides " << Unsigned(sides); UndoableCommand undo(command.c_str()); Brush_ConstructSphere(brush, bounds, sides, shader, projection); } break; } }
void Scene_BrushResize(Brush& brush, const AABB& bounds, const std::string& shader) { Brush_ConstructCuboid(brush, bounds, shader, TextureTransform_getDefault()); SceneChangeNotify(); }