Next, we'll create a sky sphere writing tool that we can use to create sky sphere bam files.
import direct.directbase.DirectStart from pandac.PandaModules import *
__init__
method:class SkySphereWriter: def __init__(self):
cubemap
and also load the inverted sphere, which is a normal 1 unit sphere, except that the faces point inward instead of outward. The # sign in the first line is replaced with the numbers 0
through 5
when Panda3D loads the cubemap
.self.texture = loader.loadCubeMap("../Images/Purple_#.png") self.sphere = loader.loadModel("InvertedSphere.egg")
setTexGen()
and setTexProjector()
.self.sphere.setTexGen(TextureStage.getDefault(), TexGenAttrib.MWorldPosition) self.sphere.setTexProjector(TextureStage.getDefault(), render, self.sphere)
self.sphere.setTexture(self.texture)
NodePath
settings here so that they'll be saved in the bam file:self.sphere.setLightOff() self.sphere.setScale(1500)
self.sphere.writeBamFile("PurpleSkySphere.bam") self.sphere.reparentTo(render)
run()
method:SSW = SkySphereWriter() run()
BGP3D/Models
as SkySphereWriter.py
and run it.