Intranet Catprocess
  1. news...
  2. about Blackvoxel
  3. download
  4. manual
  5. videos
  6. about us
  1. 3D Color Zone Animation

    // 3D COLOR ZONE ANIMATION
    
    init<-0;
    factor<-0;
    ColorTable<-0;

    // This function is called repeatedly for each step of the robot.

    function Voxel_Step()
    {
    local x,y,z,i,u,v, Height;

    // Startup code, build the environnment. Executes only once.

    if (init ==0)
    {
    init = 1;
    Image_New(0,32,32);
    Image_Clear(0,0);
    ColorTable = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,8,9,10,11,12,13,14,15];
    }

    // Compute height map and store values in the canva.

    for (x=0;x<32;x++)
    for (y=0;y<32;y++)
    {
    u = sin(y*0.09817477*3.2); //5.092958185
    v = sin(x*0.09817477*3.2);
    u = u*v*sin(factor)*10+10;
    Image_SetPixel(0,x,y, u.tointeger());
    }

    // Draw in the 3D world according to above height map values.

    for (x=0;x<32;x++)
    for(z=0;z<32;z++)
    for (y=0;y<20;y++)
    {
    UNF_PlaceVoxel3D(x+1,y-11,z, (Image_GetPixel(0,x,z) >= y) ? ColorTable[y]+216:0);
    }
    factor+=0.1;
    }
     
  2. Google+