EditMesh class final
An editable mesh.
Constructors
- EditMesh.cuboid({Vector3? size})
-
An axis-aligned box of
size, centred on the origin, as six quads.factory - EditMesh.empty()
-
An empty mesh, ready to be built into.
factory
- EditMesh.fromBytes(Uint8List bytes)
-
Reads a mesh back from
bytes.factory -
EditMesh.fromFaces(List<
Vector3> points, List<List< faces)int> > -
Builds a mesh from points and faces, each face a list of point indices
wound counter-clockwise seen from outside.
factory
Properties
- edgeCount → int
-
Edges, counting a pair of twins once and a boundary half-edge once.
no setter
- eulerCharacteristic → int
-
V − E + F, which is 2 for anything shaped like a sphere.no setter - faceCount → int
-
no setter
- faceSlotCount → int
-
no setter
- halfEdgeCount → int
-
Half-edges of live faces. A dead face's half-edges are dead with it.
no setter
- halfEdgeSlotCount → int
-
Half-edge slots, live and dead.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- journalBytes → int
-
Bytes every journal holds together.
no setter
- positions → Float32List
-
The raw positions: three floats per vertex slot.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- signedVolume → double
-
The volume the surface encloses, signed by winding.
no setter
- undoDepth → int
-
How many steps can be taken back.
no setter
- vertexCount → int
-
Elements that are actually there.
no setter
- vertexSlotCount → int
-
Slots the arrays hold, live and dead. What a walk iterates over.
no setter
Methods
-
abandonStep(
) → void - Closes the open step by taking back everything it wrote — values, slot counts and any layer it created — and leaves the undo and redo stacks exactly as they were before beginStep.
-
addFace(
List< int> loop) → int -
Adds a face over
loopand returns its number. Its half-edges are numbered consecutively from what halfEdgeSlotCount read before the call. -
addVertex(
Vector3 at) → int -
Adds a vertex at
atand returns its number. -
areaOf(
int face) → double -
The area of
face, summed over the fan its normal projects onto. -
beginStep(
) → void - Opens a step of history. Every edit until endStep is one undo away.
-
clearJournal(
) → void - Forgets every step, keeping the mesh as it is.
-
colourOf(
int halfEdge, [Vector4? out]) → Vector4 -
The colour at
halfEdge, white where none was set. -
compact(
) → (EditMesh, IdRemap) - Closes the gaps the tombstones left, and says where everything went.
-
cornerOf(
int halfEdge) → CornerAttributes -
Everything
halfEdgecarries as a corner. -
creaseOf(
int halfEdge) → double -
How hard the crease along
halfEdge's edge is; zero where none was set. -
cutTwin(
int halfEdge) → void -
Lets go of whatever was on the other side of
halfEdge, leaving it on a boundary. -
deleteFace(
int face) → void -
Marks
facedead, along with the half-edges on its loop. -
deleteVertex(
int vertex) → void -
Marks
vertexdead. Its faces must be gone first. -
dissolveEdge(
int halfEdge) → bool -
Removes the edge
halfEdgelies on, so the two faces it separated become one. Returns whether it happened. -
dissolveVertex(
int vertex) → bool -
Removes
vertexand every edge at it, so the ring of faces around it becomes one face. Returns whether it happened. -
dropOldestJournalSteps(
int count) → int -
Forgets the
countoldest steps and answers the bytes that freed —pro-sc-06's own budget, applied byModelHistory. -
edgeHas(
int halfEdge, int flag) → bool -
Whether
halfEdge's edge carriesflag— one of EdgeFlags. -
edgeOf(
int halfEdge) → int -
The half-edge that stands for the whole edge
halfEdgelies on. -
endStep(
) → bool - Closes the step. Returns whether anything was written.
-
extrudeFace(
int face, double distance) → EditMesh -
Pushes
faceout along its own normal bydistance, walling in the gap. -
faceHas(
int face, int flag) → bool -
Whether
facecarriesflag— one of FaceFlags. -
faceOf(
int halfEdge) → int -
faces(
) → List< List< int> > - Every live face as a list of vertex numbers.
-
flipNormals(
) → void - Turns every face round, so the surface points the other way.
-
forEachHalfEdge(
int face, void visit(int halfEdge)) → void -
Calls
visitfor every half-edge offace, in winding order. -
forEachVertex(
int face, void visit(int halfEdge)) → void -
Calls
visitfor every vertex offace, in winding order. -
halfEdgeOf(
int face) → int -
Some half-edge on the loop of
face. -
hasLayer(
MeshDomain domain, MeshAttribute attribute) → bool - Whether a layer holds anything at all.
-
hasLiveTwin(
int halfEdge) → bool -
Whether there is a live face on the other side of
halfEdge. -
isFaceAlive(
int face) → bool -
isVertexAlive(
int vertex) → bool - Whether the slot holds something.
-
makeConsistent(
) → bool - Winds every closed island outwards, and says whether anything turned.
-
materialSlotOf(
int face) → int -
Which material
faceuses; slot zero where none was set. -
moveVertex(
int vertex, Vector3 to) → void -
Moves
vertextoto, recording where it was. -
neighborsOf(
int vertex) → List< int> -
The vertices sharing an edge with
vertex, walked once around its own half-edge fan. -
nextOf(
int halfEdge) → int -
normalOf(
int face, [Vector3? out]) → Vector3 - The face's normal by Newell's method, which is the one that answers for a quad whose four points are not quite in a plane.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
originOf(
int halfEdge) → int -
outgoingOf(
int vertex) → int -
Some half-edge leaving
vertex, or none for a vertex in no face. -
positionOf(
int vertex, [Vector3? out]) → Vector3 -
The position of
vertex, written intooutwhen one is given. -
redo(
) → bool - Puts the last undone step back.
-
repairVertexLinks(
) → void - Points every vertex at a half-edge that is still on a live loop.
-
setColour(
int halfEdge, Vector4 colour) → void -
Sets the colour at
halfEdge. -
setCorner(
int halfEdge, CornerAttributes attributes) → void -
Writes
attributesontohalfEdge, touching only the layers that exist or that the values differ from their neutral in. -
setCrease(
int halfEdge, double weight) → void -
Sets the crease weight on the edge
halfEdgeis half of, both halves. -
setEdgeFlag(
int halfEdge, int flag, {required bool on}) → void -
Sets or clears
flagon the edgehalfEdgeis half of. -
setFaceFlag(
int face, int flag, {required bool on}) → void -
Sets or clears
flagonface. -
setMaterialSlot(
int face, int slot) → void -
Puts
facein material slotslot. -
setOrigin(
int halfEdge, int vertex) → void -
Makes
halfEdgestart atvertex. -
setOutgoing(
int vertex, int halfEdge) → void -
Points
vertexathalfEdgeas its way into the mesh. -
setSkin(
int vertex, VertexAttributes skin) → void -
Sets the skin binding at
vertex. -
setUv(
int halfEdge, Vector2 uv) → void -
Sets the texture coordinate at
halfEdge. -
skinOf(
int vertex) → VertexAttributes -
The skin binding at
vertex: the first joint at full weight where none was set, which is what an unskinned vertex means to the shader. -
splitEdge(
int halfEdge, {double factor = 0.5}) → int -
Puts a vertex on the edge
halfEdgelies on and returns it. -
splitFace(
int face, int from, int to) → int -
Cuts
facein two along the line between the cornersfromandtostart at, and returns the new face. -
toBytes(
) → Uint8List - The mesh as bytes, which is what a file holds and what crosses to an isolate.
-
toMeshData(
{VertexLayout layout = VertexLayout.standard, double smoothAngle = MeshNormals.defaultSmoothAngle, int? materialSlot}) → MeshData - The mesh a renderer can draw.
-
toString(
) → String -
A string representation of this object.
inherited
-
twinOf(
int halfEdge) → int -
undo(
) → bool - Takes the last step back, counts and all.
-
uvOf(
int halfEdge, [Vector2? out]) → Vector2 -
The texture coordinate at
halfEdge, or the origin where none was set. -
valencyOf(
int face) → int -
How many half-edges
facehas. -
validate(
) → void - Throws unless the arrays agree with each other.
-
verticesOf(
int face) → List< int> -
The vertices of
faceas a list — for callers that need one, and not for the loops that run per face. -
weldTwins(
int a, int b) → void -
Makes
aandbthe two sides of one edge.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited