/* void dump (CDetailManager::vis_list& lst) { for (int i=0; i<lst.size(); i++) { Msg("%8x / %8x / %8x", lst[i]._M_start, lst[i]._M_finish, lst[i]._M_end_of_storage._M_data); } } */ void CDetailManager::Load () { // Open file stream if (!FS.exist("$level$","level.details")) { dtFS = NULL; return; } string256 fn; FS.update_path (fn,"$level$","level.details"); dtFS = FS.r_open(fn); // Header dtFS->r_chunk_safe (0,&dtH,sizeof(dtH)); R_ASSERT (dtH.version == DETAIL_VERSION); u32 m_count = dtH.object_count; // Models IReader* m_fs = dtFS->open_chunk(1); for (u32 m_id = 0; m_id < m_count; m_id++) { CDetail* dt = xr_new<CDetail> (); IReader* S = m_fs->open_chunk(m_id); dt->Load (S); objects.push_back (dt); S->close (); } m_fs->close (); // Get pointer to database (slots) IReader* m_slots = dtFS->open_chunk(2); dtSlots = (DetailSlot*)m_slots->pointer(); m_slots->close (); // Initialize 'vis' and 'cache' for (u32 i=0; i<3; ++i) visible[i].resize(objects.size()); cache_Initialize (); // Make dither matrix bwdithermap (2,dither); // Hardware specific optimizations if (UseVS()) hw_Load (); else soft_Load (); // swing desc // normal swing_desc[0].amp1 = pSettings->r_float("details","swing_normal_amp1"); swing_desc[0].amp2 = pSettings->r_float("details","swing_normal_amp2"); swing_desc[0].rot1 = pSettings->r_float("details","swing_normal_rot1"); swing_desc[0].rot2 = pSettings->r_float("details","swing_normal_rot2"); swing_desc[0].speed = pSettings->r_float("details","swing_normal_speed"); // fast swing_desc[1].amp1 = pSettings->r_float("details","swing_fast_amp1"); swing_desc[1].amp2 = pSettings->r_float("details","swing_fast_amp2"); swing_desc[1].rot1 = pSettings->r_float("details","swing_fast_rot1"); swing_desc[1].rot2 = pSettings->r_float("details","swing_fast_rot2"); swing_desc[1].speed = pSettings->r_float("details","swing_fast_speed"); }
void EDetailManager::InitRender() { // inavlidate cache InvalidateCache (); // Make dither matrix bwdithermap (2,dither); soft_Load (); }
void EDetailManager::OnDeviceCreate() { // base texture m_Base.CreateShader(); // detail objects for (DetailIt it=objects.begin(); it!=objects.end(); it++) ((EDetail*)(*it))->OnDeviceCreate(); soft_Load (); }