Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 7, 2011, 3:02:02 PM (13 years ago)
Author:
fmauro
Message:

added generateFog function

Location:
code/branches/environment3/data/levels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/environment3/data/levels/asteroidField.oxw

    r8946 r8961  
    3434    <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff2 />
    3535
    36     <!-- Generate asteroid field with diameter 12000 containing 250 asteroids -->   
     36    <!-- Generate asteroid field and asteroid belt -->   
    3737    <?lua
    3838        dofile("includes/asteroidField.lua")
    39         asteroidField(0, 0, 5000, 100, 150, 2000, 50);
    40         asteroidBelt(0, 0, 0, -48, -34, 30, 100, 200, 17000, 21000, 900)
     39        asteroidField(0, 0, 5000, 100, 150, 2000, 50, 1);
     40        asteroidBelt(0, 0, 0, -48, -34, 30, 100, 200, 17000, 21000, 900, 1)
    4141    ?>
    4242   
  • code/branches/environment3/data/levels/includes/asteroidField.lua

    r8947 r8961  
     1--[[ fog generator
     2generates fog
     3        posX, posY, posZ - position in space
     4        size - size of billboard
     5        brightness - [0,1] fog brightness
     6--]]
     7function generateFog(posX, posY, posZ, size, brightness)
     8                print("<Billboard ")
     9                        print("position = \"")
     10                                print(posX) print(",")
     11                                print(posY) print(",")
     12                                print(posZ) print("\" ")
     13                        print("colour=\"")
     14                                print(brightness) print(",")
     15                                print(brightness) print(",")
     16                                print(brightness) print("\" ")
     17                        print("material=\"Smoke/Smoke\" scale=")
     18                        print(size)
     19                        print(" />")
     20end
     21
    122--[[ asteroid field generator
    223generates asteroid field
     
    526        radius - size of the cube around position in space
    627        count - number of asteroids
     28        fog - enable fog 0/1
    729--]]
    8 function asteroidField(posX, posY, posZ, minSize, maxSize, radius, count)
     30function asteroidField(posX, posY, posZ, minSize, maxSize, radius, count, fog)
    931        for i = 1, count, 1
    1032        do
     
    3658               
    3759                print("</StaticEntity>")
     60               
     61                if fog == 1 and i % 5 == 0 then
     62                        generateFog(pX, pY, pZ, size*0.7, 0.2)
     63                end
    3864        end
    3965end
     
    4773        radius0, radius1 - inner/outer radius
    4874        count - number of asteroids
     75        fog - enable fog 0/1
    4976--]]
    50 function asteroidBelt(centerX, centerY, centerZ, yaw, pitch, segments, minSize, maxSize, radius0, radius1, count)
     77function asteroidBelt(centerX, centerY, centerZ, yaw, pitch, segments, minSize, maxSize, radius0, radius1, count, fog)
    5178        dPhi = (2 * math.pi) / segments
    5279        width = math.abs(radius1 - radius0)
     
    6996                asteroidField((radius * math.cos(i * dPhi)),
    7097                                        (radius * math.sin(i * dPhi)),
    71                                         0, minSize, maxSize, width,segmentCount)
     98                                        0, minSize, maxSize, width, segmentCount, fog)
    7299        end
    73100       
Note: See TracChangeset for help on using the changeset viewer.