Reference

API Description

  • setVoxel(int x, int y, int z, int r, int g, int b): x、y、z is the coordinate, r、g、b is the Color.
    Function definition:

    void setVoxel(int x, int y, int z,int r,int g,int b)
    {
      if(x >= 0 && y >= 0 && z >= 0 &&
          x < 4 && y < 4 && z < 4) {
        int index = (z*16) + (x*4) + y;
        cube.setPixelColor(index, cube.Color(r,g,b));
      }
    }
    
  • background(int r, int g, int b): Set the entire light cube to display one color as background.
    Function definition:

    void background(int r,int g,int b)
    {
      for(int x = 0; x < 4; x++)
        for(int y = 0; y < 4; y++)
          for(int z = 0; z < 4; z++)
            setVoxel(x, y, z, r, g, b );
    }
    

Was this article helpful?

ON THIS PAGE

TOP