コード例 #1
0
ファイル: WindowManager.cpp プロジェクト: Rocks25/Voa
void WindowManager::SetFullscreenMode(SDL_Rect *Mode)
{	
	Cleanup();
	_Window=SDL_SetVideoMode(Mode->w, Mode->h, 0, SDL_HWSURFACE|SDL_OPENGL|SDL_FULLSCREEN);		// Switch to Fullscreen
	_Fullscreen=true;
	Reinitialize();
}
コード例 #2
0
void FAnimNode_BlendSpacePlayer::UpdateInternal(const FAnimationUpdateContext& Context)
{
	if ((BlendSpace != NULL) && (Context.AnimInstanceProxy->IsSkeletonCompatible(BlendSpace->GetSkeleton())))
	{
		// Create a tick record and fill it out
		FAnimGroupInstance* SyncGroup;
		FAnimTickRecord& TickRecord = Context.AnimInstanceProxy->CreateUninitializedTickRecord(GroupIndex, /*out*/ SyncGroup);

		const FVector BlendInput(X, Y, Z);
	
		if (PreviousBlendSpace != BlendSpace)
		{
			Reinitialize();
		}

		Context.AnimInstanceProxy->MakeBlendSpaceTickRecord(TickRecord, BlendSpace, BlendInput, BlendSampleDataCache, BlendFilter, bLoop, PlayRate, Context.GetFinalBlendWeight(), /*inout*/ InternalTimeAccumulator, MarkerTickRecord);

		// Update the sync group if it exists
		if (SyncGroup != NULL)
		{
			SyncGroup->TestTickRecordForLeadership(GroupRole);
		}

		PreviousBlendSpace = BlendSpace;
	}
}
コード例 #3
0
//------------------------------------------------------------------------
// Update the vegetation object.
//------------------------------------------------------------------------
void etVegetationObject::UpdateObject(void)
{
    if( m_Type == VGT_MESH && 
        m_nDirtyState != m_pMesh->GetDirtyState() )
        Reinitialize();

    m_WorldBBox = m_Bounds;
    m_WorldBBox.TransformBox( GetWorldTransform() );
}
コード例 #4
0
ファイル: WindowManager.cpp プロジェクト: Rocks25/Voa
void WindowManager::SetFullscreenMode(int w, int h)
{
	Cleanup();
	_Window=SDL_SetVideoMode(w, h, 0, SDL_HWSURFACE|SDL_OPENGL|SDL_FULLSCREEN);		// Switch to Fullscreen
	_Fullscreen=true;
	Reinitialize();
	
	return;
}
コード例 #5
0
ファイル: WindowManager.cpp プロジェクト: Rocks25/Voa
void WindowManager::ShowFullscreen()
{
	if(!_Fullscreen)
	{
		Cleanup();
		_Window=SDL_SetVideoMode(_CurrentFSMode->w, _CurrentFSMode->h, 0, SDL_HWSURFACE|SDL_OPENGL|SDL_FULLSCREEN);		// Switch to Fullscreen
		Reinitialize();
	}
	_Fullscreen=true;
}
コード例 #6
0
ファイル: shop_trade.cpp プロジェクト: galexcode/ValyriaTear
void TradeInterface::MakeActive()
{
    Reinitialize();

    _selected_object = _list_displays[_current_category]->GetSelectedObject();
    ShopMode::CurrentInstance()->ObjectViewer()->ChangeViewMode(_view_mode);
    ShopMode::CurrentInstance()->ObjectViewer()->SetSelectedObject(_selected_object);
    _category_display.ChangeViewMode(_view_mode);
    _category_display.SetSelectedObject(_selected_object);
}
コード例 #7
0
void FAnimNode_BlendSpacePlayer::Initialize(const FAnimationInitializeContext& Context)
{
	FAnimNode_AssetPlayerBase::Initialize(Context);

	EvaluateGraphExposedInputs.Execute(Context);

	Reinitialize();

	PreviousBlendSpace = BlendSpace;
}
コード例 #8
0
ファイル: WindowManager.cpp プロジェクト: Rocks25/Voa
void WindowManager::ShowNormal()
{
	if(_Fullscreen)
	{
		Cleanup();
		_Active=false;
		_Window=SDL_SetVideoMode(_CurrentWMode.w, _CurrentWMode.h, 0, SDL_HWSURFACE | SDL_OPENGL);		// Switch to Fullscreen
		Reinitialize();
	}
	_Fullscreen=false;
}
コード例 #9
0
ファイル: MMDeviceAudioSource.cpp プロジェクト: ArtBears/OBS
bool MMDeviceAudioSource::Initialize(bool bMic, CTSTR lpID)
{
    const IID IID_IMMDeviceEnumerator    = __uuidof(IMMDeviceEnumerator);
    const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);

    bIsMic = bMic;
    deviceId = lpID;

    HRESULT err = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void**)&mmEnumerator);
    if(FAILED(err))
    {
        AppWarning(TEXT("MMDeviceAudioSource::Initialize(%d): Could not create IMMDeviceEnumerator = %08lX"), (BOOL)bIsMic, err);
        return false;
    }

    return Reinitialize();
}
コード例 #10
0
bool ApplicationCenter::LoadContent(const std::string& filePath,int nMaxSize)
{
	m_bPauseDrawing = true;

	g_filePath = filePath;
	
	if(!m_loadFirstTime)
		Reinitialize();

	if(m_processorList.size() < 0)
	{
		ShowMessage("m_processorList为空");
		return false;
	}

	m_volumeData->SetNMaxSize(nMaxSize);
	if(!m_volumeData->LoadDataFromFile(g_filePath.c_str()))
	{
		ShowMessage("读取文件错误");
	}
	//第二步
	//设置数据(只有一次设置,其他用attach)
	m_processorList[0]->SetData(m_volumeData->GetDataArray());
	for(int i=1;i<(int)m_processorList.size();i++)
	{
		m_processorList[i]->AttachArray(m_processorList[0]->GetOriginalData(),
			m_processorList[0]->GetProcessDataArray());
	}
	//for(int i=0;i<m_processorList.size();i++)
	//{
		//m_processorList[i]->Process();
	//}
	//这里有glewinit需要先处理
	SetRendererAndProcessor(0);

	m_bPauseDrawing = false;
	m_loadFirstTime = false;

	return true;
}
コード例 #11
0
bool HumanClientApp::ToggleFullscreen() {
    bool fs = GetOptionsDB().Get<bool>("fullscreen");
    GetOptionsDB().Set<bool>("fullscreen", !fs);
    Reinitialize();
    return true;
}
コード例 #12
0
ファイル: mesh.cpp プロジェクト: ptitSeb/Eldritch
void Mesh::Reinitialize(Mesh* pMesh) {
  if (pMesh) {
    Reinitialize(pMesh->m_VertexBuffer, pMesh->m_VertexDeclaration,
                 pMesh->m_IndexBuffer, pMesh->m_Bones);
  }
}
コード例 #13
0
// Pick a sequence for the given activity. If the current sequence is appropriate for the 
// current activity, and its stored weight is negative (whatever that means), always select
// it. Otherwise perform a weighted selection -- imagine a large roulette wheel, with each
// sequence having a number of spaces corresponding to its weight.
int CStudioHdr::CActivityToSequenceMapping::SelectWeightedSequence( CStudioHdr *pstudiohdr, int activity, int curSequence )
{
	if (!ValidateAgainst(pstudiohdr))
	{
		AssertMsg1(false, "CStudioHdr %s has changed its vmodel pointer without reinitializing its activity mapping! Now performing emergency reinitialization.", pstudiohdr->pszName());
		ExecuteOnce(DebuggerBreakIfDebugging());
		Reinitialize(pstudiohdr);
	}

	// a null m_pSequenceTuples just means that this studio header has no activities.
	if (!m_pSequenceTuples)
		return ACTIVITY_NOT_AVAILABLE;

	// is the current sequence appropriate?
	if (curSequence >= 0)
	{
		mstudioseqdesc_t &seqdesc = pstudiohdr->pSeqdesc( curSequence );

		if (seqdesc.activity == activity && seqdesc.actweight < 0)
			return curSequence;
	}

	// get the data for the given activity
	HashValueType dummy( activity, 0, 0, 0 );
	UtlHashHandle_t handle = m_ActToSeqHash.Find(dummy);
	if (!m_ActToSeqHash.IsValidHandle(handle))
	{
		return ACTIVITY_NOT_AVAILABLE;
	}
	const HashValueType * __restrict actData = &m_ActToSeqHash[handle];

	int weighttotal = actData->totalWeight;
	// generate a random number from 0 to the total weight
	int randomValue;
	if ( IsInPrediction() )
	{
		randomValue = SharedRandomInt( "SelectWeightedSequence", 0, weighttotal - 1 );
	}
	else
	{
		randomValue = RandomInt( 0, weighttotal - 1 );
	}

	// chug through the entries in the list (they are sequential therefore cache-coherent)
	// until we run out of random juice
	SequenceTuple * __restrict sequenceInfo = m_pSequenceTuples + actData->startingIdx;

	const SequenceTuple *const stopHere = sequenceInfo + actData->count; // this is a backup 
		// in case the weights are somehow miscalculated -- we don't read or write through
		// it (because it aliases the restricted pointer above); it's only here for 
		// the comparison.

	while (randomValue >= sequenceInfo->weight && sequenceInfo < stopHere)
	{
		randomValue -= sequenceInfo->weight;
		++sequenceInfo;
	}

	return sequenceInfo->seqnum;

}
AuthorizationSet::AuthorizationSet(const AuthorizationSet& set)
    : Serializable(), elems_(NULL), indirect_data_(NULL) {
    Reinitialize(set.elems_, set.elems_size_);
}
コード例 #15
0
ファイル: UnrealPak.cpp プロジェクト: colwalder/unrealengine
bool FCompressedFileBuffer::CompressFileToWorkingBuffer(const FPakInputPair& InFile, uint8*& InOutPersistentBuffer, int64& InOutBufferSize, ECompressionFlags CompressionMethod, const int32 CompressionBlockSize)
{
	TAutoPtr<FArchive> FileHandle(IFileManager::Get().CreateFileReader(*InFile.Source));
	if(!FileHandle.IsValid())
	{
		TotalCompressedSize = 0;
		return false;
	}

	Reinitialize(FileHandle.GetOwnedPointer(), CompressionMethod, CompressionBlockSize);
	const int64 FileSize = OriginalSize;
	const int64 PaddedEncryptedFileSize = Align(FileSize,FAES::AESBlockSize);
	if(InOutBufferSize < PaddedEncryptedFileSize)
	{
		InOutPersistentBuffer = (uint8*)FMemory::Realloc(InOutPersistentBuffer,PaddedEncryptedFileSize);
		InOutBufferSize = FileSize;
	}

	// Load to buffer
	FileHandle->Serialize(InOutPersistentBuffer,FileSize);

	// Build buffers for working
	int64 UncompressedSize = FileSize;
	int32 CompressionBufferSize = Align(FCompression::CompressMemoryBound(CompressionMethod,CompressionBlockSize),FAES::AESBlockSize);
	EnsureBufferSpace(Align(FCompression::CompressMemoryBound(CompressionMethod,FileSize),FAES::AESBlockSize));


	TotalCompressedSize = 0;
	int64 UncompressedBytes = 0;
	int32 CurrentBlock = 0;
	while(UncompressedSize)
	{
		int32 BlockSize = (int32)FMath::Min<int64>(UncompressedSize,CompressionBlockSize);
		int32 CompressedBlockSize = CompressionBufferSize;
		FileCompressionBlockSize = FMath::Max<uint32>(BlockSize, FileCompressionBlockSize);
		EnsureBufferSpace(TotalCompressedSize+CompressedBlockSize);
		if(!FCompression::CompressMemory(CompressionMethod,CompressedBuffer.Get()+TotalCompressedSize,CompressedBlockSize,InOutPersistentBuffer+UncompressedBytes,BlockSize))
		{
			return false;
		}
		UncompressedSize -= BlockSize;
		UncompressedBytes += BlockSize;

		CompressedBlocks[CurrentBlock].CompressedStart = TotalCompressedSize;
		CompressedBlocks[CurrentBlock].CompressedEnd = TotalCompressedSize+CompressedBlockSize;
		++CurrentBlock;

		TotalCompressedSize += CompressedBlockSize;

		if(InFile.bNeedEncryption)
		{
			int32 EncryptionBlockPadding = Align(TotalCompressedSize,FAES::AESBlockSize);
			for(int64 FillIndex=TotalCompressedSize; FillIndex < EncryptionBlockPadding; ++FillIndex)
			{
				// Fill the trailing buffer with random bytes from file
				CompressedBuffer.Get()[FillIndex] = CompressedBuffer.Get()[rand()%TotalCompressedSize];
			}
			TotalCompressedSize += EncryptionBlockPadding - TotalCompressedSize;
		}
	}

	return true;
}
コード例 #16
0
ファイル: loads_test.cpp プロジェクト: vadz/lmi
 void Recalculate () {Reinitialize(); Calculate();}
コード例 #17
0
ファイル: WindowManager.cpp プロジェクト: Rocks25/Voa
void WindowManager::SetWindowedMode(SDL_Rect Mode)
{
	_CurrentWMode=Mode;

	Reinitialize();
}
コード例 #18
0
ファイル: MMDeviceAudioSource.cpp プロジェクト: ArtBears/OBS
bool MMDeviceAudioSource::GetNextBuffer(void **buffer, UINT *numFrames, QWORD *timestamp)
{
    UINT captureSize = 0;
    bool bFirstRun = true;
    HRESULT hRes;
    UINT64 devPosition, qpcTimestamp;
    LPBYTE captureBuffer;
    UINT32 numFramesRead;
    DWORD dwFlags = 0;

    if (deviceLost) {
        QWORD timeVal = GetQPCTimeMS();
        QWORD timer = (timeVal - reinitTimer);
        if (timer > 1000) {
            if (Reinitialize()) {
                Log(L"Device '%s' reacquired.", strDeviceName.Array());
                StartCapture();
            }
            reinitTimer = timeVal;
        }

        return false;
    }

    while (true) {
        if (inputBufferSize >= sampleWindowSize*GetChannelCount()) {
            if (bFirstRun)
                lastQPCTimestamp += 10;
            firstTimestamp = GetTimestamp(lastQPCTimestamp);
            break;
        }

        //---------------------------------------------------------

        hRes = mmCapture->GetNextPacketSize(&captureSize);

        if (FAILED(hRes)) {
            if (hRes == AUDCLNT_E_DEVICE_INVALIDATED) {
                FreeData();
                deviceLost = true;
                Log(L"Audio device '%s' has been lost, attempting to reinitialize", strDeviceName.Array());
                reinitTimer = GetQPCTimeMS();
                return false;
            }

            RUNONCE AppWarning(TEXT("MMDeviceAudioSource::GetBuffer: GetNextPacketSize failed, result = %08lX"), hRes);
            return false;
        }

        if (!captureSize)
            return false;

        //---------------------------------------------------------

        hRes = mmCapture->GetBuffer(&captureBuffer, &numFramesRead, &dwFlags, &devPosition, &qpcTimestamp);

        if (FAILED(hRes)) {
            RUNONCE AppWarning(TEXT("MMDeviceAudioSource::GetBuffer: GetBuffer failed, result = %08lX"), hRes);
            return false;
        }

        UINT totalFloatsRead = numFramesRead*GetChannelCount();

        if (inputBufferSize) {
            double timeAdjust = double(inputBufferSize/GetChannelCount());
            timeAdjust /= (double(GetSamplesPerSec())*0.0000001);

            qpcTimestamp -= UINT64(timeAdjust);
        }

        qpcTimestamp /= 10000;
        lastQPCTimestamp = qpcTimestamp;

        //---------------------------------------------------------

        UINT newInputBufferSize = inputBufferSize + totalFloatsRead;
        if (newInputBufferSize > inputBuffer.Num())
            inputBuffer.SetSize(newInputBufferSize);

        mcpy(inputBuffer.Array()+inputBufferSize, captureBuffer, totalFloatsRead*sizeof(float));
        inputBufferSize = newInputBufferSize;

        mmCapture->ReleaseBuffer(numFramesRead);

        bFirstRun = false;
    }

    *numFrames = sampleWindowSize;
    *buffer = (void*)inputBuffer.Array();
    *timestamp = firstTimestamp;

    /*if (bIsMic) {
        static QWORD lastTimestamp = 0;
        if (firstTimestamp != lastTimestamp+10)
            Log(TEXT("A: %llu, difference: %llu"), firstTimestamp, firstTimestamp-lastTimestamp);

        lastTimestamp = firstTimestamp;
    }*/

    return true;
}
コード例 #19
0
ファイル: animation.cpp プロジェクト: detoxhby/lambdawars
int CStudioHdr::CActivityToSequenceMapping::SelectWeightedSequenceFromModifiers( CStudioHdr *pstudiohdr, int activity, CUtlSymbol *pActivityModifiers, int iModifierCount )
{
	if ( !pstudiohdr->SequencesAvailable() )
	{
		return ACTIVITY_NOT_AVAILABLE;
	}

	VerifySequenceIndex( pstudiohdr );

	if ( pstudiohdr->GetNumSeq() == 1 )
	{
		return ( ::GetSequenceActivity( pstudiohdr, 0, NULL ) == activity ) ? 0 : ACTIVITY_NOT_AVAILABLE;
	}

	if (!ValidateAgainst(pstudiohdr))
	{
		AssertMsg1(false, "CStudioHdr %s has changed its vmodel pointer without reinitializing its activity mapping! Now performing emergency reinitialization.", pstudiohdr->pszName());
		ExecuteOnce(DebuggerBreakIfDebugging());
		Reinitialize(pstudiohdr);
	}

	// a null m_pSequenceTuples just means that this studio header has no activities.
	if (!m_pSequenceTuples)
		return ACTIVITY_NOT_AVAILABLE;

	// get the data for the given activity
	HashValueType dummy( activity, 0, 0, 0 );
	UtlHashHandle_t handle = m_ActToSeqHash.Find(dummy);
	if (!m_ActToSeqHash.IsValidHandle(handle))
	{
		return ACTIVITY_NOT_AVAILABLE;
	}
	const HashValueType * __restrict actData = &m_ActToSeqHash[handle];

	// go through each sequence and give it a score
	int top_score = -1;
	CUtlVector<int> topScoring( actData->count, actData->count );	
	for ( int i = 0; i < actData->count; i++ )
	{
		SequenceTuple * __restrict sequenceInfo = m_pSequenceTuples + actData->startingIdx + i;
		int score = 0;
		// count matching activity modifiers
		for ( int m = 0; m < iModifierCount; m++ )
		{
			int num_modifiers = sequenceInfo->iNumActivityModifiers;
			for ( int k = 0; k < num_modifiers; k++ )
			{
				if ( sequenceInfo->pActivityModifiers[ k ] == pActivityModifiers[ m ] )
				{
					score++;
					break;
				}
			}
		}
		if ( score > top_score )
		{
			topScoring.RemoveAll();
			topScoring.AddToTail( sequenceInfo->seqnum );
			top_score = score;
		}
	}

	// randomly pick between the highest scoring sequences ( NOTE: this method of selecting a sequence ignores activity weights )
	if ( IsInPrediction() )
	{
		return topScoring[ SharedRandomInt( "SelectWeightedSequence", 0, topScoring.Count() - 1 ) ];
	}
	
	return topScoring[ RandomInt( 0, topScoring.Count() - 1 ) ];
}