コード例 #1
0
ファイル: grouping.py プロジェクト: MaxwellEdison/PyMine
    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 )
コード例 #2
0
ファイル: switch.py プロジェクト: superizer/Python-
    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)
コード例 #3
0
ファイル: coordinate.py プロジェクト: superizer/Python-
 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, )
コード例 #4
0
ファイル: shaders.py プロジェクト: superizer/Python-
 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()
コード例 #5
0
ファイル: shaders.py プロジェクト: MaxwellEdison/PyMine
 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()
コード例 #6
0
ファイル: coordinate.py プロジェクト: MaxwellEdison/PyMine
 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,
         )
コード例 #7
0
ファイル: box.py プロジェクト: superizer/Python-
 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'), ),
     )
コード例 #8
0
ファイル: teapot.py プロジェクト: superizer/Python-
 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'), ),
     )
コード例 #9
0
ファイル: box.py プロジェクト: MaxwellEdison/PyMine
 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'), ),
     )
コード例 #10
0
ファイル: teapot.py プロジェクト: MaxwellEdison/PyMine
 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'), ),
     )
コード例 #11
0
ファイル: quadrics.py プロジェクト: nvAli/openglcontext
    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')),
        )
コード例 #12
0
ファイル: quadrics.py プロジェクト: MaxwellEdison/PyMine
    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'), ),
        )
コード例 #13
0
 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'),
         ),
     )
コード例 #14
0
ファイル: shape.py プロジェクト: nvAli/openglcontext
    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)),
        )
コード例 #15
0
ファイル: shape.py プロジェクト: MaxwellEdison/PyMine
    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)),
        )