//----------------------------------------------------------------------------- // Computes lighting for the detail props //----------------------------------------------------------------------------- void ComputeDetailPropLighting( int iThread ) { // illuminate them all DetailObjectLump_t* pProps; int count = UnserializeDetailProps( pProps ); if (!count) return; // unserialize the lump that we aren't computing. if( g_bHDR ) { UnserializeDetailPropLighting( GAMELUMP_DETAIL_PROP_LIGHTING, GAMELUMP_DETAIL_PROP_LIGHTING_VERSION, s_DetailPropLightStyleLumpLDR ); } else { UnserializeDetailPropLighting( GAMELUMP_DETAIL_PROP_LIGHTING_HDR, GAMELUMP_DETAIL_PROP_LIGHTING_HDR_VERSION, s_DetailPropLightStyleLumpHDR ); } StartPacifier("Computing detail prop lighting : "); for (int i = 0; i < count; ++i) { UpdatePacifier( (float)i / (float)count ); ComputeLighting( pProps[i], iThread ); } // Write detail prop lightstyle lump... WriteDetailLightingLumps(); EndPacifier( true ); }
//----------------------------------------------------------------------------- // Computes lighting for the static props. // Must be after all other surface lighting has been computed for the indirect sampling. //----------------------------------------------------------------------------- void CVradStaticPropMgr::ComputeLighting( int iThread ) { // illuminate them all int count = m_StaticProps.Count(); if ( !count ) { // nothing to do return; } StartPacifier( "Computing static prop lighting : " ); // ensure any traces against us are ignored because we have no inherit lighting contribution m_bIgnoreStaticPropTrace = true; for (int i = 0; i < count; ++i) { UpdatePacifier( (float)i / (float)count ); ComputeLighting( m_StaticProps[i], iThread, i ); } // restore default m_bIgnoreStaticPropTrace = false; // save data to bsp SerializeLighting(); EndPacifier( true ); }
void VMPI_ProcessDetailPropWU( int iThread, int iWorkUnit, MessageBuffer *pBuf ) { CUtlVector<DetailPropLightstylesLump_t> *pDetailPropLump = s_pDetailPropLightStyleLump; DetailObjectLump_t& prop = g_pMPIDetailProps[iWorkUnit]; ComputeLighting( prop, iThread ); // Send the results back... pBuf->write( &prop.m_Lighting, sizeof( prop.m_Lighting ) ); pBuf->write( &prop.m_LightStyleCount, sizeof( prop.m_LightStyleCount ) ); pBuf->write( &prop.m_LightStyles, sizeof( prop.m_LightStyles ) ); for ( int i=0; i < prop.m_LightStyleCount; i++ ) { DetailPropLightstylesLump_t *l = &pDetailPropLump->Element( i + prop.m_LightStyles ); pBuf->write( &l->m_Lighting, sizeof( l->m_Lighting ) ); pBuf->write( &l->m_Style, sizeof( l->m_Style ) ); } }