本文整理汇总了Python中scene.Scene.skycolor方法的典型用法代码示例。如果您正苦于以下问题:Python Scene.skycolor方法的具体用法?Python Scene.skycolor怎么用?Python Scene.skycolor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scene.Scene
的用法示例。
在下文中一共展示了Scene.skycolor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parseconfig
# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import skycolor [as 别名]
def parseconfig(config):
data = json.loads(config)
objectlist, lights = [], []
for conf in data["objects"]:
if conf["type"] == "sphere":
posx, posy, posz = conf["position"]
r = conf["radius"]
col = conf["color"]
roughness = conf["roughness"]
obj = objects.CollidableSphere(
position=euclid.Point3(posx, posy, posz), radius=r, color=col, roughness=roughness
)
elif conf["type"] == "plane":
orix, oriy, oriz = conf["origin"]
normx, normy, normz = conf["normal"]
roughness = conf["roughness"]
obj = objects.CollidablePlane(
origin=euclid.Point3(orix, oriy, oriz), normal=euclid.Vector3(normx, normy, normz), roughness=roughness
)
objectlist.append(obj)
for conf in data["lights"]:
x, y, z = conf
lights.append(objects.Light(position=euclid.Point3(x, y, z)))
conf = data["camera"]
imgw, imgh = conf["imageDim"]
scrw, scrh = conf["screenDim"]
focal = conf["focallength"]
camera = Camera(imageDim=(imgw, imgh), focallength=focal, screenDim=(scrw, scrh))
scene = Scene(camera=camera, objects=objectlist, lights=lights)
scene.skycolor = tuple(data["skycolor"])
depth = data["depth"]
return camera, depth, lights, objectlist, scene
示例2: int
# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import skycolor [as 别名]
import time
import sys
if __name__=="__main__":
#import rpdb2; rpdb2.start_embedded_debugger('1234')
# do raycaster things
objectlist = [objects.CollidableSphere(position=euclid.Point3(10.,-5.,5.), radius=3.,
color=(255, 215, 0), roughness=0.8),
objects.CollidableSphere(position=euclid.Point3(6.,0.,0.), radius=1.,
color=(0, 255, 0), roughness=0.99),
objects.CollidableSphere(position=euclid.Point3(20.,5.,0.), radius=11.,
color=(188, 188, 177), roughness=0.8),
objects.CollidablePlane(origin=euclid.Point3(10.,0.,-10.)
,normal=euclid.Vector3(.5, 0.,-1.),
roughness=0.8)]
lights = [objects.Light(position=euclid.Point3(0.,0.,0.)),
objects.Light(position=euclid.Point3(10.,0.,5.)),
objects.Light(position=euclid.Point3(-50.,0.,55.))]
try:
i,j = sys.argv[1].split(",")
i,j = int(i), int(j)
except:
i,j = 256, 256
camera = Camera(imageDim=(i,j),focallength=3., screenDim=(16,9))
myScene = Scene(camera=camera, objects=objectlist, lights=lights)
myScene.skycolor = (90, 90, 255)
starttime = time.clock()
myScene.render(depth=3)
endtime = time.clock()
print("Took %.2f seconds for rendering a %dx%d image." % (endtime - starttime,
camera.imagew, camera.imageh))