Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public LightSource(VectorInt worldPosIndex , byte radius , Color color)
- {
- this.radius = (byte)radius;
- this.color = color;
- // Clamp it might go over the edge of world position
- xMin = Helper.ClampInt( worldPosIndex.X - radius , 0 , worldPosIndex.X );
- xMax = Helper.ClampInt( worldPosIndex.X + radius , worldPosIndex.X , World.worldXLength );
- yMin = Helper.ClampInt( worldPosIndex.Y - radius , 0 , worldPosIndex.Y );
- yMax = Helper.ClampInt( worldPosIndex.Y + radius , worldPosIndex.Y , World.worldYLength );
- zMin = Helper.ClampInt( worldPosIndex.Z - radius , 0 , worldPosIndex.Z );
- zMax = Helper.ClampInt( worldPosIndex.Z + radius , worldPosIndex.Z , World.worldZLength );
- // The size of the cube array, +1 for the Light Source Position so it will be when spread > 1 2 3 4 LS 4 3 2 1
- xSize = (xMax-xMin)+1;
- ySize = (yMax-yMin)+1;
- zSize = (zMax-zMin)+1;
- // The index of the Light Source in the cube-array, this is where the spreading/propagation starts.
- xIndex = posInShipData.X-xMin;
- yIndex = posInShipData.Y-yMin;
- zIndex = posInShipData.Z-zMin;
- // Start Spreading. . .
- }
- private XYZ WorldToIndex( int x , int y , int z )
- {
- return new XYZ( x - xMin , y - yMin , z - zMin );
- }
- private XYZ IndexToWorld( int x , int y , int z )
- {
- return new XYZ( xMin + x , yMin + y , zMin + z );
- }
Add Comment
Please, Sign In to add comment