Чет я ваще не въеду что не так?
Код
import direct.directbase.DirectStart
from direct.task.Task import Task
from panda3d.core import *
import sys,os
import math
from modules.CameraHandler import *
from direct.showbase.DirectObject import DirectObject
from direct.filter.CommonFilters import *
from pandac.PandaModules import *
class World(DirectObject):
def __init__(self):
base.disableMouse()
base.setBackgroundColor(0, 0, 0)
self.accept("escape", sys.exit)
self.accept("v", self.Shadeoff)
self.accept("v-up", self.Shadeon)
self.model=loader.loadModel("sphere")
#self.model.setTwoSided( True )
self.model.setScale(5,5,5)
self.model.reparentTo(render)
self.HPR=0
self.tex = loader.loadTexture('White.jpg')
ts = TextureStage('ts')
ts.setMode(TextureStage.MModulate)
self.model.setTexture(self.tex,1)
self.tex = loader.loadTexture('GroundTEXTN.JPG')
ts = TextureStage('ts')
ts.setMode(TextureStage.MNormal)
self.model.setTexture(ts, self.tex)
spc = loader.loadTexture('GroundTEXTS.JPG')
ts = TextureStage('ts')
ts.setMode(TextureStage.MGloss)
self.model.setTexture(ts, spc)
self.TaskLight=taskMgr.add(self.TaskLight, 'TaskLight')
#light
#Point Light
self.plight = PointLight('my_plight')
self.plight.setColor(VBase4(1,1,1,1))
self.npl = render.attachNewNode(self.plight)
render.setLight(self.npl)
self.npl.reparentTo(camera)
#self.npl.setPos(self.PosLight)
'''self.dlight = PointLight('my_dlight')
self.dlight.setColor(Vec4(0.7,0.7,0.7,1))
self.dlnp = render.attachNewNode(self.dlight)
render.setLight(self.dlnp)'''
'''self.alight = AmbientLight('my_alight')
self.alight.setColor(Vec4(0.2,0.2,0.2,1))
self.alnp = render.attachNewNode(self.alight)
render.setLight(self.alnp)'''
self.model.setShaderAuto()
def TaskLight(self, task):
#self.HPR=self.HPR+0.5
#self.dlnp.setHpr(self.HPR,0,0)
angledegrees = task.time * 6.0
angleradians = angledegrees * (math.pi / 180.0)
#self.dlnp.setPos(20*math.sin(angleradians),-20.0*math.cos(angleradians),3)
#self.dlnp.setHpr(angledegrees, 0, 0)
return Task.cont
'''def SpinCameraTask(task):
angledegrees = task.time * 6.0
angleradians = angledegrees * (math.pi / 180.0)
base.camera.setPos(20*math.sin(angleradians),-20.0*math.cos(angleradians),3)
base.camera.setHpr(angledegrees, 0, 0)
return Task.cont'''
def Shadeoff(self):
self.model.setShaderOff()
def Shadeon(self):
self.model.setShaderAuto()
#self.gameTask = taskMgr.add(self.gameLoop, "gameLoop")
w=World()
CameraHandler()
run()
Добавлено (29.07.2013, 04:13)
---------------------------------------------
Ни спекуляр, ни нормал не отображаются. Просто белая сфера и все.