def boundingVolume( self, mode ): """Calculate the bounding volume for this node The bounding volume for a grouping node is the union of it's children's nodes, and is dependent on the children of the node's bounding nodes, as well as the children field of the node. """ current = boundingvolume.getCachedVolume( self ) if current is not None: return current # need to create a new volume and make it depend # on the appropriate fields... volumes = [] dependencies = [(self,'children')] unbounded = 0 for child in self.children: try: if hasattr(child, 'boundingVolume'): volume = child.boundingVolume(mode) volumes.append( volume ) dependencies.append( (volume, None) ) else: unbounded = 1 break except boundingvolume.UnboundedObject: unbounded = 1 try: volume = boundingvolume.BoundingBox.union( volumes, None ) except boundingvolume.UnboundedObject: unbounded = 1 if unbounded: volume = boundingvolume.UnboundedVolume() return boundingvolume.cacheVolume( self, volume, dependencies )
def boundingVolume(self, mode): """Calculate the bounding volume for this node The bounding volume for a grouping node is the union of it's children's nodes, and is dependent on the children of the node's bounding nodes, as well as the children field of the node. """ current = boundingvolume.getCachedVolume(self) if current is not None: return current # need to create a new volume and make it depend # on the appropriate fields... volumes = [] dependencies = [(self, 'choice'), (self, 'whichChoice')] unbounded = 0 for child in self.renderedChildren(): try: if hasattr(child, 'boundingVolume'): volume = child.boundingVolume(mode) volumes.append(volume) dependencies.append((volume, None)) else: unbounded = 1 break except boundingvolume.UnboundedObject: unbounded = 1 try: volume = boundingvolume.BoundingBox.union(volumes, None) except boundingvolume.UnboundedObject: unbounded = 1 if unbounded: volume = boundingvolume.UnboundedVolume() return boundingvolume.cacheVolume(self, volume, dependencies)
def boundingVolume(self, mode): """Create a bounding-volume object for this node""" from OpenGLContext.scenegraph import boundingvolume current = boundingvolume.getCachedVolume(self) if current: return current else: return boundingvolume.volumeFromCoordinate(self, )
def boundingVolume(self, mode): """Calculate bounding volume of this attribute's current values""" current = boundingvolume.getCachedVolume(self) if current: return current try: buffer = self.bufferView() except AttributeError, err: bv = boundingvolume.BoundingVolume()
def boundingVolume( self, mode ): """Calculate bounding volume of this attribute's current values""" current = boundingvolume.getCachedVolume( self ) if current: return current try: buffer = self.bufferView() except AttributeError, err: bv = boundingvolume.BoundingVolume()
def boundingVolume( self, mode ): """Create a bounding-volume object for this node""" from OpenGLContext.scenegraph import boundingvolume current = boundingvolume.getCachedVolume( self ) if current: return current else: return boundingvolume.volumeFromCoordinate( self, )
def boundingVolume(self, mode): """Create a bounding-volume object for this node""" from OpenGLContext.scenegraph import boundingvolume current = boundingvolume.getCachedVolume(self) if current: return current return boundingvolume.cacheVolume( self, boundingvolume.AABoundingBox(size=self.size, ), ((self, 'size'), ), )
def boundingVolume(self, mode): """Create a bounding-volume object for this node""" from OpenGLContext.scenegraph import boundingvolume current = boundingvolume.getCachedVolume(self) if current: return current return boundingvolume.cacheVolume( self, boundingvolume.AABoundingBox( # This vastly overestimates the size! size=[self.size * 2, self.size * 2, self.size * 2], ), ((self, 'size'), ), )
def boundingVolume( self, mode ): """Create a bounding-volume object for this node""" from OpenGLContext.scenegraph import boundingvolume current = boundingvolume.getCachedVolume( self ) if current: return current return boundingvolume.cacheVolume( self, boundingvolume.AABoundingBox( size = self.size, ), ( (self, 'size'), ), )
def boundingVolume( self, mode ): """Create a bounding-volume object for this node""" from OpenGLContext.scenegraph import boundingvolume current = boundingvolume.getCachedVolume( self ) if current: return current return boundingvolume.cacheVolume( self, boundingvolume.AABoundingBox( # This vastly overestimates the size! size = [self.size*2,self.size*2,self.size*2], ), ( (self, 'size'), ), )
def boundingVolume(self, mode=None): """Create a bounding-volume object for this node In this case we use the AABoundingBox, despite the presence of the bounding sphere implementation. This is just a preference issue, I'm using AABoundingBox everywhere else, and want the sphere to interoperate properly. """ current = boundingvolume.getCachedVolume(self) if current: return current radius = self.radius return boundingvolume.cacheVolume( self, boundingvolume.AABoundingBox(size=(radius * 2, self.height, radius * 2), ), ((self, 'radius'), (self, 'height')), )
def boundingVolume( self, mode=None ): """Create a bounding-volume object for this node In this case we use the AABoundingBox, despite the presence of the bounding sphere implementation. This is just a preference issue, I'm using AABoundingBox everywhere else, and want the sphere to interoperate properly. """ current = boundingvolume.getCachedVolume( self ) if current: return current return boundingvolume.cacheVolume( self, boundingvolume.AABoundingBox( size = (self.radius*2,self.radius*2,self.radius*2), ), ( (self, 'radius'), ), )
def boundingVolume(self, mode): """Calculate bounding volume of this attribute's current values""" current = boundingvolume.getCachedVolume(self) if current: return current try: buffer = self.bufferView() except AttributeError as err: bv = boundingvolume.BoundingVolume() else: bv = boundingvolume.AABoundingBox.fromPoints(buffer) return boundingvolume.cacheVolume( self, bv, ( (self, None), (self, 'buffer'), (self, 'offset'), (self, 'stride'), (self.buffer, 'buffer'), ), )
def boundingVolume( self, mode ): """Create a bounding-volume object for this node This is our geometry's boundingVolume, with the addition that any dependent volume must be dependent on our geometry field. """ current = boundingvolume.getCachedVolume( self ) if current: return current if self.geometry: if hasattr( self.geometry, 'boundingVolume'): volume = self.geometry.boundingVolume(mode) else: # is considered always visible volume = boundingvolume.UnboundedVolume() else: # is never visible volume = boundingvolume.BoundingVolume() return boundingvolume.cacheVolume( self, volume, ((self, 'geometry'),(volume,None)), )