예제 #1
0
void EDetailManager::Clear(bool bSpecific)
{
	ClearBase			();
	ClearColorIndices	();
    ClearSlots			();
    m_Flags.zero		();
    m_RTFlags.zero		();
}
예제 #2
0
TB_StageSelect::TB_StageSelect()
{
	ClearSlots();
}
예제 #3
0
bool EDetailManager::LoadStream(IReader& F)
{
	inherited::LoadStream	(F);

    string256 buf;
    R_ASSERT			(F.find_chunk(DETMGR_CHUNK_VERSION));
	u32 version			= F.r_u32();

    if (version!=DETMGR_VERSION){
    	ELog.Msg(mtError,"EDetailManager: unsupported version.");
        return false;
    }

    if (F.find_chunk(DETMGR_CHUNK_FLAGS)) m_Flags.assign(F.r_u32());
    
	// header
    R_ASSERT			(F.r_chunk(DETMGR_CHUNK_HEADER,&dtH));

    // slots
    R_ASSERT			(F.find_chunk(DETMGR_CHUNK_SLOTS));
    int slot_cnt		= F.r_u32();
	if (slot_cnt)dtSlots= xr_alloc<DetailSlot>(slot_cnt);
    m_Selected.resize	(slot_cnt);
	F.r					(dtSlots,slot_cnt*sizeof(DetailSlot));

    // objects
    if (!LoadColorIndices(F)){
        ELog.DlgMsg		(mtError,"EDetailManager: Some objects removed. Reinitialize objects.",buf);
        InvalidateSlots	();
    }

    // internal
    // bbox
    R_ASSERT			(F.r_chunk(DETMGR_CHUNK_BBOX,&m_BBox));

	// snap objects
    if (F.find_chunk(DETMGR_CHUNK_SNAP_OBJECTS)){
		int snap_cnt 		= F.r_u32();
        if (snap_cnt){
	        for (int i=0; i<snap_cnt; i++){
    	    	F.r_stringZ	(buf,sizeof(buf));
        	    CCustomObject* O = Scene->FindObjectByName(buf,OBJCLASS_SCENEOBJECT);
            	if (!O)		ELog.Msg(mtError,"EDetailManager: Can't find snap object '%s'.",buf);
	            else		m_SnapObjects.push_back(O);
    	    }
        }
    }

    if (F.find_chunk(DETMGR_CHUNK_DENSITY))
		ps_r__Detail_density= F.r_float();

	// base texture
	if(F.find_chunk(DETMGR_CHUNK_BASE_TEXTURE)){
	    F.r_stringZ		(buf,sizeof(buf));
    	if (m_Base.LoadImage(buf)){
		    m_Base.CreateShader();
            m_RTFlags.set(flRTGenerateBaseMesh,TRUE);
        }else{
        	ELog.Msg(mtError,"EDetailManager: Can't find base texture '%s'.",buf);
            ClearSlots();
            ClearBase();
        }
    }

    InvalidateCache		();

    return true;
}