Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[r47]: SpecialFX.py Maximize Restore History

Download this file

SpecialFX.py    125 lines (97 with data), 4.0 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import os
os.environ['IRRLICHT_C_LIBRARY'] = 'irrlicht_c_173'
from pyirrlicht import *
#~ driverType = EDT_NULL
#~ driverType = EDT_SOFTWARE
#~ driverType = EDT_BURNINGSVIDEO
#~ driverType = EDT_DIRECT3D8
driverType = EDT_DIRECT3D9
#~ driverType = EDT_OPENGL
def main():
#~ print("Please press 'y' if you want to use realtime shadows.")
#~ shadows = True
shadows = False
if driverType == EDT_COUNT:
return 1
device = createDevice(driverType, dimension2du(640, 480), 16, False, shadows)
if not device:
return 1
driver = device.getVideoDriver()
smgr = device.getSceneManager()
mesh = smgr.getMesh("media/room.3ds")
if mesh:
smgr.getMeshManipulator().makePlanarTextureMapping(mesh.getMesh(0), 0.004)
node = smgr.addAnimatedMeshSceneNode(mesh)
if node:
node.setMaterialTexture(0, driver.getTexture("media/wall.jpg"))
node.getMaterial(0).SpecularColor.set(0,0,0,0)
mesh = smgr.addHillPlaneMesh("myHill", dimension2df(20,20), dimension2du(40,40), textureRepeatCount = dimension2df(10,10))
#~ mesh = smgr.addHillPlaneMesh("myHill", dimension2df(20,20), dimension2du(40,40), SMaterial(0), 0.0, dimension2df(0.0, 0.0), dimension2df(10,10))
if mesh:
node = smgr.addWaterSurfaceSceneNode(mesh.getMesh(0), 3.0, 300.0, 30.0)
node.setPosition(vector3df(0,7,0))
node.setMaterialTexture(0, driver.getTexture("media/stones.jpg"))
node.setMaterialTexture(1, driver.getTexture("media/water.jpg"))
node.setMaterialType(EMT_REFLECTION_2_LAYER)
node = smgr.addLightSceneNode(0, vector3df(0,0,0), SColorf(1.0, 0.6, 0.7, 1.0), 800.0)
if node:
anim = smgr.createFlyCircleAnimator(vector3df(0,150,0), 250.0)
node.addAnimator(anim)
anim.drop()
node = smgr.addBillboardSceneNode(node, dimension2df(50, 50))
if node:
node.setMaterialFlag(EMF_LIGHTING, False)
node.setMaterialType(EMT_TRANSPARENT_ADD_COLOR)
node.setMaterialTexture(0, driver.getTexture("media/particlewhite.bmp"))
ps = smgr.addParticleSystemSceneNode(False)
em = ps.createBoxEmitter(aabbox3df(-7,0,-7,7,1,7), vector3df(0.0,0.06,0.0), 80, 100, SColor(0,255,255,255), SColor(0,255,255,255), 800, 2000, 0, dimension2df(10.0,10.0), dimension2df(20.0,20.0))
ps.setEmitter(em)
em.drop()
paf = ps.createFadeOutParticleAffector()
ps.addAffector(paf)
paf.drop()
ps.setPosition(vector3df(-70,60,40))
ps.setScale(vector3df(2,2,2))
ps.setMaterialFlag(EMF_LIGHTING, False)
ps.setMaterialFlag(EMF_ZWRITE_ENABLE, False)
ps.setMaterialTexture(0, driver.getTexture("media/fire.bmp"))
ps.setMaterialType(EMT_TRANSPARENT_VERTEX_ALPHA)
n = smgr.addVolumeLightSceneNode(0, -1, 32, 32, SColor(0, 255, 255, 255), SColor(0, 0, 0, 0))
if n:
n.setScale(vector3df(56.0, 56.0, 56.0))
n.setPosition(vector3df(-120,50,40))
textures = array(ITexture)
#~ for g in range(1, 8):
#~ textures.push_front(driver.getTexture('media/portal%d.bmp' % g))
for g in range(7, 0, -1):
textures.push_back(driver.getTexture('media/portal%d.bmp' % g))
glow = smgr.createTextureAnimator(textures, 150)
n.addAnimator(glow)
glow.drop()
mesh = smgr.getMesh("media/dwarf.x")
if mesh:
anode = smgr.addAnimatedMeshSceneNode(mesh)
if anode:
anode.setPosition(vector3df(-50,20,-60))
anode.setAnimationSpeed(15)
anode.addShadowVolumeSceneNode()
smgr.setShadowColor(SColor(150,0,0,0))
anode.setScale(vector3df(2,2,2))
anode.setMaterialFlag(EMF_NORMALIZE_NORMALS, True)
camera = smgr.addCameraSceneNodeFPS()
camera.setPosition(vector3df(-50,50,-150))
device.getCursorControl().setVisible(False)
lastFPS = -1
while device.run():
if device.isWindowActive():
driver.beginScene(True, True)
smgr.drawAll()
driver.endScene()
fps = driver.getFPS()
if lastFPS != fps:
device.setWindowCaption("Irrlicht Engine - SpecialFX example [%s] FPS:%d" % (driver.getName(), fps))
lastFPS = fps
device.drop()
return 0
if __name__ == "__main__":
main()