本文整理汇总了Python中scene.Scene.loadModelTextures方法的典型用法代码示例。如果您正苦于以下问题:Python Scene.loadModelTextures方法的具体用法?Python Scene.loadModelTextures怎么用?Python Scene.loadModelTextures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scene.Scene
的用法示例。
在下文中一共展示了Scene.loadModelTextures方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import loadModelTextures [as 别名]
#.........这里部分代码省略.........
# tm.name = 'textures/masonry_wall-texture.jpg'
# hm.name = 'textures/masonry_wall-height_map.jpg'
# nm.name = 'textures/masonry_wall-normal_map.jpg'
# sc = 4
# tm.scale = (sc,sc)
# hm.scale = (sc,sc)
# nm.scale = (sc,sc)
# tm.set = True
# hm.set = True
# nm.set = True
# floor_index = scene.loadObjModel('models/floor.obj')
floor_index = scene.loadObjModel('models/grid.obj')
if floor_index == None:
print 'Error loading model'
exit(-1)
floor = scene.models[floor_index]
floor.props.pos = vec3(0,-0.5,3)
floor.props.scale = vec3(1)
for m in floor.models:
m.material.bump_height = 0.015
m.material.ambient = vec4(0.8,0.8,1,1)
m.material.shininess = 0
tm = m.material.texture1_map
nm = m.material.normal_map
hm = m.material.height_map
# tm.name = 'textures/grass-texture.jpg'
tm.name = 'textures/masonry_wall-texture.jpg'
hm.name = 'textures/masonry_wall-height_map.jpg'
# hm.name = 'textures/heightmap1-1024.jpg'
# nm.name = 'textures/masonry_wall-normal_map.jpg'
# tm.name = 'textures/brickwork-texture.jpg'
# hm.name = 'textures/brickwork-height_map.jpg'
# nm.name = 'textures/brickwork-normal_map.jpg'
sc = 0.5
tm.scale = (sc,sc)
hm.scale = (sc,sc)
nm.scale = (sc,sc)
tm.set = True
hm.set = True
nm.set = False
# sm = m.material.shininess_map
# sm.name = 'textures/brickwork-bump_map.jpg'
# sm.scale = (sc,sc)
# sm.set = True
# rm = m.material.reflection_map
# rm.set_textures('textures/cubemap/sky_x_pos.jpg',
# 'textures/cubemap/sky_x_neg.jpg',
# 'textures/cubemap/sky_y_pos.jpg',
# 'textures/cubemap/sky_y_neg.jpg',
# 'textures/cubemap/sky_z_pos.jpg',
# 'textures/cubemap/sky_z_neg.jpg')
# rm.set = True
scene.initCubemap('textures/cubemap/sky_x_pos.jpg',
'textures/cubemap/sky_x_neg.jpg',
'textures/cubemap/sky_y_pos.jpg',
'textures/cubemap/sky_y_neg.jpg',
'textures/cubemap/sky_z_pos.jpg',
'textures/cubemap/sky_z_neg.jpg')
scene.loadModelTextures()
scene.cam.pos = vec3(0.,1,3.)
scene.lights.ambient.intensity = 0.6
# spot_light = scene.lights.new_spot_light()
# spot_light.pos = vec3(0,5,0)
# spot_light.dir = vec3(0,-1,0).normalize()
# spot_light.reach = 10
# spot_light.dist_dimming = 0.5
# spot_light.ang_dimming = 0.5
# spot_light.color = vec3(1,1,1)
spot_light = scene.new_spot_light()
spot_light.pos = vec3(0,10,10)
spot_light.dir = vec3(0,-1,-1).normalize()
spot_light.reach = 40
spot_light.dist_dimming = 0.2
spot_light.ang_dimming = 0.2
spot_light.color = vec3(1,1,1)
glutDisplayFunc(lambda : scene.drawScene())
glutIdleFunc(lambda : scene.drawScene())
glutReshapeFunc(lambda w,h: reshape(w,h,scene))
glutKeyboardFunc(lambda key,x,y : keyPressed(key,x,y,scene))
glutMotionFunc(lambda x,y : mouseFunc(x,y,scene))
# glutPassiveMotionFunc(lambda x,y : mouseFunc(x,y,scene,screen_size))
glutWarpPointer(250,250)
glutMouseFunc
glutMainLoop()
示例2: main
# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import loadModelTextures [as 别名]
def main():
screen_size = startOpengl()
program = initShaders("shaders/grass.vert", "shaders/grass.frag")
scene = Scene()
scene.active_program = program
model_index = scene.loadObjModel('models/floor.obj')
if model_index == None:
print 'Error loading model'
exit(-1)
model = scene.models[model_index]
model.props.pos = vec3(0,-0.5,3)
model.props.scale = vec3(1)
for m in model.models:
m.material.bump_height = 0.05
tm = m.material.texture1_map
nm = m.material.normal_map
hm = m.material.height_map
# tm.name = 'textures/uvmap.png'
tm.mag_filter = GL_NEAREST
tm.min_filter = GL_NEAREST_MIPMAP_NEAREST
nm.mag_filter = GL_NEAREST
nm.min_filter = GL_NEAREST_MIPMAP_NEAREST
hm.mag_filter = GL_NEAREST
hm.min_filter = GL_NEAREST_MIPMAP_NEAREST
tm.name = 'textures/grass-texture.jpg'
hm.name = 'textures/grass-height_map.jpg'
nm.name = 'textures/grass-height_map.jpg'
# hm.name = 'textures/height_example.jpg'
# nm.name = 'textures/height_example.jpg'
# tm.name = 'textures/brickwork-texture.jpg'
# hm.name = 'textures/brickwork-height_map.jpg'
# nm.name = 'textures/brickwork-normal_map.jpg'
# tm.name = 'textures/masonry_wall-texture.jpg'
# hm.name = 'textures/masonry_wall-height_map.jpg'
# nm.name = 'textures/masonry_wall-normal_map.jpg'
sc = 20
tm.scale = (sc,sc)
hm.scale = (sc,sc)
nm.scale = (sc,sc)
tm.set = True
hm.set = True
nm.set = True
# sm = m.material.shininess_map
# sm.name = 'textures/brickwork-bump_map.jpg'
# sm.scale = (sc,sc)
# sm.set = True
# rm = m.material.reflection_map
# rm.set_textures('textures/cubemap/sky_x_pos.jpg',
# 'textures/cubemap/sky_x_neg.jpg',
# 'textures/cubemap/sky_y_pos.jpg',
# 'textures/cubemap/sky_y_neg.jpg',
# 'textures/cubemap/sky_z_pos.jpg',
# 'textures/cubemap/sky_z_neg.jpg')
# rm.set = True
scene.initCubemap('textures/cubemap/sky_x_pos.jpg',
'textures/cubemap/sky_x_neg.jpg',
'textures/cubemap/sky_y_pos.jpg',
'textures/cubemap/sky_y_neg.jpg',
'textures/cubemap/sky_z_pos.jpg',
'textures/cubemap/sky_z_neg.jpg')
scene.loadModelTextures()
scene.cam.pos = vec3(0.,0.,3)
screen = Screen()
screen.size = screen_size
glutDisplayFunc(lambda : drawScene(scene))
glutIdleFunc(lambda : drawScene(scene))
glutReshapeFunc(lambda w,h: reshape(w,h,screen))
glutKeyboardFunc(lambda key,x,y : keyPressed(key,x,y,scene))
glutMotionFunc(lambda x,y : mouseFunc(x,y,scene,screen))
# glutPassiveMotionFunc(lambda x,y : mouseFunc(x,y,scene,screen_size))
glutWarpPointer(250,250)
glutMouseFunc
glutMainLoop()