本文整理汇总了Python中Code.RenderingPipeline.RenderingPipeline.loadSettings方法的典型用法代码示例。如果您正苦于以下问题:Python RenderingPipeline.loadSettings方法的具体用法?Python RenderingPipeline.loadSettings怎么用?Python RenderingPipeline.loadSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Code.RenderingPipeline.RenderingPipeline
的用法示例。
在下文中一共展示了RenderingPipeline.loadSettings方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: App
# 需要导入模块: from Code.RenderingPipeline import RenderingPipeline [as 别名]
# 或者: from Code.RenderingPipeline.RenderingPipeline import loadSettings [as 别名]
class App(ShowBase):
def __init__(self):
# Load the default configuration.prc. This is recommended, as it
# contains some important panda options
loadPrcFile("../../Config/configuration.prc")
# Init the showbase
ShowBase.__init__(self)
# Create a new pipeline instance
self.renderPipeline = RenderingPipeline(self)
# Set the base path for the pipeline. This is required as we are in
# a subdirectory
self.renderPipeline.getMountManager().setBasePath("../../")
# Also set the write path
self.renderPipeline.getMountManager().setWritePath("../../Temp/")
# Load the default settings
self.renderPipeline.loadSettings("../../Config/pipeline.ini")
# Now create the pipeline
self.renderPipeline.create()
示例2: App
# 需要导入模块: from Code.RenderingPipeline import RenderingPipeline [as 别名]
# 或者: from Code.RenderingPipeline.RenderingPipeline import loadSettings [as 别名]
class App(ShowBase):
def __init__(self):
# Load the default configuration.prc. This is recommended, as it
# contains some important panda options
loadPrcFile("../../Config/configuration.prc")
# Init the showbase
ShowBase.__init__(self)
# Create a new pipeline instance
self.renderPipeline = RenderingPipeline(self)
# Set the base path for the pipeline. This is required as we are in
# a subdirectory
self.renderPipeline.getMountManager().setBasePath("../../")
# Also set the write path
self.renderPipeline.getMountManager().setWritePath("../../Temp/")
# Load the default settings
self.renderPipeline.loadSettings("../../Config/pipeline.ini")
# Now create the pipeline
self.renderPipeline.create()
# Load the skybox
self.skybox = self.renderPipeline.getDefaultSkybox()
self.skybox.reparentTo(render)
# At this point we are done with the initialization. Now you want to
# load your scene, and create the game logic.
# Call this to tell the pipeline that the scene is done loading
self.renderPipeline.onSceneInitialized()
示例3: Main
# 需要导入模块: from Code.RenderingPipeline import RenderingPipeline [as 别名]
# 或者: from Code.RenderingPipeline.RenderingPipeline import loadSettings [as 别名]
class Main(ShowBase, DebugObject):
""" This is the material explorer. You can try different materials"""
def __init__(self):
DebugObject.__init__(self, "Main")
self.debug("Bit System =", 8 * struct.calcsize("P"))
# Load engine configuration
self.debug("Loading panda3d configuration from configuration.prc ..")
loadPrcFile("../../Config/configuration.prc")
# Init the showbase
ShowBase.__init__(self)
# Create the render pipeline
self.debug("Creating pipeline")
self.renderPipeline = RenderingPipeline(self)
# Set a write directory, where the shader cache and so on is stored
# self.renderPipeline.getMountManager().setWritePath(writeDirectory)
self.renderPipeline.getMountManager().setBasePath("../../")
self.renderPipeline.loadSettings("../../Config/pipeline.ini")
# Create the pipeline, and enable scattering
self.renderPipeline.create()
# Load some demo source
self.sceneSource = "Models/SmoothCube/Cube.bam"
# Load scene from disk
self.debug("Loading Scene '" + self.sceneSource + "'")
self.model = self.loader.loadModel(self.sceneSource)
self.scene = render.attachNewNode("Scene")
self.model.reparentTo(self.scene)
self.model.setZ(1.0)
# Wheter to use a ground floor
self.usePlane = True
self.sceneWireframe = False
# Flatten scene
self.scene.flattenStrong()
# Load ground plane if configured
if self.usePlane:
self.groundPlane = self.loader.loadModel(
"Models/Plane/Model.egg.bam")
self.groundPlane.setPos(0, 0, 0)
self.groundPlane.setScale(2.0)
self.groundPlane.setTwoSided(True)
self.groundPlane.flattenStrong()
self.groundPlane.reparentTo(self.scene)
# Prepare textures with SRGB format
self.prepareSRGB(self.scene)
# Create movement controller (Freecam)
self.controller = MovementController(self)
self.controller.setInitialPosition(
Vec3(0, -5, 5.0), Vec3(0, 0, 5))
self.controller.setup()
# Hotkey for wireframe
self.accept("f3", self.toggleSceneWireframe)
# Create a sun light
dPos = Vec3(60, 30, 100)
dirLight = DirectionalLight()
dirLight.setShadowMapResolution(1024)
dirLight.setPos(dPos)
dirLight.setColor(Vec3(1))
dirLight.setPssmTarget(base.cam, base.camLens)
dirLight.setPssmDistance(50.0)
dirLight.setCastsShadows(True)
self.renderPipeline.addLight(dirLight)
self.dirLight = dirLight
sunPos = Vec3(56.7587, -31.3601, 189.196)
self.dirLight.setPos(sunPos)
# Tell the GI which light casts the GI
self.renderPipeline.setGILightSource(dirLight)
self.renderPipeline.setScatteringSource(dirLight)
# Slider to move the sun
if self.renderPipeline.settings.displayOnscreenDebugger:
self.renderPipeline.guiManager.demoSlider.node[
"command"] = self.setSunPos
self.renderPipeline.guiManager.demoSlider.node[
"value"] = 20
self.lastSliderValue = 0.0
# Load skyboxn
self.skybox = self.renderPipeline.getDefaultSkybox()
#.........这里部分代码省略.........
示例4: App
# 需要导入模块: from Code.RenderingPipeline import RenderingPipeline [as 别名]
# 或者: from Code.RenderingPipeline.RenderingPipeline import loadSettings [as 别名]
class App(ShowBase):
def __init__(self):
# Load the default configuration.prc. This is recommended, as it
# contains some important panda options
loadPrcFile("../../Config/configuration.prc")
# Init the showbase
ShowBase.__init__(self)
# Create a new pipeline instance
self.renderPipeline = RenderingPipeline(self)
# Set the base path for the pipeline. This is required as we are in
# a subdirectory
self.renderPipeline.getMountManager().setBasePath("../../")
# Also set the write path
self.renderPipeline.getMountManager().setWritePath("../../Temp/")
# Load the default settings
self.renderPipeline.loadSettings("../../Config/pipeline.ini")
# Disable scattering
self.renderPipeline.settings.enableScattering = False
# Now create the pipeline
self.renderPipeline.create()
# Load skybox
self.skybox = self.renderPipeline.getDefaultSkybox()
self.skybox.reparentTo(render)
base.disableMouse()
self.scene = loader.loadModel("models/level_a1.bam")
self.scene.reparentTo(render)
base.cam.setPos(0, 0, 15)
base.cam.lookAt(0,5,5)
self.actor = render.attachNewNode("actor")
self.actorModel = Actor('models/male.egg', {
'walk':'models/male2_walk.egg',
})
self.actorModel.setScale(0.03)
self.actorModel.setH(-90)
self.actorModel.reparentTo(self.actor)
self.actorModel.loop("walk")
self.actorModel.setBlend(frameBlend = True)
self.renderPipeline.setEffect(self.actorModel, "Effects/Default/Default.effect", {
"dynamic": True
})
self.accept("w", self.setMovementX, [1])
self.accept("w-repeat", self.setMovementX, [1])
self.accept("w-up", self.setMovementX, [0])
self.accept("a", self.setMovementY, [1])
self.accept("a-repeat", self.setMovementY, [1])
self.accept("a-up", self.setMovementY, [0])
self.accept("d", self.setMovementY, [-1])
self.accept("d-repeat", self.setMovementY, [-1])
self.accept("d-up", self.setMovementY, [0])
lightPositions = [
(Vec3(0, 0, 20), Vec3(1.0,0.5,0.3)),
(Vec3(50, 5, 20), Vec3(1.0,0.5,0.3)),
(Vec3(10, 70, 20), Vec3(1.0,0.5,0.3)),
]
for pos, col in lightPositions:
light = SpotLight()
light.setPos(pos)
light.lookAt(Vec3(0,0,0))
light.setColor(col * 0.2)
light.setNearFar(1.0, 50)
light.setFov(140)
light.setIESProfile("XSplit")
light.setShadowMapResolution(1024)
light.setCastsShadows(True)
self.renderPipeline.addLight(light)
self.movement = [0, 0]
self.addTask(self.update, "update")
# Call this to tell the pipeline that the scene is done loading
self.renderPipeline.onSceneInitialized()
self.accept("r", self.renderPipeline.reloadShaders)
def setMovementX(self, directionX):
self.movement[0] = directionX
#.........这里部分代码省略.........
示例5: World
# 需要导入模块: from Code.RenderingPipeline import RenderingPipeline [as 别名]
# 或者: from Code.RenderingPipeline.RenderingPipeline import loadSettings [as 别名]
class World(ShowBase):
def __init__(self):
# Load the default configuration.prc. This is recommended, as it
# contains some important panda options
loadPrcFile("../../Config/configuration.prc")
ShowBase.__init__(self)
# Create a new pipeline instance
self.renderPipeline = RenderingPipeline(self)
# Set the base path for the pipeline. This is required as we are in
# a subdirectory
self.renderPipeline.getMountManager().setBasePath("../../")
# Also set the write path
self.renderPipeline.getMountManager().setWritePath("../../Temp/")
# Load the default settings
self.renderPipeline.loadSettings("../../Config/pipeline.ini")
# Now create the pipeline
self.renderPipeline.create()
# Add a directional light
dPos = Vec3(40, 40, 15)
dirLight = DirectionalLight()
dirLight.setPos(dPos * 1000000.0)
dirLight.setShadowMapResolution(1024)
dirLight.setCastsShadows(True)
dirLight.setColor(Vec3(8))
self.renderPipeline.addLight(dirLight)
self.renderPipeline.setScatteringSource(dirLight)
self.dirLight = dirLight
self.keyMap = {
"left": 0, "right": 0, "forward": 0, "cam-left": 0, "cam-right": 0}
base.win.setClearColor(Vec4(0, 0, 0, 1))
# Post the instructions
self.title = addTitle(
"Panda3D Tutorial: Roaming Ralph (Walking on Uneven Terrain)")
self.inst1 = addInstructions(0.95, "[ESC]: Quit")
self.inst2 = addInstructions(0.90, "[Left Arrow]: Rotate Ralph Left")
self.inst3 = addInstructions(0.85, "[Right Arrow]: Rotate Ralph Right")
self.inst4 = addInstructions(0.80, "[Up Arrow]: Run Ralph Forward")
self.inst6 = addInstructions(0.70, "[A]: Rotate Camera Left")
self.inst7 = addInstructions(0.65, "[S]: Rotate Camera Right")
# Set up the environment
# This environment model contains collision meshes. If you look
# in the egg file, you will see the following:
#
# <Collide> { Polyset keep descend }
#
# This tag causes the following mesh to be converted to a collision
# mesh -- a mesh which is optimized for collision, not rendering.
# It also keeps the original mesh, so there are now two copies ---
# one optimized for rendering, one for collisions.
self.environ = loader.loadModel("models/world")
self.environ.reparentTo(render)
self.environ.setPos(0, 0, 0)
self.environ.find("**/wall").removeNode()
# Create the main character, Ralph
ralphStartPos = self.environ.find("**/start_point").getPos()
self.ralph = Actor("models/ralph",
{"run": "models/ralph-run",
"walk": "models/ralph-walk"})
self.ralph.reparentTo(render)
self.ralph.setScale(.2)
self.ralph.setPos(ralphStartPos)
self.renderPipeline.setEffect(self.ralph, "Effects/Default/Default.effect", {
"dynamic": True
})
# Create a floater object. We use the "floater" as a temporary
# variable in a variety of calculations.
self.floater = NodePath(PandaNode("floater"))
self.floater.reparentTo(render)
# Accept the control keys for movement and rotation
self.accept("escape", sys.exit)
self.accept("arrow_left", self.setKey, ["left", 1])
self.accept("arrow_right", self.setKey, ["right", 1])
self.accept("arrow_up", self.setKey, ["forward", 1])
self.accept("a", self.setKey, ["cam-left", 1])
self.accept("s", self.setKey, ["cam-right", 1])
self.accept("arrow_left-up", self.setKey, ["left", 0])
self.accept("arrow_right-up", self.setKey, ["right", 0])
#.........这里部分代码省略.........
示例6: Main
# 需要导入模块: from Code.RenderingPipeline import RenderingPipeline [as 别名]
# 或者: from Code.RenderingPipeline.RenderingPipeline import loadSettings [as 别名]
class Main(ShowBase, DebugObject):
""" This is the render pipeline testing showbase """
def __init__(self):
DebugObject.__init__(self, "Main")
self.debug("Bit System =", 8 * struct.calcsize("P"))
# Load engine configuration
self.debug("Loading panda3d configuration from configuration.prc ..")
loadPrcFile("Config/configuration.prc")
# Init the showbase
ShowBase.__init__(self)
# Show loading screen
self.loadingScreen = PipelineLoadingScreen(self)
self.loadingScreen.render()
self.loadingScreen.setStatus("Creating pipeline", 10)
# Create the render pipeline
self.debug("Creating pipeline")
self.renderPipeline = RenderingPipeline(self)
# Uncomment to use temp directory
# writeDirectory = tempfile.mkdtemp(prefix='Shader-tmp')
writeDirectory = "Temp/"
# Set the pipeline base path
self.renderPipeline.getMountManager().setBasePath(".")
# Load pipeline settings
self.renderPipeline.loadSettings("Config/pipeline.ini")
self.loadingScreen.setStatus("Compiling shaders", 20)
# Create the pipeline, and enable scattering
self.renderPipeline.create()
####### END OF RENDER PIPELINE SETUP #######
# Select demo scene here:
# This sources are not included in the repo, for size reasons
# self.sceneSource = "Demoscene.ignore/MasterSword/Scene.egg"
# self.sceneSource = "Demoscene.ignore/MasterSword/Scene2.egg.bam"
# self.sceneSource = "Demoscene.ignore/Couch2/Scene.egg"
# self.sceneSource = "Demoscene.ignore/Couch/couch.egg.bam"
# self.sceneSource = "Demoscene.ignore/LivingRoom/LivingRoom.egg"
# self.sceneSource = "Demoscene.ignore/LivingRoom2/LivingRoom.egg"
# self.sceneSource = "Demoscene.ignore/LostEmpire/Model.egg"
# self.sceneSource = "Demoscene.ignore/SSLRTest/scene.egg"
# self.sceneSource = "Demoscene.ignore/BMW/Bmw.egg"
# self.sceneSource = "Demoscene.ignore/Tuscany/Tuscany.egg"
# self.sceneSource = "Demoscene.ignore/EiffelTower/Scene.bam"
# self.sceneSource = "Demoscene.ignore/HarvesterModel/Model.egg"
# self.sceneSource = "Demoscene.ignore/OldHouse/Scene.egg"
# self.sceneSource = "Demoscene.ignore/DemoTerrain/Scene.egg"
# self.sceneSource = "Demoscene.ignore/TransparencyTest/Scene.egg"
# self.sceneSource = "Demoscene.ignore/SanMiguel/Scene.bam"
# self.sceneSource = "Demoscene.ignore/DabrovicSponza/Scene.egg"
# self.sceneSource = "Demoscene.ignore/Avolition/level5.bam"
# self.sceneSource = "Demoscene.ignore/Sphere/Scene.bam"
# self.sceneSource = "Demoscene.ignore/Alphatest/alphatest.egg"
# self.sceneSource = "Demoscene.ignore/TestScene/Test.bam"
# This sources are included in the repo
# self.sceneSource = "Models/CornelBox/Model.egg"
# self.sceneSource = "Models/HouseSet/Model.egg"
# self.sceneSource = "Models/PSSMTest/Model.egg.bam"
# self.sceneSource = "Models/PBSTest/Scene.egg.bam"
# self.sceneSource = "Models/HDRTest/Scene.egg"
# self.sceneSource = "Models/GITestScene/Scene.egg"
# self.sceneSource = "Models/VertexPerformanceTest/Scene.egg"
# self.sceneSource = "Toolkit/Blender Material Library/MaterialLibrary.egg"
self.sceneSource = "panda"
# Select surrounding scene here
self.sceneSourceSurround = None
# self.sceneSourceSurround = "Demoscene.ignore/Couch/Surrounding.egg"
# self.sceneSourceSurround = "Demoscene.ignore/LivingRoom/LivingRoom.egg"
# self.sceneSourceSurround = "Models/LittleHouse/couch.bam"
# Store a list of transparent objects
self.transparentObjects = []
# Create a sun light
dPos = Vec3(60, 30, 100)
if True:
dirLight = DirectionalLight()
dirLight.setPos(dPos * 100000.0)
dirLight.setShadowMapResolution(2048)
dirLight.setColor(Vec3(1.1, 1.05, 0.9) * 3.0)
dirLight.setCastsShadows(True)
dirLight.setPssmDistance(140)
self.renderPipeline.addLight(dirLight)
self.dirLight = dirLight
#.........这里部分代码省略.........
示例7: World
# 需要导入模块: from Code.RenderingPipeline import RenderingPipeline [as 别名]
# 或者: from Code.RenderingPipeline.RenderingPipeline import loadSettings [as 别名]
class World(ShowBase):
def __init__(self):
# Load the default configuration.prc. This is recommended, as it
# contains some important panda options
loadPrcFile("../../Config/configuration.prc")
ShowBase.__init__(self)
# Create a new pipeline instance
self.renderPipeline = RenderingPipeline(self)
# Set the base path for the pipeline. This is required as we are in
# a subdirectory
self.renderPipeline.getMountManager().setBasePath("../../")
# Also set the write path
#self.renderPipeline.getMountManager().setWritePath("../../Temp/")
# Load the default settings
self.renderPipeline.loadSettings("../../Config/pipeline.ini")
# Now create the pipeline
self.renderPipeline.create()
self.addTask(self.moveTask, "move")
self.renderPipeline.onSceneInitialized()
#This creates the on screen title that is in every tutorial
self.title = OnscreenText(text="Panda3D: Tutorial 2 - Carousel",
style=1, fg=(1,1,1,1),
pos=(0.87,-0.95), scale = .07)
base.setBackgroundColor(.6, .6, 1) #Set the background color
base.disableMouse() #Allow manual positioning of the camera
camera.setPosHpr( 0, -8, 2.5, 0, -9, 0 ) #Set the cameras' position
#and orientation
self.loadModels() #Load and position our models
self.setupLights() #Add some basic lighting
self.startCarousel() #Create the needed intervals and put the
#carousel into motion
self.accept("r", self.reloadShader)
# As the model is moving, we have to register it as a dynamic object
for node in [self.carousel, self.lights1, self.lights2]:
self.renderPipeline.setEffect(node, "Effects/Default/Default.effect", {
"dynamic": True
})
def reloadShader(self):
self.renderPipeline.reloadShaders()
def moveTask(self, task):
counter = globalClock.getFrameTime() * 0.5
self.sun.setPos(Vec3(sin(counter) * 70, cos(counter) * 60, sin(counter*1.6323) * 20.0 + 60.0) * 1000000.0)
return task.cont
def loadModels(self):
#Load the carousel base
self.carousel = loader.loadModel("models/carousel_base")
self.carousel.reparentTo(render) #Attach it to render
#Load the modeled lights that are on the outer rim of the carousel
#(not Panda lights)
#There are 2 groups of lights. At any given time, one group will have the
#"on" texture and the other will have the "off" texture.
self.lights1 = loader.loadModel("models/carousel_lights")
self.lights1.reparentTo(self.carousel)
#Load the 2nd set of lights
self.lights2 = loader.loadModel("models/carousel_lights")
#We need to rotate the 2nd so it doesn't overlap with the 1st set.
self.lights2.setH(36)
self.lights2.reparentTo(self.carousel)
#Load the textures for the lights. One texture is for the "on" state,
#the other is for the "off" state.
self.lightOffTex = loader.loadTexture("models/carousel_lights_off.jpg")
self.lightOnTex = loader.loadTexture("models/carousel_lights_on.jpg")
#Create an list (self.pandas) with filled with 4 dummy nodes attached to
#the carousel.
#This uses a python concept called "Array Comprehensions." Check the Python
#manual for more information on how they work
self.pandas = [self.carousel.attachNewNode("panda"+str(i))
for i in range(4)]
self.models = [loader.loadModel("models/carousel_panda")
for i in range(4)]
self.moves = [0 for i in range(4)]
#.........这里部分代码省略.........
示例8: Main
# 需要导入模块: from Code.RenderingPipeline import RenderingPipeline [as 别名]
# 或者: from Code.RenderingPipeline.RenderingPipeline import loadSettings [as 别名]
class Main(ShowBase, DebugObject):
""" This is the render pipeline testing showbase """
def __init__(self):
DebugObject.__init__(self, "Main")
self.debug("Bit System =", 8 * struct.calcsize("P"))
# Load engine configuration
self.debug("Loading panda3d configuration from configuration.prc ..")
loadPrcFile("Config/configuration.prc")
# Init the showbase
ShowBase.__init__(self)
# Create the render pipeline
self.debug("Creating pipeline")
self.renderPipeline = RenderingPipeline(self)
self.renderPipeline.loadSettings("Config/pipeline.ini")
# Uncomment to use temp directory
# writeDirectory = tempfile.mkdtemp(prefix='Shader-tmp')
# writeDirectory = "Temp/"
# Clear write directory when app exits
# atexit.register(os.remove, writeDirectory)
# Set a write directory, where the shader cache and so on is stored
# self.renderPipeline.getMountManager().setWritePath(writeDirectory)
self.renderPipeline.getMountManager().setBasePath(".")
####### END OF RENDER PIPELINE SETUP #######
# Load some demo source
# self.sceneSource = "Demoscene.ignore/sponza.egg.bam"
# self.sceneSource = "Demoscene.ignore/occlusionTest/Model.egg"
# self.sceneSource = "Demoscene.ignore/lost-empire/Model.egg"
# self.sceneSource = "Models/PSSMTest/Model.egg.bam"
# self.sceneSource = "Scene.ignore/Car.bam"
# self.sceneSource = "Demoscene.ignore/GITest/Model.egg"
# self.sceneSource = "Demoscene.ignore/PSSMTest/Model.egg.bam"
# self.sceneSource = "Models/Raventon/Model.egg"
# self.sceneSource = "Demoscene.ignore/Room/LivingRoom.egg.bam"
self.sceneSource = "Toolkit/Blender Material Library/MaterialLibrary.egg"
# If global illumination is enabled, load the voxel grid
GlobalIllumination.setSceneRoot(
"Toolkit/Blender Material Library/voxelized/")
# Create the pipeline, and enable scattering
self.renderPipeline.create()
self.renderPipeline.enableDefaultEarthScattering()
# Load scene from disk
self.debug("Loading Scene '" + self.sceneSource + "'")
self.scene = self.loader.loadModel(self.sceneSource)
# Wheter to use a ground floor
self.usePlane = False
self.sceneWireframe = False
# Flatten scene?
self.scene.flattenStrong()
# Load ground plane if configured
if self.usePlane:
self.groundPlane = self.loader.loadModel(
"Models/Plane/Model.egg.bam")
self.groundPlane.setPos(0, 0, -0.01)
self.groundPlane.setScale(2.0)
self.groundPlane.setTwoSided(True)
self.groundPlane.flattenStrong()
self.groundPlane.reparentTo(self.scene)
# Some artists really don't know about backface culling
# self.scene.setTwoSided(True)
# Required for tesselation
# self.convertToPatches(self.scene)
self.scene.reparentTo(self.render)
# Prepare textures with SRGB format
self.prepareSRGB(self.scene)
# Create movement controller (Freecam)
self.controller = MovementController(self)
self.controller.setInitialPosition(
Vec3(0.422895, -6.49557, 4.72692), Vec3(0, 0, 3))
self.controller.setup()
# Hotkey for wireframe
self.accept("f3", self.toggleSceneWireframe)
# Hotkey to reload all shaders
self.accept("r", self.setShaders)
# Create a sun light
dPos = Vec3(60, 30, 100)
#.........这里部分代码省略.........