当前位置: 首页>>代码示例>>Python>>正文


Python TextureStage.getDefault方法代码示例

本文整理汇总了Python中panda3d.core.TextureStage.getDefault方法的典型用法代码示例。如果您正苦于以下问题:Python TextureStage.getDefault方法的具体用法?Python TextureStage.getDefault怎么用?Python TextureStage.getDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在panda3d.core.TextureStage的用法示例。


在下文中一共展示了TextureStage.getDefault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: loadPrisonCrater

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
def loadPrisonCrater():
    ## Sky color
    base.win.setClearColor(Vec4(.46,.824,.904,1))

    ## Load Ground
    sand = loader.loadModel("data/models/sand.bam")
    sand.reparentTo(render)
    sand.setTexScale(TextureStage.getDefault(),5000,5000)

    craterwalls = loader.loadModel("data/models/craterwalls.bam")
    craterwalls.reparentTo(render)
    craterwalls.setTexScale(TextureStage.getDefault(),500,50)

    ## World Effects
    fog = Fog("Fog")
    fog.setColor(255,215,143)
    fog.setExpDensity(.0000001)
    render.setFog(fog)

    alight = render.attachNewNode(AmbientLight("Abient"))
    alight.node().setColor(Vec4(.9,.9,.9,1))
    render.setLight(alight)

    sun = DirectionalLight('Sun')
    sun.setColor(Vec4(1,1,1,1))
    sunNP = render.attachNewNode(sun)
    sunNP.setPos(0,0,4000)
    sunNP.setHpr(0,-90,0)
    render.setLight(sunNP)
开发者ID:DDH-Harding,项目名称:maleficium,代码行数:31,代码来源:world.py

示例2: __init__

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
    def __init__(self, name, resource):
        """Arguments:
        resource -- name of a directory in assets/skyboxes that contains 6
        images.
        """
        ManagedAsset.__init__(self, "sky")
        self.name = name

        tex = None
        for ext in ("png", "jpg", "tga"):
            f = Filename("skyboxes/{}/0.{}".format(resource, ext))
            if f.resolveFilename(getModelPath().getValue()):
                tex = TexturePool.loadCubeMap("skyboxes/{}/#.{}".format(resource, ext))
                break

        if tex is None:
            raise ResourceLoadError("assets/skyboxes/%s" % resource,
                                 "maybe wrong names or different extensions?")
        
        self.node = loader.loadModel("misc/invcube")
        self.node.clearTexture()
        self.node.clearMaterial()
        self.node.setScale(10000)
        self.node.setTwoSided(True)
        self.node.setBin('background', 0)
        self.node.setDepthTest(False)
        self.node.setDepthWrite(False)
        self.node.setLightOff()
        self.node.setTexGen(TextureStage.getDefault(), TexGenAttrib.MWorldPosition)
        self.node.setTexProjector(TextureStage.getDefault(), render, self.node);
        self.node.setTexture(tex, 1)
        self.node.flattenLight()
        #self.node.setCompass()  # not needed with world-space-UVs
        self.addTask(self.update, "sky repositioning", sort=10,
                     taskChain="world")
开发者ID:hubertgrzeskowiak,项目名称:Azure--Infinite-Skies,代码行数:37,代码来源:sky.py

示例3: setup

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
    def setup(self):
        self.tex1 = MovieTexture('videos/saturn5_apollo_launch.mp4')
        assert self.tex1.read('videos/saturn5_apollo_launch.mp4')
        self.tex2 = MovieTexture('videos/boards_eye_view.mp4')
        assert self.tex2.read('videos/boards_eye_view.mp4')

        self.cm1 = CardMaker('saturn')
        self.cm1.setFrameFullscreenQuad()
        self.cm1.setUvRange(self.tex1)
        self.card1 = NodePath(self.cm1.generate())
        self.card1.reparentTo(self.path)
        self.card1.setPos(0,0,10)
        self.card1.setP(50)

        self.cm2 = CardMaker('board')
        self.cm2.setFrameFullscreenQuad()
        self.cm2.setUvRange(self.tex2)
        self.card2 = NodePath(self.cm2.generate())
        self.card2.reparentTo(self.path)
        self.card2.setPos(0,0,-10)
        self.card2.setP(-50)

        self.card1.setTexture(self.tex1)
        self.card1.setTexScale(TextureStage.getDefault(), self.tex1.getTexScale())
        self.card2.setTexture(self.tex2)
        self.card2.setTexScale(TextureStage.getDefault(), self.tex2.getTexScale())

        self.card1.setScale(10)
        self.card2.setScale(10)
开发者ID:indygfx,项目名称:opticfoo,代码行数:31,代码来源:firsttry.py

示例4: patchInvertDDSV

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
def patchInvertDDSV(np,tex,debug=False):
    from panda3d.core import Texture
    from panda3d.core import TextureStage
    cmpr = tex.getCompression()
    if cmpr == Texture.CMDxt1 or cmpr == Texture.CMDxt5:
        scale2d = np.getTexScale( TextureStage.getDefault() )
        scale2d[1] = -scale2d[1]
        np.setTexScale( TextureStage.getDefault(), scale2d )
    else:
        if debug:
            print( " NOT INVERTING.. type was " + str(tex.getCompression()))
开发者ID:aportner,项目名称:panda-zonewalk,代码行数:13,代码来源:polygroup.py

示例5: flipTexture

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
 def flipTexture(self):
     """ Sets the texture coordinates of the texture to the current frame"""
     sU = self.offsetX * self.repeatX
     sV = self.offsetY * self.repeatY
     oU = 0 + self.frames[self.currentFrame].col * self.uSize
     oV = 1 - self.frames[self.currentFrame].row * self.vSize - self.offsetY
     if self.flip['x']:
         sU *= -1
         oU = self.uSize + self.frames[self.currentFrame].col * self.uSize
     if self.flip['y']:
         sV *= -1
         oV = 1 - self.frames[self.currentFrame].row * self.vSize
     self.node.setTexScale(TextureStage.getDefault(), sU, sV)
     self.node.setTexOffset(TextureStage.getDefault(), oU, oV)
开发者ID:gaconkzk,项目名称:tethical,代码行数:16,代码来源:Sprite2d.py

示例6: playVideo

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
    def playVideo(self, video):
        # check if it is loadable
        try:
            # load the video texture
            self.tex = MovieTexture("MovieTexture")
            #print video
            self.tex.read(video)
            # Set up a fullscreen card to set the video texture on it.
            cm = CardMaker("Movie Card")
            cm.setFrameFullscreenQuad()
            cm.setUvRange(self.tex)
            self.card = NodePath(cm.generate())
            self.card.reparentTo(base.render2d)
            self.card.setTexture(self.tex)
            self.card.setTexScale(TextureStage.getDefault(),
                                  self.tex.getTexScale())

            # load the video
            self.sound = loader.loadSfx(video)

            # Synchronize the video to the sound.
            self.tex.synchronizeTo(self.sound)

            # play the video and audio
            self.sound.play()
            # start the task which checks if the video is finished
            taskMgr.add(self.isVideoFinish, "task_isVideoFinised")
        except:
            logging.error("Failed to load video: %s %s", video, sys.exc_info())
            self.stopVideo()
            base.messenger.send(self.vidFinEvt)
开发者ID:grimfang,项目名称:rising_reloaded,代码行数:33,代码来源:movieManager.py

示例7: createGround

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
    def createGround(self, terrainData):
        """Create ground using a heightmap"""

        # Create heightfield for physics
        heightRange = terrainData["heightRange"]

        # Image needs to have dimensions that are a power of 2 + 1
        heightMap = PNMImage(self.basePath + terrainData["elevation"])
        xdim = heightMap.getXSize()
        ydim = heightMap.getYSize()
        shape = BulletHeightfieldShape(heightMap, heightRange, ZUp)
        shape.setUseDiamondSubdivision(True)

        np = self.outsideWorldRender.attachNewNode(BulletRigidBodyNode("terrain"))
        np.node().addShape(shape)
        np.setPos(0, 0, 0)
        self.physicsWorld.attachRigidBody(np.node())

        # Create graphical terrain from same height map
        terrain = GeoMipTerrain("terrain")
        terrain.setHeightfield(heightMap)

        terrain.setBlockSize(32)
        terrain.setBruteforce(True)
        rootNP = terrain.getRoot()
        rootNP.reparentTo(self.worldRender)
        rootNP.setSz(heightRange)

        offset = xdim / 2.0 - 0.5
        rootNP.setPos(-offset, -offset, -heightRange / 2.0)
        terrain.generate()

        # Apply texture
        diffuse = self.loader.loadTexture(Filename(self.basePath + terrainData["texture"]))
        diffuse.setWrapU(Texture.WMRepeat)
        diffuse.setWrapV(Texture.WMRepeat)
        rootNP.setTexture(diffuse)
        textureSize = 6.0
        ts = TextureStage.getDefault()
        rootNP.setTexScale(ts, xdim / textureSize, ydim / textureSize)

        # Create planes around area to prevent player flying off the edge
        # Levels can define barriers around them but it's probably a good
        # idea to leave this here just in case
        sides = (
            (Vec3(1, 0, 0), -xdim / 2.0),
            (Vec3(-1, 0, 0), -xdim / 2.0),
            (Vec3(0, 1, 0), -ydim / 2.0),
            (Vec3(0, -1, 0), -ydim / 2.0),
        )
        for sideNum, side in enumerate(sides):
            normal, offset = side
            sideShape = BulletPlaneShape(normal, offset)
            sideNode = BulletRigidBodyNode("side%d" % sideNum)
            sideNode.addShape(sideShape)
            self.physicsWorld.attachRigidBody(sideNode)
开发者ID:Red-Gravel,项目名称:Red-Gravel,代码行数:58,代码来源:game.py

示例8: _load_chairs

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
 def _load_chairs(self):
     """Load and place chairs"""
     self.chairs = self.p_constants["NPHILOSOPHERS"] * [0]
     for i in xrange(self.p_constants["NPHILOSOPHERS"]):
         x, y, angle = self._get_chair_coord(i, 5.0)
         self.chairs[i] = self._load_model(
             "chair1", scale=[7, 7, 7], pos=[x, y - 1, 0], H=rad2deg(angle) + 15)
         self.chairs[i].setTexture(self.chair_tex)
         self.chairs[i].setTexScale(
             TextureStage.getDefault(), 0.005, 0.005)
开发者ID:Israrul786,项目名称:EECE-315-2013,代码行数:12,代码来源:anim.py

示例9: loadBallModel

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
    def loadBallModel(self):
        #loads the character, a ball model

        #ballModelStartPos = (-8, -8, 0.701) #THIS IS THE END
        ballModelStartPos = (8, 8, 13.301) #level 0 
        ballScale = 0.01
        self.ballModel = loader.loadModel("/Users/jianwei/Documents/School/Freshman/Semester1/15-112/TERMPROJECT/Project/ball")
        self.ballModel.reparentTo(render)
        self.ballModel.setScale(ballScale)
        self.ballModel.setPos(ballModelStartPos)


        ### Setting ball texture ###
        texScale = 0.08
        self.ballModel.setTexGen(TextureStage.getDefault(),
                                   TexGenAttrib.MWorldPosition)
        self.ballModel.setTexProjector(TextureStage.getDefault(), 
                                         render, self.ballModel)
        self.ballModel.setTexScale(TextureStage.getDefault(), texScale)
        tex = loader.load3DTexture('/Users/jianwei/Documents/School/Freshman/Semester1/15-112/TERMPROJECT/Project/ballTex/ballTex_#.png')
        self.ballModel.setTexture(tex)
开发者ID:jli8554,项目名称:aMAZEing,代码行数:23,代码来源:mazeAnimation.py

示例10: _load_bowls

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
 def _load_bowls(self):
     """Load and place bowls"""
     self.bowls = [{} for x in xrange(self.p_constants["NPHILOSOPHERS"])]
     for i in xrange(self.p_constants["NPHILOSOPHERS"]):
         x, y, angle = self._get_chair_coord(i, 3.6)
         self.bowls[i]["bowl"] = self._load_model(
             "bowl", scale=[2, 2, 2], pos=[100, 100, 100], H=rad2deg(angle))
         self.bowls[i]["pos"] = [x, y - 1, self.fork_height]
         self.bowls[i]["num_up"] = 0
         self.bowls[i]["meals"] = 0
         self.bowls[i]["bowl"].setTexture(self.bowl_tex)
         self.bowls[i]["bowl"].setTexScale(
             TextureStage.getDefault(), 0.005, 0.005)
开发者ID:Israrul786,项目名称:EECE-315-2013,代码行数:15,代码来源:anim.py

示例11: __init__

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
    def __init__(self):
        ShowBase.__init__(self)

        #
        self.wp = WindowProperties()
        self.wp.setSize(1280, 720)
        base.win.requestProperties(self.wp)
        self.fork_height = 2.3
        self.frame_time = 0.0
        self.textObject = OnscreenText(text='',
                                       pos=(-1.0, 0.9), scale = 0.10, fg=(255, 255, 255, 200))

        # create sockets, get h constants
        self.p_constants = get_constants()
        self.context, self.socket = self._create_socket_context()

        # Load textures
        self.bowl_tex = self.loader.loadTexture(
            ASSETS_DIR + "marble.jpg")
        self.wood_tex = self.loader.loadTexture(
            ASSETS_DIR + "derevo_mebel.jpg")
        self.chair_tex = self.loader.loadTexture(
            ASSETS_DIR + "02_1.bmp")
        self.black_tex = self.loader.loadTexture(ASSETS_DIR + "black.png")

        # Load models
        # Load environment (really just a plane)
        self.environ = self._load_model(
            "house", scale=[25, 25, 25], pos=[0, 0, -10])
        # Load the "table"
        self.table = self._load_model(
            "round_table", scale=[27, 27, 14], pos=[0, 0, 0])
        # Load and place forks, chairs
        self._load_forks()
        self._load_chairs()
        self._load_bowls()

        # Apply textures to models
        self.environ.setTexture(self.black_tex)
        self.table.setTexture(self.wood_tex)
        self.table.setTexScale(
            TextureStage.getDefault(), 0.005, 0.005)

        # Start sim
        self.rnum = 0
        self.philos = subprocess.Popen("./philos", shell=True)

        # Tasks
        self.taskMgr.add(self.spin_camera, "spin_camera")
        self.taskMgr.add(self._comm, "comm")
开发者ID:Israrul786,项目名称:EECE-315-2013,代码行数:52,代码来源:anim.py

示例12: loadWallModel

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
    def loadWallModel(self):
        #loads the wall model (the maze) 
        wallScale = 0.3
        wallModelName = self.randomWallModel()
            #randomly select a maze

        self.wallModel = loader.loadModel(wallModelName)
        self.wallModel.setScale(wallScale)
        self.wallModel.setPos(0, 0, 0)
        self.wallModel.setCollideMask(BitMask32.allOff())
        self.wallModel.reparentTo(render)

        ### Setting Texture ###
        texScale = 0.08
        self.wallModel.setTexGen(TextureStage.getDefault(),
                                   TexGenAttrib.MWorldNormal)
        self.wallModel.setTexProjector(TextureStage.getDefault(),
                                         render, self.wallModel)
        self.wallModel.setTexScale(TextureStage.getDefault(), texScale)
        tex = loader.load3DTexture('/Users/jianwei/Documents/School/Freshman/Semester1/15-112/TERMPROJECT/Project/wallTex/wallTex_#.png')
        self.wallModel.setTexture(tex)

        #creating visual geometry collision
        self.wallModel.setCollideMask(BitMask32.bit(0))
开发者ID:jli8554,项目名称:aMAZEing,代码行数:26,代码来源:mazeAnimation.py

示例13: loadIcon

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
 def loadIcon(self, iconsFile, name):
     retVal = iconsFile.find(name)
     retVal.setBillboardAxis()
     retVal.reparentTo(self)
     dark = retVal.copyTo(NodePath())
     dark.reparentTo(retVal)
     dark.setColor(0.5, 0.5, 0.5, 1)
     retVal.setEffect(DecalEffect.make())
     retVal.setTransparency(TransparencyAttrib.MAlpha, 1)
     ll, ur = dark.getTightBounds()
     center = retVal.attachNewNode('center')
     center.setPos(0, 0, ll[2])
     dark.wrtReparentTo(center)
     dark.setTexProjector(TextureStage.getDefault(), center, retVal)
     retVal.hide()
     return (retVal, center)
开发者ID:nate97,项目名称:src,代码行数:18,代码来源:DinerStatusIndicator.py

示例14: init_ship

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
def init_ship(self, ship_model_path, player2=False):
    if player2 == True:
        pos = LPoint2(12,-8)
        category_bits = 0x0003
        mask_bits = (0x0001 | 0x0002)
    else:
        pos = LPoint2(-12,8)
        category_bits = 0x0002
        mask_bits = (0x0001 | 0x0003)

    new_ship = loadObject(ship_model_path, scale=0.5)
    physic_debug, physic_body  = new_physic_object(shape='box', scale=0.5, 
                        angular_dampning=5, linear_dampning=0.1, pos=pos, 
                        category_bits=category_bits, mask_bits=mask_bits)
    new_ship.reparentTo(render)
    new_ship.setTexRotate(TextureStage.getDefault(), 90)

    new_weapon = weapon();
    if player2 == True:
        shipname = "ship2"
        self.life_bar2 = loadObject(scale=0.5)
        self.life_bar2.setPos(-0.1,0, 0.12)
        self.life_bar2.reparentTo(base.a2dBottomRight)
        self.life_bar2.setSz(0.005)
        self.energy_bar2 = loadObject(scale=0.5)
        self.energy_bar2.setPos(-0.1,0, 0.215)
        self.energy_bar2.reparentTo(base.a2dBottomRight)
        self.energy_bar2.setSz(0.005)
    else:
        shipname = "ship" 
        self.life_bar = loadObject(scale=0.5)
        self.life_bar.setPos(-0.1,0,0.12)
        self.life_bar.reparentTo(base.a2dBottomLeft)
        self.life_bar.setSz(0.005)
        self.energy_bar = loadObject(scale=0.5)
        self.energy_bar.setPos(-1,0,0.215)
        self.energy_bar.reparentTo(base.a2dBottomLeft)
        self.energy_bar.setSz(0.005)

    defines.ENTITIES[defines.ENTITY_ID] = {'CATEGORY':shipname,'E_FIELD_ENABLED': False, 'NODE':new_ship, 'PHYSIC_NODE':physic_debug, 'BODY':physic_body, 'SHIELD':100.0, 'ENERGY':100.0, 'WEAPON':new_weapon}
    defines.ENTITY_ID += 1
开发者ID:martinrioux,项目名称:Panda3D-Space-Wars,代码行数:43,代码来源:ship.py

示例15: createSky_

# 需要导入模块: from panda3d.core import TextureStage [as 别名]
# 或者: from panda3d.core.TextureStage import getDefault [as 别名]
    def  createSky_(self,maxDistance=parameters["maxDistance"],loadNullSky=parameters["loadNullSky"],skyMapNull=parameters["skyMapNull"]):
        # self.skysphere = self.sb.loader.loadModel("models/solar_sky_sphere")
        # self.sky_tex = self.sb.loader.loadTexture("models/stars_1k_tex.jpg")
        # self.skysphere.setTexture(self.sky_tex, 1)
        #
        # self.skysphere.setEffect(CompassEffect.make(self.sb.render))
        # self.skysphere.setScale(maxDistance)  # bit less than "far"
        # self.skysphere.setZ(-3)
        # self.skysphere.reparentTo(self.sb.render)

        if loadNullSky:  # if null, then create uniform back and sky

            # pass #todo. buttonify
            self.skysphere = self.sb.loader.loadModel(skyMapNull)
            self.skysphere.setEffect(CompassEffect.make(self.sb.render))
            self.skysphere.setScale(maxDistance)  # bit less than "far"
            self.skysphere.setZ(-3)

            # self.skysphere.setH(45)

            self.skysphere.reparentTo(self.sb.render)

        else:
            self.skysphere = self.sb.loader.loadModel(parameters['skyMap'])
            self.skysphere.setBin('background', 1)
            self.skysphere.setDepthWrite(0)
            self.skysphere.setPos(0,0,0)


            self.skysphere.setPos((513,513,0))
            self.skysphere.setTexPos(TextureStage.getDefault(),(-513,-513,1000))

            #don't change it here, do it in bam generator
            # self.skysphere.setTexHpr(TextureStage.getDefault(),(-513,-513,0))

            self.skysphere.setScale(9000)  # bit less than "far"
            self.skysphere.setEffect(CompassEffect.make(self.sb.render))
            self.skysphere.reparentTo(self.sb.render)
开发者ID:pvnkmrksk,项目名称:world,代码行数:40,代码来源:environment.py


注:本文中的panda3d.core.TextureStage.getDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。