void CSimpleMapGenerator::GenerateMap() { startPositions.push_back(int2(20, 20)); startPositions.push_back(int2(500, 500)); mapDescription = "The Split Canyon"; int2 gs = GetGridSize(); std::vector<float>& map = GetHeightMap(); for(int x = 0; x < gs.x; x++) { for(int y = 0; y < gs.y; y++) { map[y * gs.x + x] = 50.0f; } } }
/* ============== sdDeployMaskEditSession::UpdateProjection ============== */ void sdDeployMaskEditSession::UpdateProjection( const idVec3& position ) { if ( !decalMaterial ) { return; } if ( decalHandle == -1 ) { decalHandle = gameLocal.RegisterLoggedDecal( decalMaterial ); } gameLocal.ResetLoggedDecal( decalHandle ); gameDecalInfo_t* decalInfo = gameLocal.GetLoggedDecal( decalHandle ); sdDeployMaskInstance* mask = GetMask( position ); const sdHeightMapInstance* heightMap = GetHeightMap( position ); if ( mask != NULL && mask->IsValid() && heightMap != NULL ) { sdDeployMask::extents_t extents; GetExtents( position, *mask, extents ); float depth = 512.0f; int maxX, maxY; mask->GetDimensions( maxX, maxY ); sdDeployMask::extents_t expandedExtents; expandedExtents.minx = Max( 0, extents.minx - 2 ); expandedExtents.miny = Max( 0, extents.miny - 2 ); expandedExtents.maxx = Min( maxX, extents.maxx + 2 ); expandedExtents.maxy = Min( maxY, extents.maxy + 2 ); idList< const idMaterial* > megaTextureMaterials; const idStrList& megaTextureMaterialNames = gameLocal.GetMapInfo().GetMegatextureMaterials(); for ( int i = 0; i < megaTextureMaterialNames.Num(); i++ ) { megaTextureMaterials.Append( declHolder.FindMaterial( megaTextureMaterialNames[ i ] ) ); } idFixedWinding winding; int spawnID = WORLD_SPAWN_ID; for ( int i = expandedExtents.minx; i <= expandedExtents.maxx; i++ ) { for ( int j = expandedExtents.miny; j <= expandedExtents.maxy; j++ ) { gameDecalInfo_t* info = decalInfo; if ( !info ) { continue; } sdDeployMask::extents_t localExtents; localExtents.minx = i; localExtents.maxx = i; localExtents.miny = j; localExtents.maxy = j; idBounds bounds; mask->GetBounds( localExtents, bounds, heightMap ); idVec3 top = bounds.GetCenter(); top[ 2 ] = bounds.GetMaxs()[ 2 ]; deployResult_t localResult = mask->IsValid( localExtents ); idVec4 localColor; switch ( localResult ) { case DR_CLEAR: localColor = colorGreen; break; default: case DR_FAILED: localColor = colorDkRed; break; } if ( !( ( i >= extents.minx ) && ( i <= extents.maxx ) && ( j >= extents.miny ) && ( j <= extents.maxy ) ) ) { localColor.x *= 0.3f; localColor.y *= 0.3f; localColor.z *= 0.3f; } winding.Clear(); winding += idVec5( idVec3( bounds.GetMins()[ 0 ], bounds.GetMins()[ 1 ], bounds.GetMins()[ 2 ] - depth ), idVec2( 0.0f, 0.0f ) ); winding += idVec5( idVec3( bounds.GetMins()[ 0 ], bounds.GetMaxs()[ 1 ], bounds.GetMins()[ 2 ] - depth ), idVec2( 0.0f, 1.0f ) ); winding += idVec5( idVec3( bounds.GetMaxs()[ 0 ], bounds.GetMaxs()[ 1 ], bounds.GetMins()[ 2 ] - depth ), idVec2( 1.0f, 1.0f ) ); winding += idVec5( idVec3( bounds.GetMaxs()[ 0 ], bounds.GetMins()[ 1 ], bounds.GetMins()[ 2 ] - depth ), idVec2( 1.0f, 0.0f ) ); gameRenderWorld->AddToProjectedDecal( winding, top + idVec3( 0, 0, 64.f + depth ), true, localColor, info->renderEntity.hModel, spawnID, megaTextureMaterials.Begin(), megaTextureMaterials.Num() ); } } } }