void CBE_ExplosionSmoke::InitCopyEntity( CCopyEntity* pCopyEnt ) { InitParticleSetEntity( *pCopyEnt ); SBE_ParticleSetExtraData& rParticleSet = GetExtraData( pCopyEnt->iExtraDataIndex ); Vector3& rvDir = pCopyEnt->GetDirection(); Vector3 vRandDir; float fDist, fRandSpeed; float fRandVelMin = m_fRandVelocityMin; float fRandVelMax = m_fRandVelocityMax; float fRandPositionMin = m_fRandPositionMin; float fRandPositionMax = m_fRandPositionMax; int i, iNumParticles = m_MaxNumParticlesPerSet; rParticleSet.iNumParticles = iNumParticles; int iNumPatterns = m_iNumTextureSegments * m_iNumTextureSegments * 4 - 1; if( m_ParticleType == TYPE_SMOKE_SHOOTING) { for(i=0; i<iNumParticles; i++) { rParticleSet.pavOrigDirection[i] = rvDir; vRandDir = Vec3RandDir(); rParticleSet.pavPosition[i] = pCopyEnt->GetWorldPosition(); rParticleSet.pavVelocity[i] = vRandDir * RangedRand( 0.05f, 0.50f) + rvDir * RangedRand( 0.1f, 12.0f); rParticleSet.pafAnimationTime[i] = RangedRand( m_fAnimTimeOffsetMin, m_fAnimTimeOffsetMax ); rParticleSet.pasPattern[i] = RangedRand( iNumPatterns ); rParticleSet.pafFadeVel[i] = RangedRand( 1.6f, 2.0f ); } } else // i.e. TYPE_SMOKE_NORMAL or TYPE_SMOKE_DIRECTIONAL { for(i=0; i<iNumParticles; i++) { vRandDir = Vec3RandDir(); fRandSpeed = RangedRand( 0.8f ); fDist = RangedRand( fRandPositionMin, fRandPositionMax ); rParticleSet.pavPosition[i] = pCopyEnt->GetWorldPosition() + vRandDir * fDist + rvDir * (0.8f - fRandSpeed) * 0.3f; rParticleSet.pavVelocity[i] = vRandDir * RangedRand( fRandVelMin, fRandVelMax ) + rvDir * fRandSpeed; rParticleSet.pafAnimationTime[i] = RangedRand( m_fAnimTimeOffsetMin, m_fAnimTimeOffsetMax ); rParticleSet.pasPattern[i] = RangedRand( iNumPatterns ); } } }
std::string CalendarAction::GetDebugString() const { std::ostringstream data; data << "CalendarAction::" << " Action: " << GetAction() << " Guid: " << GetPlayer()->GetGUID() << " Invite Id: " << GetInviteId() << " Extra data: " << GetExtraData() << " Event: " << Event.GetDebugString() << " Invite: " << Invite.GetDebugString(); return data.str(); }
void Gn2DMeshObject::SetVectorExtraDataScale() { float* point; GnVector2ExtraData* vector2Extra; for( gtuint i = 0; i < GetExtraDataSize(); i++ ) { vector2Extra = GnDynamicCast( GnVector2ExtraData, GetExtraData( i ) ); if( vector2Extra ) { point = vector2Extra->GetValue(); point[0] *= GetGameState()->GetGameScale(); point[1] *= GetGameState()->GetGameScale(); } } }
void Gn2DMeshObject::SetVectorExtraDataFlipX() { if( GetAVData() && GetAVData()->GetCollisionCount() ) { float* point; GnVector2ExtraData* vector2Extra; for( gtuint i = 0; i < GetExtraDataSize(); i++ ) { vector2Extra = GnDynamicCast( GnVector2ExtraData, GetExtraData( i ) ); if( vector2Extra ) { Gn2DAVData::CollisionRect& baseRect = GetAVData()->GetOriginalCollisionRect( 0 ); float flip = baseRect.mRect.left + baseRect.mRect.right; point = vector2Extra->GetValue(); point[0] = flip - point[0]; vector2Extra->SetValue( point ); } } } }
bool TTreeView::DoMouseDown(Point where, short flags) { XRect r,t; long len; long x,y; long h; long i; short lh,lt; short it; TableDrawRecord tr; short at; TreeEventRecord tevent; XGDraw draw(this); draw.SetFont(XGFont::LoadFont(1)); if (!fDrawFlag) EnableDrawing(); SetFocus(); tevent.ev_flags = flags; /* * Get the drawing parameters so I know where these are */ r = GetContentRect(); GetScrollParams(&x,&y,&h); x *= h; len = (r.bottom - r.top + h - 1) / h; len += y; if (len > fLength) len = fLength; lh = draw.GetFontHeight(); // lh == line height lt = (h-1-lh)/2; // lt == line top (of label) it = (h-17)/2; // it == icon top (for 16x16 icon) at = (h-13)/2; // at == arrow top /* * Iterate through buttons */ for (i = y; i < len; i++) { fDrawList.GetMemory(i*sizeof(tr),sizeof(tr),&tr); if (1 || tr.inset > 0) { if (tr.entry->child || tr.entry->fChildDefer) { t.top = (i - y) * h + at; t.left = 22 * (tr.inset) - x + 2; t.bottom = t.top + 12; t.right = t.left + 12; if (PtInRect(where,&t)) { /* * Clicked on open icon. */ if (tr.entry->child == NULL) { /* * Defer open--dispatch event to give the * app a chance to fill in the children */ tevent.child = (uint32)tr.entry; DoDispatch(KEventTreeOpen,GetViewID(),(void *)&tevent); } tr.entry->fOpen = !(tr.entry->fOpen); Update(); return false; } } } } /* * Iterate through text. */ for (i = y; i < len; i++) { char buffer[256]; fDrawList.GetMemory(i*sizeof(tr),sizeof(tr),&tr); GetItemData( (uint32)tr.entry, buffer, sizeof(buffer)-1 ); r.top = (i - y) * h; r.bottom = r.top + h; r.left = 22 * (tr.inset+1) - x; r.right = r.left + draw.StringWidth(buffer) + 6; if (tr.entry->icon) r.right += 16; if (PtInRect(where,&r)) { /* * Clicked on an object */ fDrawList.GetMemory(i*sizeof(tr),sizeof(tr),&tr); tevent.child = (uint32)tr.entry; if (flags & KKeyShift) { SetSelected((uint32)tr.entry, !tr.entry->fSelected); } else { SetSelection((uint32)tr.entry); } if (flags & KDoubleClick) { /* * We double-clicked on this object */ DoDispatch(KEventTreeDoubleClick,GetViewID(),(void *)&tevent); } else { /* * We single-clicked here */ DoDispatch(KEventTreeClick,GetViewID(),(void *)&tevent); if ((tr.entry->dragID) && XGDragger::Wait(this,where)) { /* * Should I drag? */ TreeDragRecord tdr; tdr.tree = this; tdr.dragID = (uint32)tr.entry; if (0 == DoDispatch(KEventTreeStartDrag,GetViewID(),(void *)&tdr)) { return false; } /* * Drag this one item */ if ((tr.entry->dragSize.h != -1) && (tr.entry->dragSize.v != -1)) { r.left = where.h; r.top = where.v; r.right = r.left + tr.entry->dragSize.h; r.bottom = r.top + tr.entry->dragSize.v; } XGDragger drag(this,tr.entry->fInternDrag); /*char buffer[256]; short len; len = fData.GetData(tr.entry->dragData,sizeof(buffer),buffer); drag.AddObject(1,tr.entry->dragID,buffer,len,&r);*/ char buffer[256]; int len = GetExtraData((uint32)tr.entry, buffer, sizeof(buffer)); drag.AddObject(1,tr.entry->dragID, buffer, len, &r); drag.Track(); } } return false; } } /* * If we get here, we didn't click on anything. Clear selection */ ClearSelection(); tevent.child = NULL; DoDispatch(KEventTreeClick,GetViewID(),(void *)&tevent); return false; }
QString Extension::GetLabel() const { return GetExtraData()[LABEL]; }
QString Extension::GetExtensionPointIdentifier() const { return GetExtraData()[XPT_NAME]; }
QString Extension::GetContributorId() const { return GetExtraData()[CONTRIBUTOR_ID]; }
// 打开 bool CVideoEncodeVt::Open(const STRUCT_PUSH_STREAM_PARAM& aPushStreamParam) { if(m_bOpen) return true; int ret = 0; CFMutableDictionaryRef pixelBufferInfo = NULL; CMVideoCodecType codecType = kCMVideoCodecType_H264; CFStringRef profileLevel = NULL; do { m_bCompressErr = false; m_bHasBFrames = false; m_iEntropy = H264_ENTROPY_NOT_SET; m_iProfile = H264_PROF_HIGH; m_iLevel = 0; m_iFrameRate = aPushStreamParam.iVideoFrameRate; //参数检查 if(m_iProfile == H264_PROF_BASELINE) { m_bHasBFrames = false; if(H264_CABAC == m_iEntropy) { m_iEntropy = H264_ENTROPY_NOT_SET; } } m_iDtsDelta = m_bHasBFrames ? -1 : 0; //取得profile level ret = GetProfileLevel(m_bHasBFrames, m_iProfile, m_iLevel, &profileLevel); if(ret < 0) { CLog::GetInstance().Log(ENUM_LOG_LEVEL::enum_Log_Level5, "GetProfileLevel failed!"); assert(false); break; } //取得pixel buffer info ret = GetCVPixelBufferInfo(aPushStreamParam.iVideoPushStreamWidth, aPushStreamParam.iVideoPushStreamHeight, &pixelBufferInfo); if(ret < 0) { CLog::GetInstance().Log(ENUM_LOG_LEVEL::enum_Log_Level5, "CreateCVPixelBufferInfo failed!"); assert(false); break; } //清空编码缓存队列 ClearEncodeBuffQueue(); //获得附加数据 ret = GetExtraData(aPushStreamParam, codecType, profileLevel, pixelBufferInfo); if(ret < 0) { CLog::GetInstance().Log(ENUM_LOG_LEVEL::enum_Log_Level5, "EncExtraData failed!"); assert(false); break; } //创建编码器 ret = CreateEncoder(aPushStreamParam, codecType, profileLevel, pixelBufferInfo, &m_EncodeSession); if(ret < 0) { CLog::GetInstance().Log(ENUM_LOG_LEVEL::enum_Log_Level5, "CreateEncoder failed!"); assert(false); break; } //是否使用B帧 CFBooleanRef hasBFrames; ret = VTSessionCopyProperty(m_EncodeSession, kVTCompressionPropertyKey_AllowFrameReordering, kCFAllocatorDefault, &hasBFrames); if (0 == ret) { m_bHasBFrames = CFBooleanGetValue(hasBFrames); CFRelease(hasBFrames); } }while(0); if (NULL != pixelBufferInfo) { CFRelease(pixelBufferInfo); } m_bOpen = ret == 0 ? true : false; return m_bOpen; }