bool CLeadingPropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CLeadingProp* pEffectUnitProp = (CLeadingProp*)(handle); CBufFile tData( inData.GetBuffer(), inData.GetSize() ); tData.SafeRead( (char*)&pEffectUnitProp->m_eTextOp, sizeof(SPR_BLENDOP) ); tData.SafeRead( (char*)&pEffectUnitProp->m_JumpSpeed, sizeof(int32) ); tData.SafeRead( (char*)&pEffectUnitProp->m_JumpNum, sizeof(int32) ); tData.SafeRead( (char*)&pEffectUnitProp->m_eLType, sizeof(CLeadingProp::eLP_LKType) ); tData.SafeRead( (char*)&pEffectUnitProp->m_eSSType, sizeof(CLeadingProp::eLP_StartScr) ); tData.SafeRead( (char*)&pEffectUnitProp->m_fStartAngle, sizeof(float) ); tData.SafeRead( (char*)&pEffectUnitProp->m_fRotSpeed, sizeof(float) ); tData.SafeRead( (char*)&pEffectUnitProp->m_fUVSpeed, sizeof(float) ); tData.SafeRead( (char*)&pEffectUnitProp->m_nPieceCount, sizeof(uint32) ); tData.SafeRead( (char*)&pEffectUnitProp->m_nDouCount, sizeof(uint32) ); tData.SafeRead( (char*)&pEffectUnitProp->m_fDouPercent, sizeof(float) ); tData.SafeRead( (char*)&pEffectUnitProp->m_fDouInterval, sizeof(float) ); tData.SafeRead( (char*)&pEffectUnitProp->m_eBlendModel, sizeof(SPR_BLENDMODE) ); tData.SafeRead( (char*)&pEffectUnitProp->m_eZTest, sizeof(Z_TEST) ); tData.SafeRead( (char*)&pEffectUnitProp->m_bLightEnable, sizeof(BOOL) ); tData.SafeRead( (char*)&pEffectUnitProp->m_fZBias, sizeof(float) ); CDataChunk tChunk; tData.SafeRead(&tChunk.GetHdr(),sizeof(CDataChunk::ChunkHdr)); ReadChunk(tData,tChunk); _DoDecode(tChunk,pEffectUnitProp); return true; }
bool CSpritePropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CSpriteProp* pEffectUnitProp = (CSpriteProp*)(handle); CBufFile tData( inData.GetBuffer(), inData.GetSize() ); tData.SafeRead(&pEffectUnitProp->m_BirthTime, sizeof(int) ); tData.SafeRead(&pEffectUnitProp->m_DeleteTime, sizeof(int) ); tData.SafeRead(&pEffectUnitProp->m_eTextOp, sizeof(SPR_BLENDOP) ); LoadMapValueSafe( tData, pEffectUnitProp->m_UVRCenter ); LoadMapValueSafe( tData, pEffectUnitProp->m_XYZcale ); tData.SafeRead(&pEffectUnitProp->m_fStartAngle, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fWidthRatio, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fZBias, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_vecRotate, sizeof(CVector3f) ); tData.SafeRead(&pEffectUnitProp->m_vecNormal, sizeof(CVector3f) ); tData.SafeRead(&pEffectUnitProp->m_fMinSize, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fMaxSize, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_eFaceType, sizeof(SPR_FACE) ); tData.SafeRead(&pEffectUnitProp->m_eBlendModel, sizeof(SPR_BLENDMODE) ); tData.SafeRead(&pEffectUnitProp->m_eZTest, sizeof(Z_TEST) ); tData.SafeRead(&pEffectUnitProp->m_bLightEnable, sizeof(BOOL) ); pEffectUnitProp->CaculateProp(); CDataChunk tChunk; tData.SafeRead(&tChunk.GetHdr(),sizeof(CDataChunk::ChunkHdr)); ReadChunk(tData,tChunk); _DoDecode(tChunk,pEffectUnitProp); return true; }
bool CLightningPropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CLightningProp* pEffectUnitProp = (CLightningProp*)(handle); CBufFile tData( inData.GetBuffer(), inData.GetSize() ); tData.SafeRead(&pEffectUnitProp->m_vecRotate, sizeof(CVector3f) ); tData.SafeRead(&pEffectUnitProp->m_vecNormal, sizeof(CVector3f) ); tData.SafeRead(&pEffectUnitProp->m_fStartAngle, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fWidthRatio, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fMinSize, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fMaxSize, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_vecSrc, sizeof(CVector3f) ); tData.SafeRead(&pEffectUnitProp->m_fDitherMax, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fDitherMin, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_nSubNum, sizeof(int) ); tData.SafeRead(&pEffectUnitProp->m_eFaceType, sizeof(SPR_FACE) ); tData.SafeRead(&pEffectUnitProp->m_eBlendModel, sizeof(SPR_BLENDMODE) ); tData.SafeRead(&pEffectUnitProp->m_eZTest, sizeof(Z_TEST) ); tData.SafeRead(&pEffectUnitProp->m_bLightEnable, sizeof(BOOL) ); tData.SafeRead(&pEffectUnitProp->m_fZBias, sizeof(float) ); CDataChunk tChunk; tData.SafeRead(&tChunk.GetHdr(),sizeof(CDataChunk::ChunkHdr)); ReadChunk(tData,tChunk); _DoDecode(tChunk,pEffectUnitProp); return true; }
bool CModelRenderStylePropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CModelRenderStyleProp* pEffectUnitProp = (CModelRenderStyleProp*)(handle); CBufFile tData( inData.GetBuffer(), inData.GetSize() ); LoadMapValueSafe(tData, pEffectUnitProp->m_ClipDistMap); tData.SafeRead(&pEffectUnitProp->m_ClipPlane.originPlane, sizeof(CPlane)); pEffectUnitProp->CaculateProp(); int32 n = 0; tData.SafeRead( (char*)&n, sizeof(int32) ); pEffectUnitProp->m_ApplyClass.resize(n); for( int32 i = 0; i < n; ++i ) LoadStringSafeT( tData, pEffectUnitProp->m_ApplyClass[i] ); tData.SafeRead(&pEffectUnitProp->m_SpecularColor, sizeof(CColor) ); tData.SafeRead(&pEffectUnitProp->m_vecTextMoveVel, sizeof(CVector2f) ); tData.SafeRead(&pEffectUnitProp->m_fTextAngularVel, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_bDiffuseAmbient, sizeof(BOOL) ); tData.SafeRead(&pEffectUnitProp->m_bSpecular, sizeof(BOOL) ); tData.SafeRead(&pEffectUnitProp->m_bSetTextureMatrix, sizeof(BOOL) ); CDataChunk tChunk; tData.SafeRead(&tChunk.GetHdr(),sizeof(CDataChunk::ChunkHdr)); ReadChunk(tData,tChunk); _DoDecode(tChunk,pEffectUnitProp); return true; }
bool CPolyTrailPropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CPolyTrailProp* pEffectUnitProp = (CPolyTrailProp*)(handle); CBufFile tData( inData.GetBuffer(), inData.GetSize() ); tData.SafeRead(&pEffectUnitProp->m_eTextOp, sizeof(SPR_BLENDOP)); tData.SafeRead(&pEffectUnitProp->m_fRefractIndex, sizeof(float)); tData.SafeRead(&pEffectUnitProp->m_DeclTime, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_Smooth, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_sRefSkelatal, sizeof(IDNAME) ); tData.SafeRead(&pEffectUnitProp->m_bSingleSide, sizeof(BOOL) ); tData.SafeRead(&pEffectUnitProp->m_eStrip, sizeof(POLY_TRAIL_TYPE) ); tData.SafeRead(&pEffectUnitProp->m_vecRotate, sizeof(CVector3f) ); tData.SafeRead(&pEffectUnitProp->m_MinTrailWidth, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_MaxTrailWidth, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_UnitLifeSpan, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_eBlendModel, sizeof(SPR_BLENDMODE) ); tData.SafeRead(&pEffectUnitProp->m_eZTest, sizeof(Z_TEST) ); tData.SafeRead(&pEffectUnitProp->m_bLightEnable, sizeof(BOOL) ); CDataChunk tChunk; tData.SafeRead(&tChunk.GetHdr(),sizeof(CDataChunk::ChunkHdr)); ReadChunk(tData,tChunk); _DoDecode(tChunk,pEffectUnitProp); return true; }
bool CModelConsolePropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CModelConsoleProp* pEffectUnitProp = (CModelConsoleProp*)(handle); CBufFile tData( inData.GetBuffer(), inData.GetSize() ); LoadStringSafeT( tData, pEffectUnitProp->m_SkeName ); tData.SafeRead(&pEffectUnitProp->m_BirthTime, sizeof(int) ); tData.SafeRead(&pEffectUnitProp->m_DeleteTime, sizeof(int) ); LoadMapValueSafe(tData, pEffectUnitProp->m_ClipDistMap); tData.SafeRead(&pEffectUnitProp->m_bEnableShadow, sizeof(bool) ); if (pEffectUnitProp->m_ClipPlane.originPlane.IsValid() && pEffectUnitProp->m_ClipDistMap.empty()) { pEffectUnitProp->m_ClipDistMap[0.0f] = -pEffectUnitProp->m_ClipPlane.originPlane.m_Dist; pEffectUnitProp->m_ClipDistMap[1.0f] = -pEffectUnitProp->m_ClipPlane.originPlane.m_Dist; } LoadMapValue(tData, pEffectUnitProp->m_mapRefract); tData.SafeRead(&pEffectUnitProp->m_ClipPlane.originPlane, sizeof(CPlane)); LoadMapValue( tData, pEffectUnitProp->m_XYZcale ); tData.SafeRead(&pEffectUnitProp->m_eFaceType, sizeof(SPR_FACE) ); LoadStringSafeT( tData, pEffectUnitProp->m_szParentSk ); tData.SafeRead(&pEffectUnitProp->m_nSkIdx, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_fMinYSize, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fMaxYSize, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fMinZSize, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fMaxZSize, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_vecTextMoveVel, sizeof(CVector2f) ); tData.SafeRead(&pEffectUnitProp->m_fTextAngularVel, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fTextMaxScale, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fTextMinScale, sizeof(float) ); LoadStringSafeT( tData, pEffectUnitProp->m_szARPName ); LoadStringSafeT( tData, pEffectUnitProp->m_szARAName ); tData.SafeRead(&pEffectUnitProp->m_vecRotate, sizeof(CVector3f) ); tData.SafeRead(&pEffectUnitProp->m_nPiece0, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_nRS0, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_nPiece1, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_nRS1, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_nPiece2, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_nRS2, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_nPiece3, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_nRS3, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_nPiece4, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_nRS4, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_nPiece5, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_nRS5, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_Animation, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_bSynch, sizeof(BOOL) ); tData.SafeRead(&pEffectUnitProp->m_fMinXSize, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fMaxXSize, sizeof(float) ); if(pEffectUnitProp->CaculateProp()) return false; CDataChunk tChunk; tData.SafeRead(&tChunk.GetHdr(),sizeof(CDataChunk::ChunkHdr)); ReadChunk(tData,tChunk); _DoDecode(tChunk,pEffectUnitProp); return true; }
void //处理接受数据 CUdpReceive::processTheDatagram( std::size_t bytesRecvd ) { QByteArray tData( m_cDataBuffer , bytesRecvd ); int id = StructId( m_cDataBuffer ); if( id != 1057 ) emit newData( tData ); if( id == 1003 ) emit newDISMonitor( tData ); if( id == 1002 ) emit newMotion( tData ); receiveData(); }
bool CCameraFilterPropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CBufFile tData( inData.GetBuffer(), inData.GetSize() ); CCameraFilterProp* pEffectUnitProp = (CCameraFilterProp*)(handle); tData.SafeRead(&pEffectUnitProp->m_bFilterParent,sizeof(bool)); tData.SafeRead(&pEffectUnitProp->m_eBlendModel,sizeof(SPR_BLENDMODE)); tData.SafeRead(&pEffectUnitProp->m_eZTest,sizeof(Z_TEST)); tData.SafeRead(&pEffectUnitProp->m_xScale,sizeof(float)); tData.SafeRead(&pEffectUnitProp->m_yScale,sizeof(float)); tData.SafeRead(&pEffectUnitProp->m_zScale,sizeof(float)); _DoDecode(inData,pEffectUnitProp); return true; }
bool CDynamicLightPropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CDynamicLightProp* pEffectUnitProp = (CDynamicLightProp*)(handle); CBufFile tData( inData.GetBuffer(), inData.GetSize() ); tData.SafeRead(&pEffectUnitProp->m_fRange, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fMinStrong, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fMaxStrong, sizeof(float) ); CDataChunk tChunk; tData.SafeRead(&tChunk.GetHdr(),sizeof(CDataChunk::ChunkHdr)); ReadChunk(tData,tChunk); _DoDecode(tChunk,pEffectUnitProp); return true; }
bool CTDimAudioPropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CTDimAudioProp* pEffectUnitProp = (CTDimAudioProp*)(handle); CBufFile tData( inData.GetBuffer(), inData.GetSize() ); tData.SafeRead( &pEffectUnitProp->m_bDelayStop, sizeof( bool ) ); tData.SafeRead( &pEffectUnitProp->m_fPlayProbability, sizeof( float ) ); LoadStringSafeT( tData, pEffectUnitProp->m_szAudioName ); CDataChunk tChunk; tData.SafeRead(&tChunk.GetHdr(),sizeof(CDataChunk::ChunkHdr)); ReadChunk(tData,tChunk); _DoDecode(tChunk,pEffectUnitProp); return true; }
bool CNullPropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CNullProp* pEffectUnitProp = (CNullProp*)(handle); CBufFile tData( inData.GetBuffer(), inData.GetSize() ); tData.SafeRead(&pEffectUnitProp->m_bDelay, sizeof(bool) ); tData.SafeRead(&pEffectUnitProp->m_vecRotate, sizeof(CVector3f) ); tData.SafeRead(&pEffectUnitProp->m_bFolowSpeed, sizeof(BOOL) ); CDataChunk tChunk; tData.SafeRead(&tChunk.GetHdr(),sizeof(CDataChunk::ChunkHdr)); ReadChunk(tData,tChunk); _DoDecode(tChunk,pEffectUnitProp); return true; }
bool CShakePropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CShakeProp* pEffectUnitProp = (CShakeProp*)(handle); CBufFile tData( inData.GetBuffer(), inData.GetSize() ); tData.SafeRead(&pEffectUnitProp->m_vecDirCtrl, sizeof(CVector3f) ); tData.SafeRead(&pEffectUnitProp->m_vecFrequence, sizeof(CVector3f) ); tData.SafeRead(&pEffectUnitProp->m_fStrength, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_isCtrlParent, sizeof(bool) ); CDataChunk tChunk; tData.SafeRead(&tChunk.GetHdr(),sizeof(CDataChunk::ChunkHdr)); ReadChunk(tData,tChunk); _DoDecode(tChunk,pEffectUnitProp); return true; }
bool CCameraShakePropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CBufFile tData( inData.GetBuffer(), inData.GetSize() ); CCameraShakeProp* pEffectUnitProp = (CCameraShakeProp*)(handle); tData.SafeRead(&pEffectUnitProp->m_fFrequence, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fStrength, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fMinRadius, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fMaxRadius, sizeof(float) ); CDataChunk tChunk; tData.SafeRead(&tChunk.GetHdr(),sizeof(CDataChunk::ChunkHdr)); ReadChunk(tData,tChunk); _DoDecode(tChunk,pEffectUnitProp); return true; }
bool sqr::CEditorSpotLightCoder::DeCode_1( const CDataChunk& inData , OBJ_HANDLE handle ) { CBufFile tData( inData.GetBuffer(), inData.GetSize() ); size_t size = 0; tData.SafeRead( &size, sizeof(size) ); for (size_t i = 0; i < size; ++i) { //tData.SafeRead( ®ionInfo, sizeof(regionInfo) ); CLoadMapResInfo::EditorOffsetInfo *pEditorOffsetInfo = new CLoadMapResInfo::EditorOffsetInfo; tData.SafeRead( pEditorOffsetInfo, sizeof(CLoadMapResInfo::EditorOffsetInfo) ); CLoadMapResInfo::GetInst()->vecEditorSpotLightOffsetInfo.push_back(pEditorOffsetInfo); } return true; }
bool CParticleSystemPropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CParticleSystemProp* pEffectUnitProp = (CParticleSystemProp*)(handle); CBufFile tData( inData.GetBuffer(), inData.GetSize() ); tData.SafeRead(&pEffectUnitProp->m_eTextOp, sizeof(SPR_BLENDOP) ); LoadMapValueSafe( tData, pEffectUnitProp->m_EmissionMinRadius ); LoadMapValueSafe( tData, pEffectUnitProp->m_EmissionMaxRadius ); LoadMapValueSafe(tData, pEffectUnitProp->m_ClipDistMap); tData.SafeRead(&pEffectUnitProp->m_ClipPlane.originPlane, sizeof(CPlane)); LoadMapValueSafe( tData, pEffectUnitProp->m_XYZcale ); tData.SafeRead(&pEffectUnitProp->m_fLongShortRadius, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fCornerDivision, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fLongShortDRadius, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fZBias, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_sRefSkelatal, sizeof(IDNAME) ); tData.SafeRead(&pEffectUnitProp->m_fWidthRatio, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fVelocityPercent, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_eTextDir, sizeof(CParticleSystemProp::ePS_TextureDir) ); tData.SafeRead(&pEffectUnitProp->m_nEmissionInterval, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_nParticlesPerEmission, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_fMinSize, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fMaxSize, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_vEmissionPlan, sizeof(CVector3f) ); tData.SafeRead(&pEffectUnitProp->m_vMinVelocity, sizeof(CVector3f) ); tData.SafeRead(&pEffectUnitProp->m_vMaxVelocity, sizeof(CVector3f) ); tData.SafeRead(&pEffectUnitProp->m_vAcceleration, sizeof(CVector3f) ); tData.SafeRead(&pEffectUnitProp->m_fMinAngularVelocity, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fMaxAngularVelocity, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_nMinLifeSpan, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_nMaxLifeSpan, sizeof(int32) ); tData.SafeRead(&pEffectUnitProp->m_fMinRadius, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_fMaxRadius, sizeof(float) ); tData.SafeRead(&pEffectUnitProp->m_eFollowType, sizeof(CParticleSystemProp::ePS_ParticlCoord) ); tData.SafeRead(&pEffectUnitProp->m_eEmissionType, sizeof(CParticleSystemProp::ePS_EMSType) ); tData.SafeRead(&pEffectUnitProp->m_eVelType, sizeof(CParticleSystemProp::ePS_VELType) ); tData.SafeRead(&pEffectUnitProp->m_eBlendModel, sizeof(SPR_BLENDMODE) ); tData.SafeRead(&pEffectUnitProp->m_eZTest, sizeof(Z_TEST) ); tData.SafeRead(&pEffectUnitProp->m_bLightEnable, sizeof(BOOL) ); CDataChunk tChunk; tData.SafeRead(&tChunk.GetHdr(),sizeof(CDataChunk::ChunkHdr)); ReadChunk(tData,tChunk); _DoDecode(tChunk,pEffectUnitProp); return true; }
bool CAgpCoder::DeCode_Agp( const CDataChunk& inData , OBJ_HANDLE handle ) { CAnimationGroup* pAniGroup = (CAnimationGroup*)handle; CBufFile tData( inData.GetBuffer(), inData.GetSize() ); int dataSize; tData.SafeRead((TCHAR*)&dataSize,sizeof(int)); pAniGroup->m_SkeName.resize(dataSize); tData.SafeRead((TCHAR*)pAniGroup->m_SkeName.data(), dataSize ); CSkeletalsMgr::GetInst()->GetSkeInPool( pAniGroup->m_SkeName.c_str(), &pAniGroup->m_pSke ); int Size; tData.SafeRead( &Size, sizeof(Size) ); pAniGroup->m_AnimationList.resize( Size, NULL ); pAniGroup->m_NameList.clear(); TCHAR szAniName[256]; TCHAR* szChild = szAniName + pAniGroup->m_szName.size() - 3; strncpy( szAniName, pAniGroup->m_szName.c_str(), pAniGroup->m_szName.size() - 4 ); szChild[-1] = '_'; CAnimate* pAnimate = NULL; GString strAniname; int i; for ( i = 0; i < (int)pAniGroup->m_AnimationList.size(); i++ ) { tData.SafeRead( szChild, sizeof(IDNAME) ); strAniname = szChild; IDNAME Name = *(IDNAME*)szChild; pAniGroup->m_NameList[szChild] = i; strcat( szChild, ".ani" ); pAnimate = CDataSources::GetInst()->NewAnimate(pAniGroup, szAniName, Name);//new CAnimate(this, szAniName, Name ); pAniGroup->m_AnimationList[i] = pAnimate; if(strAniname.find("stand")!=GString::npos)//这个地方以后要改,以后会在插件到处调整骨骼动画的加载顺序和批量处理老资源,现在临时在这里过滤下把stand在最先加载 pAniGroup->InsertAni(pAniGroup->m_AnimationList[i]); } pAniGroup->LoadNextAni(); pAniGroup->Release(); return true; }
bool CFlareSpritePropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CFlareSpriteProp* pEffectUnitProp = (CFlareSpriteProp*)(handle); CBufFile tData( inData.GetBuffer(), inData.GetSize() ); tData.SafeRead( &pEffectUnitProp->m_vecRotate, sizeof(CVector3f) ); tData.SafeRead( &pEffectUnitProp->m_vecNormal, sizeof(CVector3f) ); tData.SafeRead( &pEffectUnitProp->m_fMinSize, sizeof(float) ); tData.SafeRead( &pEffectUnitProp->m_fMaxSize, sizeof(float) ); tData.SafeRead( &pEffectUnitProp->m_eFaceType, sizeof(SPR_FACE) ); tData.SafeRead( &pEffectUnitProp->m_eBlendModel, sizeof(SPR_BLENDMODE) ); tData.SafeRead( &pEffectUnitProp->m_eZTest, sizeof(Z_TEST) ); tData.SafeRead( &pEffectUnitProp->m_bLightEnable, sizeof(BOOL) ); CDataChunk tChunk; tData.SafeRead(&tChunk.GetHdr(),sizeof(CDataChunk::ChunkHdr)); ReadChunk(tData,tChunk); _DoDecode(tChunk,pEffectUnitProp); return true; }
bool sqr::CEditorPointLightCoder::DeCode_1( const CDataChunk& inData , OBJ_HANDLE handle ) { CBufFile tData( inData.GetBuffer(), inData.GetSize() ); size_t size = 0; tData.SafeRead( &size, sizeof(size) ); for (size_t i = 0; i < size; ++i) { //tData.SafeRead( ®ionInfo, sizeof(regionInfo) ); CLoadMapResInfo::EditorOffsetInfo *pEditorOffsetInfo = new CLoadMapResInfo::EditorOffsetInfo; tData.SafeRead( pEditorOffsetInfo, sizeof(CLoadMapResInfo::EditorOffsetInfo) ); CLoadMapResInfo::GetInst()->vecEditorPointLightOffsetInfo.push_back(pEditorOffsetInfo); //DebugOut("Save vOffsetOverall %f, %f, %f\n", pEditorModelInfo->vOffsetOverall.x, pEditorModelInfo->vOffsetOverall.y, pEditorModelInfo->vOffsetOverall.z); } return true; }
globalStuff::gpuClocksStruct dFglrx::getClocks(){ QStringList out = globalStuff::grabSystemInfo("aticonfig --odgc --adapter=" + gpuIndex); // QFile f("/home/mm/odgc"); // f.open(QIODevice::ReadOnly); // QStringList out = QString(f.readAll()).split('\n'); // f.close(); globalStuff::gpuClocksStruct tData(-1); out = out.filter("Clocks"); if (!out.empty()) { QRegExp rx; rx.setPattern("\\s+\\d+\\s+\\d+"); rx.indexIn(out[0]); QStringList gData = rx.cap(0).trimmed().split(" "); tData.coreClk = gData[0].toInt(); tData.memClk = gData[1].toInt(); } return tData; }
bool CEffectUnitPropCoder::DeCode_EffectUnitProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CBufFile tData( inData.GetBuffer(), inData.GetSize() ); CEffectUnitProp* pEffectUnitProp = reinterpret_cast<CEffectUnitProp*>(handle); LoadStringSafeT( tData, pEffectUnitProp->m_szAttachName ); LoadStringSafeT( tData, pEffectUnitProp->m_CustomName ); LoadStringSafeT( tData, pEffectUnitProp->m_EffectClassName ); int32 Size = 0; pEffectUnitProp->m_szAniName.clear(); tData.SafeRead(&Size,sizeof(int32)); for( int32 i = 0; i < Size; ++i ) { EString szStr = ""; LoadStringSafeT( tData, szStr ); pEffectUnitProp->m_szAniName.insert( szStr ); } tData.SafeRead(&pEffectUnitProp->m_bSlownDisappear,sizeof(bool)); tData.SafeRead(&pEffectUnitProp->m_isUseVel,sizeof(bool)); tData.SafeRead(&pEffectUnitProp->m_EffectLod,sizeof(float)); tData.SafeRead(&pEffectUnitProp->m_TimeRange,sizeof(int32)); tData.SafeRead(&pEffectUnitProp->m_eUpdatePos,sizeof(eUpdatePosType)); tData.SafeRead(&pEffectUnitProp->m_nTextureCircle, sizeof(int32)); LoadMapValueSafe( tData, pEffectUnitProp->m_vecOffset ); LoadMapValueSafe( tData, pEffectUnitProp->m_Color ); LoadMapValueSafe( tData, pEffectUnitProp->m_Scale ); tData.SafeRead(&Size, sizeof( int32 ) ); for( int32 i = 0; i < Size; ++i ) { float fPos = 0.0f; EString szStr = ""; tData.SafeRead(&fPos, sizeof(float)); LoadStringSafeT( tData, szStr ); pEffectUnitProp->m_TextName[fPos] = szStr; } return true; }
bool CAniCoder::DeCode_Ani( const CDataChunk& inData , OBJ_HANDLE handle ) { CBufFile tData( inData.GetBuffer(), inData.GetSize() ); CAnimate* pAni = (CAnimate*)handle; if ( pAni->m_szName.empty() ) return false; pAni->m_fScale = 1.0f; pAni->m_FrameRatio = 33.3f; tData.SafeRead( &pAni->m_MaxFrame, sizeof(pAni->m_MaxFrame) ); tData.SafeRead( (char*)&pAni->m_FrameRatio, sizeof(pAni->m_FrameRatio) ); tData.SafeRead( (char*)&pAni->m_fScale, sizeof(pAni->m_fScale) ); tData.SafeRead( (char*)&pAni->m_fTransParam, sizeof(float) ); tData.SafeRead( (char*)&pAni->m_GroundSpeed, sizeof(float) ); tData.SafeRead( (char*)&pAni->m_IsCpAni,sizeof(bool)); int Size; tData.SafeRead( &Size, sizeof(Size) ); pAni->m_SkeletalList.resize( Size ); /*if(pAni->m_IsCpAni) { for ( int i = 0; i < (int)pAni->m_SkeletalList.size(); i++ ) { if ( pAni->m_MaxFrame < 256 ) pAni->m_SkeletalList[i] = pAni->_NewKeyFrames8(); else pAni->m_SkeletalList[i] = pAni->_NewKeyFrames16(); pAni->m_SkeletalList[i]->BinLoad( tData ,pAni->m_fTransParam); } } else { for ( int i = 0; i < (int)pAni->m_SkeletalList.size(); i++ ) { if ( pAni->m_MaxFrame < 256 ) pAni->m_SkeletalList[i] = pAni->_NewKeyFrames8(); else pAni->m_SkeletalList[i] = pAni->_NewKeyFrames16(); pAni->m_SkeletalList[i]->BinLoadFull( tData ); } }*/ tData.SafeRead( &Size, sizeof(Size) ); for ( int i = 0; i < Size; i++ ) { WORD FrameNO; IDNAME Name; tData.SafeRead( ( &FrameNO ), sizeof( WORD ) ); tData.SafeRead( ( &Name ), sizeof( IDNAME ) ); pAni->m_FrameString[ FrameNO ] = Name; } pAni->m_szName = ""; pAni->GetRootGroup()->LoadNextAni(); pAni->Release(); return true; }
// ###################################################################### // open a testing file containing images and corresponding ground truth void setupCases(std::string folder, std::string fname, bool equalize) { char comment[200]; FILE *fp; char inLine[100]; // open a file that lists the sample with ground truth std::string name = folder + fname; if((fp = fopen(name.c_str(),"rb")) == NULL) { LINFO("samples file: %s not found", name.c_str()); // input and output vector out.resize(0); in.resize(0); nSamples = 0; return; } LINFO("tName: %s",name.c_str()); // get number of samples if (fgets(inLine, 1000, fp) == NULL) LFATAL("fgets failed"); sscanf(inLine, "%d %s", &nSamples, comment); // the number of categories -> has to agree with the training file uint tNout; if (fgets(inLine, 1000, fp) == NULL) LFATAL("fgets failed"); sscanf(inLine, "%d %s", &tNout, comment); if(tNout != info->nOutput) LFATAL("Num categories differ: %d != %d", tNout, info->nOutput); // get the type of ground truth char gtOpt[100]; int gtType = -1; if (fgets(inLine, 1000, fp) == NULL) LFATAL("fgets failed"); sscanf(inLine, "%s %s", gtOpt, comment); if(strcmp(gtOpt,"ABSOLUTE") == 0) gtType = ABSOLUTE; else if(strcmp(gtOpt,"MIXTURE" ) == 0) gtType = MIXTURE; else LFATAL("unknown ground truth type %s",gtOpt); // set up the size input and output vector out.resize(nSamples); in.resize(nSamples); // skip column headers if (fgets(inLine, 1000, fp) == NULL) LFATAL("fgets failed"); char cName[100]; char sName[100]; char iName[100]; char ext[100]; int cStart, cNum; int gTruth; FILE *ifp; int count = 0; int tSamples = 0; std::vector<uint> nSamples; while(fgets(inLine, 1000, fp) != NULL) { if(gtType == ABSOLUTE) { // get the files in this category and ground truth sscanf(inLine, "%s %d %d %d %s", cName, &cStart, &cNum, &gTruth, ext); sprintf(sName,"%s%s", folder.c_str(), cName); printf(" sName: %s %d %d %d %s\n",sName, cStart, cNum, gTruth, ext); } else if(gtType == MIXTURE) { // get the files in this category and ground truth //char tStr[300]; //sscanf(inLine, "%s %d %d %s %s", cName, &cStart, &cNum, tStr, ext); //sprintf(sName,"%s%s", folder, cName); //printf(" sName: %s %d %d %d %s\n",sName, cStart, cNum, gTruth, ext); // change to mixture values LFATAL("MIXTURE ground truth type not yet implemented"); } else LFATAL("unknown ground truth type %s",gtOpt); nSamples.push_back(cNum); // go through every sample for(int j = cStart; j < cStart+cNum; j++) { tSamples++; // get the corresponding vector file (if exist) sprintf(iName,"%s%06d%s", sName,j,ext); // open the file if((ifp = fopen(iName,"rb")) != NULL) { Image<double> tData(1,info->oriFeatSize, NO_INIT); Image<double>::iterator aptr = tData.beginw(); for(int i = 0; i < tData.getSize(); i++) { double val; if (fread(&val, sizeof(double), 1, ifp) != 1) LFATAL("fread failed"); *aptr++ = val; } LINFO("feature file found: %s (%d)",//%7.4f %7.4f %7.4f %7.4f\n", iName,gTruth);//,tData[0], tData[21], tData[42], tData[63]); fclose(ifp); // calculate the reduced features if(info->isPCA) in[count] = matrixMult(pcaIcaMatrix, tData); else in[count] = tData; // load the ground truth if(gtType == ABSOLUTE) { Image<double> res(1,info->nOutput, ZEROS); res.setVal(0, gTruth, 1.0); out[count] = res; } else if(gtType == MIXTURE) { LFATAL("MIXTURE ground truth type not yet implemented"); } else LFATAL("unknown ground truth type %s",gtOpt); // // just to test stuff // for(int k = 0; k < info->oriFeatSize; k++) // printf("ori[%7d]: %f \n", k, tData.getVal(k)); // printf("\n"); // for(int k = 0; k < info->redFeatSize; k++) // printf("red[%7d]: %f \n", k, in[count].getVal(k)); // printf("\n"); // //for(uint k = 0; k < info->nOutput; k++) // // printf("%f \n",out[count].getVal(k)); // Raster::waitForKey(); count++; } else LFATAL("file: %s not found\n",iName); } } // equalize the number of samples if requested if(equalize) { // find the max uint max = 0; // for(uint i = 0; i < nSamples.size(); i++) // if(max < nSamples[i]) max = nSamples[i]; max = *max_element(nSamples.begin(),nSamples.end()); LINFO("max element: %d", max); uint offset = 0; for(uint i = 0; i < nSamples.size(); i++) { LINFO("extra samples for class[%3d]: %d - %d -> %d", i, max, nSamples[i], max - nSamples[i]); for(uint j = 0; j < max - nSamples[i]; j++) { // index to be copied uint index = rand()/(RAND_MAX + 1.0) * nSamples[i]; LINFO("[%d] Duplicating class[%3d] sample[%3d]" " -> actual ind: %3d", j, i, index, index + offset); index = index + offset; in.push_back(in[index]); out.push_back(out[index]); } offset += nSamples[i]; } LINFO("Total samples before equalized: %d \n",tSamples); tSamples = in.size(); } LINFO("Actual total samples: %d \n",tSamples); fclose(fp); }
bool CEffectPropCoder::DeCode_EffectProp( const CDataChunk& inData , OBJ_HANDLE handle ) { CBufFile tData( inData.GetBuffer(), inData.GetSize() ); CEffectGroup* pGroup = reinterpret_cast<CEffectGroup*>(handle); string strEffect; int Size; tData.SafeRead(&Size, sizeof(int)); EVector<char> temp(Size + 1, 0); tData.SafeRead(&temp.front(), Size); strEffect = &temp.front(); EMap< EString, CEffectProp* >::iterator iter = pGroup->m_EffectProps.find(strEffect.c_str()); if( iter == pGroup->m_EffectProps.end() ) pGroup->m_EffectProps[strEffect.c_str()] = pGroup->CreateEffectPropFun(strEffect.c_str()); else { EString Err = "特效文件:" + pGroup->m_szName + "存在同名轨道"; GfkLogErr(Err.c_str()); } CEffectProp* pEffectProp = pGroup->m_EffectProps[strEffect.c_str()]; int TrackSize = 0; tData.SafeRead( (char*)&TrackSize, sizeof(int) ); for( int i = 0; i < TrackSize; ++i )//每个特效里面有多少个轨道 { EMap< int, IEffectUnitProp* > CurTrack; int KeySize = 0; tData.SafeRead( (char*)&KeySize, sizeof(int) ); for( int j = 0; j < KeySize; ++j )//每个轨道里面有多少个特效单元 { int Pos = 0; tData.SafeRead( (char*)&Pos, sizeof(int) ); int Len = 0; GUID ClassID; UINT ID; char Desc[1024]; tData.SafeRead( (char*)&ClassID, sizeof(GUID) ); tData.SafeRead( (char*)&Len, sizeof(int) ); tData.SafeRead( (char*)Desc, Len ); tData.SafeRead( (char*)&ID, sizeof(UINT) ); Pos = max(0,Pos); IEffectUnitProp* pEffectUnitProp = ( (CEffectManager*)(pEffectProp->m_pEffectMgr) )->CreateEffectUnitProp( ClassID, ID ); if( pEffectUnitProp == NULL ) { Desc[Len] = 0; EString str = "无法找到相应的DLL,DLL描述:"; str += Desc; printf( ( str + "错误提示" ).c_str() ); return false; } static_cast<CEffectUnitProp*>(pEffectUnitProp)->m_pEffectProp = pEffectProp; CDataChunk tChunk; tData.SafeRead(&tChunk.GetHdr(),sizeof(CDataChunk::ChunkHdr)); ReadChunk(tData,tChunk); _DoDecode(tChunk,pEffectUnitProp); CurTrack[Pos] = pEffectUnitProp; tData.SafeRead( (char*)&pEffectProp->m_AttachKey[pEffectUnitProp].nTrack, sizeof(int) ); tData.SafeRead( (char*)&pEffectProp->m_AttachKey[pEffectUnitProp].nKeyStartTime, sizeof(int) ); } pEffectProp->m_Tracks.push_back(CurTrack); } tData.SafeRead(&pEffectProp->m_TimeRange, sizeof(int)); pEffectProp->m_AttachAniName.clear(); int Num = 0; tData.SafeRead(&Num, sizeof(int) ); for( int i = 0; i < Num; ++i ) { EString strTemp; LoadStringSafeT(tData,strTemp); pEffectProp->m_AttachAniName.push_back( strTemp ); } LoadStringSafeT( tData, pEffectProp->m_UserDesc ); tData.SafeRead(&pEffectProp->m_bFrameSynch,sizeof(bool)); pEffectProp->LoadFullRes(); return true; }