Beispiel #1
0
void UtilTest::SetWAV()
{
    // Get the current sound object.
    SoundObj *snd = ip->GetSoundObject();

    // See if we can get a wave interface
    IWaveSound *iWav = GetWaveSoundInterface(snd);
    if (iWav) {
        // Set the sound file
        IAssetManager* assetMgr = IAssetManager::GetInstance();
        if(!assetMgr)return;
        if (!iWav->SetSoundFile(assetMgr->GetAsset(_T("test.wav"),kSoundAsset))) {
            MessageBox(hPanel,
                       _T("Unable to load TEST.WAV"),
                       _T("Util Test"),MB_OK);
            return;
        }
        // Set the offset to 10 frames.
        iWav->SetStartTime(GetTicksPerFrame() * 10);
    } else {
        MessageBox(hPanel,
                   _T("No IWaveSound interface"),
                   _T("Util Test"),MB_OK);
    }
}
Beispiel #2
0
IOResult CubeMap::Load(ILoad *iload)
{
	TCHAR *buf;
	IOResult res = IO_OK;	
	
	while (IO_OK==(res=iload->OpenChunk())) 
	{
		switch (iload->CurChunkID()) 
		{
		case CUBEMAP_CHUNK:
			{
				res = iload->ReadWStringChunk (&buf);
				IAssetManager* assetMgr = IAssetManager::GetInstance();
				if(assetMgr)
				{
					SetCubeMapFile(assetMgr->GetAsset(buf,kBitmapAsset));
				}
			};
			break;
		case CUBEMAP_ASSET_CHUNK:
			{
				IAssetManager* assetMgr = IAssetManager::GetInstance();	
				if(assetMgr)
					assetMgr->LoadAsset(iload,cubeMapFileAsset);
			};
			break;

		}
		iload->CloseChunk();
		if (res!=IO_OK)
			return res;
	}				
		
	return IO_OK;
}
Beispiel #3
0
void DataIndex::SetPathOnLights(TCHAR* oldPath, TCHAR* newPath)	{
	// don't zero out paths
	try {
		IAssetManager* assetMgr = IAssetManager::GetInstance();
		if(oldPath[0] && newPath[0] && assetMgr && lightCount != 0)    {
			AssetUser oldAsset = assetMgr->GetAsset(oldPath,kPhotometricAsset);
			AssetUser newAsset = assetMgr->GetAsset(newPath,kPhotometricAsset);
			for(int i=0;i<lightCount;i++)  {
				if(lights[i] && lights[i]->GetWebFile().GetId() == oldAsset.GetId())          {
					lights[i]->SetWebFile(newAsset);
				}
			}
		}
	} catch(...)       {
		DebugPrint(_T("Access Error in DataIndex::SetPathOnLights.\n"));
	}
}
Beispiel #4
0
CubeMap::CubeMap()
{
	pblock = NULL;
	CubeMapDesc.MakeAutoParamBlocks(this);	
	pps = new IDX9PixelShaderImp(this);
	pvs = new IDX9PixelVertexShaderImp(this);
	initPS = true;
	initVS = true;
	IAssetManager* assetMgr = IAssetManager::GetInstance();
	if(assetMgr)
	{
		AssetUser assetCubeMap = assetMgr->GetAsset(_T("sky_cube_mipmap.dds"),kBitmapAsset);
		AssetUser assetVertexShader = assetMgr->GetAsset(_T("CubeMap.njv"),kBitmapAsset);
		SetVertexShaderFile(assetVertexShader);
		SetCubeMapFile(assetCubeMap);
	}

}
Beispiel #5
0
	void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
	{
		CubeMap *map = (CubeMap*) owner;
		switch(id)
		{
		case pb_cubemapfile: 
			{
				IAssetManager* assetMgr = IAssetManager::GetInstance();
				if(assetMgr)
				{
					map->SetCubeMapFile(assetMgr->GetAsset(v.s,kBitmapAsset)); break;
				}
			}
		default: break;
		}
		GetCOREInterface()->RedrawViews(GetCOREInterface()->GetTime());

	}
Beispiel #6
0
// Load the controller data
IOResult AudioP3Control::Load(ILoad *iload)
{
    ULONG nb;
    IOResult res = IO_OK;

    Control::Load(iload);	// Handle ORT's

    while (IO_OK==(res=iload->OpenChunk())) {
        switch (iload->CurChunkID()) {
        case BASE_CHUNK:
            res=iload->Read(&basePoint,sizeof(basePoint),&nb);
            break;

        case TARGET_CHUNK:
            res=iload->Read(&targetPoint,sizeof(targetPoint),&nb);
            break;

        case ABSOLUTE_CHUNK:
            res=iload->Read(&absolute,sizeof(absolute),&nb);
            break;

        case CHANNEL_CHUNK:
            res=iload->Read(&channel,sizeof(channel),&nb);
            break;
        case LOCK_CHUNK:
        {
            int on;
            res=iload->Read(&on,sizeof(on),&nb);
            if(on)
                mLocked = true;
            else
                mLocked = false;
        }
        break;

        case FILENAME_CHUNK: {
            wchar_t *buf = NULL;
            res=iload->ReadWStringChunk(&buf);
            IAssetManager* assetMgr = IAssetManager::GetInstance();
            if(assetMgr)
            {
                AssetUser asset = assetMgr->GetAsset(TSTR::FromUTF16(buf),kSoundAsset);
                SetFile(asset);
                if (asset.GetId()!=kInvalidId) {
                    // Initialize the WaveForm and load the audio stream
                    wave->InitOpen(asset);
                }
            }
            break;
        }
        case FILENAME_ASSET_CHUNK: {
            IAssetManager* assetMgr = IAssetManager::GetInstance();
            if(assetMgr)
                assetMgr->LoadAsset(iload,szFilenameAsset);
            if (szFilenameAsset.GetId()!=kInvalidId) {
                // Initialize the WaveForm and load the audio stream
                wave->InitOpen(szFilenameAsset);
            }
            break;
        }
        case NUMSAMPLES_CHUNK:
            res=iload->Read(&numsamples,sizeof(numsamples),&nb);
            break;

        case RANGE_CHUNK:
            res=iload->Read(&range,sizeof(range),&nb);
            break;

        case THRESHOLD_CHUNK:
            res=iload->Read(&threshold,sizeof(threshold),&nb);
            break;

        case RUNTIME_CHUNK:
            res=iload->Read(&enableRuntime,sizeof(enableRuntime),&nb);
            break;
        case QUICKDRAW_CHUNK:
            res=iload->Read(&quickdraw,sizeof(quickdraw),&nb);
            break;

        }

        iload->CloseChunk();
        if (res!=IO_OK)  return res;
    }
    return IO_OK;
}