def windStrip(self, max_stripsize): Dts_Stripper.Stripper.maxStripSize = max_stripsize stripper = Dts_Stripper.chooseStripper() if not stripper: Torque_Util.dump_writeln(" Stripping Mesh : Disabled (No Stripper Found)") return else: Torque_Util.dump_writeln(" Stripping Mesh :") stripper.verts = self.verts # Convert primitives in different batches if we are a cluster, else, do it normally if self.mtype == self.T_Sorted: newPrimitives = [] newIndices = [] for c in self.clusters: # We need to update offsets for primitives when we strip (since there will be less of them) c.startPrimitive = len(newPrimitives) for p in self.primitives[c.startPrimitive:c.endPrimitive]: stripper.faces.append([self.indices[p.firstElement:p.firstElement+p.numElements], p.matindex]) # Ready, Steady, Strip! stripper.strip() for strip in stripper.strips: self.primitives.append(Primitive(len(newIndices),len(strip[0]),strip[1])) for ind in strip[0]: newIndices.append(ind) c.endPrimitive = len(newPrimitives) stripper.clear() self.indices = newIndices self.primitives = newPrimitives else: # All we need to do is convert the whole set of primitives for p in self.primitives: if p.numElements > 3: # we should be dealing with a triangle list if (p.numElements % 3) != 0: raise "Error: Wrong number of verts in Triangles primitive!" for i in range(p.firstElement,p.firstElement+p.numElements, 3): stripper.faces.append([self.indices[i:i+3], p.matindex]) else: # we're dealing a list or strip containing only one triangle stripper.faces.append([self.indices[p.firstElement:p.firstElement+p.numElements], p.matindex]) stripper.strip() self.indices = [] self.primitives = [] for strip in stripper.strips: strip[1] = (strip[1] & Primitive.MaterialMask) | (Primitive.NoMaterial & strip[1]) | Primitive.Strip | Primitive.Indexed #strip[1] = (strip[1] & Primitive.MaterialMask) | (Primitive.NoMaterial & strip[1]) | Primitive.Triangles | Primitive.Indexed self.primitives.append(Primitive(len(self.indices),len(strip[0]),strip[1])) #print "STRIP:",strip[0] for ind in strip[0]: self.indices.append(ind) del stripper
def windStrip(self, max_stripsize): Dts_Stripper.Stripper.maxStripSize = max_stripsize stripper = Dts_Stripper.chooseStripper() if not stripper: print " Stripping Mesh : Disabled (No Stripper Found)" return else: print " Stripping Mesh : ..." stripper.verts = self.verts # Convert primitives in different batches if we are a cluster, else, do it normally if self.mtype == self.T_Sorted: newPrimitives = [] newIndices = [] for c in self.clusters: # We need to update offsets for primitives when we strip (since there will be less of them) c.startPrimitive = len(newPrimitives) for p in self.primitives[c.startPrimitive:c.endPrimitive]: stripper.faces.append([ self.indices[p.firstElement:p.firstElement + p.numElements], p.matindex ]) # Ready, Steady, Strip! stripper.strip() for strip in stripper.strips: self.primitives.append( Primitive(len(newIndices), len(strip[0]), strip[1])) for ind in strip[0]: newIndices.append(ind) c.endPrimitive = len(newPrimitives) stripper.clear() self.indices = newIndices self.primitives = newPrimitives else: # All we need to do is convert the whole set of primitives for p in self.primitives: stripper.faces.append([ self.indices[p.firstElement:p.firstElement + p.numElements], p.matindex ]) stripper.strip() self.indices = [] self.primitives = [] for strip in stripper.strips: self.primitives.append( Primitive(len(self.indices), len(strip[0]), strip[1])) #print "STRIP:",strip[0] for ind in strip[0]: self.indices.append(ind) del stripper
def windStrip(self, max_stripsize): Dts_Stripper.Stripper.maxStripSize = max_stripsize stripper = Dts_Stripper.chooseStripper() if not stripper: print " Stripping Mesh : Disabled (No Stripper Found)" return else: print " Stripping Mesh : ..." stripper.verts = self.verts # Convert primitives in different batches if we are a cluster, else, do it normally if self.mtype == self.T_Sorted: newPrimitives = [] newIndices = [] for c in self.clusters: # We need to update offsets for primitives when we strip (since there will be less of them) c.startPrimitive = len(newPrimitives) for p in self.primitives[c.startPrimitive:c.endPrimitive]: stripper.faces.append([self.indices[p.firstElement:p.firstElement+p.numElements], p.matindex]) # Ready, Steady, Strip! stripper.strip() for strip in stripper.strips: self.primitives.append(Primitive(len(newIndices),len(strip[0]),strip[1])) for ind in strip[0]: newIndices.append(ind) c.endPrimitive = len(newPrimitives) stripper.clear() self.indices = newIndices self.primitives = newPrimitives else: # All we need to do is convert the whole set of primitives for p in self.primitives: stripper.faces.append([self.indices[p.firstElement:p.firstElement+p.numElements], p.matindex]) stripper.strip() self.indices = [] self.primitives = [] for strip in stripper.strips: self.primitives.append(Primitive(len(self.indices),len(strip[0]),strip[1])) #print "STRIP:",strip[0] for ind in strip[0]: self.indices.append(ind) del stripper
def windStrip(self, max_stripsize): Dts_Stripper.Stripper.maxStripSize = max_stripsize stripper = Dts_Stripper.chooseStripper() if not stripper: Torque_Util.dump_writeln( " Stripping Mesh : Disabled (No Stripper Found)") return else: Torque_Util.dump_writeln(" Stripping Mesh :") stripper.verts = self.verts # Convert primitives in different batches if we are a cluster, else, do it normally if self.mtype == self.T_Sorted: newPrimitives = [] newIndices = [] for c in self.clusters: # We need to update offsets for primitives when we strip (since there will be less of them) c.startPrimitive = len(newPrimitives) for p in self.primitives[c.startPrimitive:c.endPrimitive]: stripper.faces.append([ self.indices[p.firstElement:p.firstElement + p.numElements], p.matindex ]) # Ready, Steady, Strip! stripper.strip() for strip in stripper.strips: self.primitives.append( Primitive(len(newIndices), len(strip[0]), strip[1])) for ind in strip[0]: newIndices.append(ind) c.endPrimitive = len(newPrimitives) stripper.clear() self.indices = newIndices self.primitives = newPrimitives else: # All we need to do is convert the whole set of primitives for p in self.primitives: if p.numElements > 3: # we should be dealing with a triangle list if (p.numElements % 3) != 0: raise "Error: Wrong number of verts in Triangles primitive!" for i in range(p.firstElement, p.firstElement + p.numElements, 3): stripper.faces.append( [self.indices[i:i + 3], p.matindex]) else: # we're dealing a list or strip containing only one triangle stripper.faces.append([ self.indices[p.firstElement:p.firstElement + p.numElements], p.matindex ]) stripper.strip() self.indices = [] self.primitives = [] for strip in stripper.strips: strip[1] = (strip[1] & Primitive.MaterialMask) | ( Primitive.NoMaterial & strip[1]) | Primitive.Strip | Primitive.Indexed #strip[1] = (strip[1] & Primitive.MaterialMask) | (Primitive.NoMaterial & strip[1]) | Primitive.Triangles | Primitive.Indexed self.primitives.append( Primitive(len(self.indices), len(strip[0]), strip[1])) #print "STRIP:",strip[0] for ind in strip[0]: self.indices.append(ind) del stripper