static public void rasterLightsToNode(BTerrainQuadNode node) { worldChunk wc = null; for (int x = 0; x < mWorldChunks.GetLength(0); x++) { for (int y = 0; y < mWorldChunks.GetLength(1); y++) { if (mWorldChunks[x, y].mQNPointer == node) { wc = mWorldChunks[x, y]; break; } } if (wc != null) { break; } } if (wc == null) { return; } rasterLightsToNode(wc); }
static public void init(int numXChunks, int numZChunks) { //initalize our chunk pointers to the main QNs mWorldChunks = new worldChunk[numXChunks, numZChunks]; for (int x = 0; x < mWorldChunks.GetLength(0); x++) { for (int y = 0; y < mWorldChunks.GetLength(1); y++) { int xPt = (int)(x * BTerrainQuadNode.cMaxWidth + 1); int yPt = (int)(y * BTerrainQuadNode.cMaxHeight + 1); mWorldChunks[x, y] = new worldChunk(); mWorldChunks[x, y].mQNPointer = TerrainGlobals.getTerrain().getQuadNodeRoot().getLeafNodeContainingPoint(xPt, yPt); } } }
static public void rasterLightsToNode(worldChunk wc) { if (!TerrainGlobals.getEditor().doShowLighting()) { return; } clearLightInfluence(wc.mQNPointer.getDesc().mMinXVert, wc.mQNPointer.getDesc().mMinZVert); wc.mQNPointer.mDirty = true; wc.mQNPointer.clearVisibleDatHandle(); for (int i = 0; i < wc.mLightsAffectingMe.Count; i++) { SimEditor.LocalLight ll = wc.mLightsAffectingMe[i].mSimEditorObject; rasterLightToGrid(ll, TerrainGlobals.getEditor().getLightValues(), wc.mQNPointer.getDesc().mMinXVert, wc.mQNPointer.getDesc().mMinZVert); } }
//CLM called during normal export static public void rasterTerrainLightsToExportGrid(Vector3 [] lht) { //walk each world grid, raster the lights that are terrain only to the grid worldChunk wc = null; for (int x = 0; x < mWorldChunks.GetLength(0); x++) { for (int y = 0; y < mWorldChunks.GetLength(1); y++) { for (int i = 0; i < mWorldChunks[x, y].mLightsAffectingMe.Count; i++) { SimEditor.LocalLight ll = mWorldChunks[x, y].mLightsAffectingMe[i].mSimEditorObject; if (ll.LightData.TerrainOnly == true) { rasterLightToGrid(ll, lht, mWorldChunks[x, y].mQNPointer.getDesc().mMinXVert, mWorldChunks[x, y].mQNPointer.getDesc().mMinZVert); } } } } }