Implementation
Object createObject({
required SelectedType type,
Vector3? position,
Vector3? rotation,
Vector3? scale,
required Size size,
required String name,
required int layer,
required int imageLocation,
Color? color,
List<Offset>? textcoords,
Rect? textureRect,
}){
color ??= Colors.red;
return (type != SelectedType.atlas && type != SelectedType.image )?Object(
position: position,
rotation: rotation,
scale: scale,
mesh: [Mesh(
vertices: [
Vector3(0,0,0),
Vector3(size.width,0,0),
Vector3(size.width,size.height,0),
Vector3(0,size.height,0),
],
hasTexture: textcoords == null?false:true,
texcoords: textcoords,
indices: [
Triangle([0,1,2], null, textcoords != null?[0,1,2]:null),
Triangle([2,3,0], null, textcoords != null?[2,3,0]:null),
],
textureRect: textureRect
)],
size: size,
name: name,
layer: layer,
imageLocation: imageLocation,
type: type,
color: color
):Object(
position: position,
rotation: rotation,
scale: scale,
mesh: [Mesh(
vertices: [
Vector3(0,0,0),
Vector3(size.width,0,0),
Vector3(size.width,size.height,0),
Vector3(0,size.height,0),
],
hasTexture: textcoords == null?false:true,
texcoords: textcoords,
indices: [
Triangle([0,1,2], null, textcoords != null?[0,1,2]:null),
Triangle([2,3,0], null, textcoords != null?[2,3,0]:null),
],
textureRect: textureRect
)],
size: size,
name: name,
layer: layer,
imageLocation: imageLocation,
type: type,
color: color
);
}