I want to make a cube game like Minecraft,So I use Cube Map as my model’s texture,But I can’t get the result I want
from direct.showbase.ShowBase import ShowBase
from panda3d.core import Texture
from panda3d.core import TextureStage
from panda3d.core import TexGenAttrib
class MyApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
self.block = self.loader.loadModel("block_model.egg")
self.block.reparentTo(self.render)
self.block.setPos(0, 0, 0)
self.block.setHpr(30,40,35)
self.block.setTexGen(TextureStage.getDefault(),TexGenAttrib.MWorldCubeMap)
self.tex=self.loader.loadCubeMap('1_#.png')
self.tex.setMagfilter(Texture.FTNearest)
self.tex.setMinfilter(Texture.FTNearest)
self.block.setTexture(self.tex)
self.cam.setPos(0,-20,0)
self.cam.lookAt(0,0,0)
app = MyApp()
app.run()
My Code is above
The block_model.egg is just a cube model,and I have 6 pictures used as texture
But When I run the code ,It’s …
I want to get a cude likethe cube in the manual
http://www.panda3d.org/manual/index.php/Cube_Maps