本文整理汇总了C++中PROFILE函数 的典型用法代码示例。如果您正苦于以下问题:C++ PROFILE函数的具体用法?C++ PROFILE怎么用?C++ PROFILE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PROFILE函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PROFILE
//----------------------------------------------------------------------------------------------------
void GBJoypad::Update()
{
PROFILE( "Joypad::Update" );
// ________
// 7| |
// 6| |
// __________ 5| |
// / ________ 4| Joypad |
// / / | Chip |
// Down |__|Start___ 3| |
// Up |__|Select__ 2| |
// Left |__|B_______ 1| |
// Right|__|A_______ 0|________|
// By default, input will poll high (ignoring bits 4 and 5)
m_u8StateRegister |= 0xcf;
// Check if we need to poll the input
if( 0x30 != ( m_u8StateRegister & 0x30 ) )
{
int buttons = 0;
if( 0 == ( m_u8StateRegister & 0x20 ) )
{
buttons |= ( m_u32KeyStatus & ButtonA );
buttons |= ( m_u32KeyStatus & ButtonB );
buttons |= ( m_u32KeyStatus & ButtonSelect );
buttons |= ( m_u32KeyStatus & ButtonStart );
}
else if( 0 == ( m_u8StateRegister & 0x10 ) )
{
// Shift right by four to offset the upper bits of the bitmask into the lower four bits of the register
buttons |= ( m_u32KeyStatus & ButtonRight ) >> 4;
buttons |= ( m_u32KeyStatus & ButtonLeft ) >> 4;
buttons |= ( m_u32KeyStatus & ButtonUp ) >> 4;
buttons |= ( m_u32KeyStatus & ButtonDown ) >> 4;
}
开发者ID:GinNoOokami, 项目名称:GBEmu, 代码行数:37, 代码来源:GBJoypad.cpp
示例2: PROFILE
bool Shader::Load(Deserializer& source)
{
PROFILE(LoadShader);
Graphics* graphics = GetSubsystem<Graphics>();
if (!graphics)
return false;
// Load the shader source code and resolve any includes
timeStamp_ = 0;
String shaderCode;
if (!ProcessSource(shaderCode, source))
return false;
// Comment out the unneeded shader function
vsSourceCode_ = shaderCode;
psSourceCode_ = shaderCode;
CommentOutFunction(vsSourceCode_, "void PS(");
CommentOutFunction(psSourceCode_, "void VS(");
// OpenGL: rename either VS() or PS() to main(), comment out vertex attributes in pixel shaders
#ifdef URHO3D_OPENGL
vsSourceCode_.Replace("void VS(", "void main(");
psSourceCode_.Replace("void PS(", "void main(");
psSourceCode_.Replace("attribute ", "// attribute ");
#endif
// If variations had already been created, release them and require recompile
for (HashMap<StringHash, SharedPtr<ShaderVariation> >::Iterator i = vsVariations_.Begin(); i != vsVariations_.End(); ++i)
i->second_->Release();
for (HashMap<StringHash, SharedPtr<ShaderVariation> >::Iterator i = psVariations_.Begin(); i != psVariations_.End(); ++i)
i->second_->Release();
RefreshMemoryUse();
return true;
}
开发者ID:1vanK, 项目名称:Urho3DQuake2, 代码行数:36, 代码来源:Shader.cpp
示例3: PROFILE
void CSimpleColorMapFactory::BuildNode(CPlanetaryMapNode *pNode)
{
PROFILE("CSimpleColorMapFactory::BuildNode", 3);
// Initialize the color map
builder.pb.Init(HEIGHT_MAP_WIDTH, HEIGHT_MAP_WIDTH, 1);
unsigned char *pBuffer = (unsigned char *)builder.pb.GetBuffer();
for(int y=0; y<HEIGHT_MAP_WIDTH; y++)
{
int nCoord = (y+1)*BORDER_MAP_WIDTH + 1;
for(int x=0; x<HEIGHT_MAP_WIDTH; x++)
{
float fAltitude = builder.coord[nCoord++].GetHeight() - pNode->GetPlanetaryMap()->GetRadius();
float fHeight = fAltitude / pNode->GetPlanetaryMap()->GetMaxHeight();
fHeight = (m_vColors.size()-1) * CMath::Clamp(0.001f, 0.999f, (fHeight+1.0f) * 0.5f);
int nHeight = (int)fHeight;
float fRatio = fHeight - nHeight;
CColor c = m_vColors[nHeight] * (1-fRatio) + m_vColors[nHeight+1] * fRatio;
*pBuffer++ = c.r;
*pBuffer++ = c.g;
*pBuffer++ = c.b;
}
}
}
开发者ID:fluffyfreak, 项目名称:sandbox, 代码行数:24, 代码来源:PlanetaryObject.cpp
示例4: PROFILE
void NavigationMesh::CollectGeometries(Vector<NavigationGeometryInfo>& geometryList)
{
PROFILE(CollectNavigationGeometry);
// Get Navigable components from child nodes, not from whole scene. This makes it possible to partition
// the scene into several navigation meshes
PODVector<Navigable*> navigables;
node_->GetComponents<Navigable>(navigables, true);
HashSet<Node*> processedNodes;
for (unsigned i = 0; i < navigables.Size(); ++i)
{
if (navigables[i]->IsEnabledEffective())
CollectGeometries(geometryList, navigables[i]->GetNode(), processedNodes, navigables[i]->IsRecursive());
}
// Get offmesh connections
Matrix3x4 inverse = node_->GetWorldTransform().Inverse();
PODVector<OffMeshConnection*> connections;
node_->GetComponents<OffMeshConnection>(connections, true);
for (unsigned i = 0; i < connections.Size(); ++i)
{
OffMeshConnection* connection = connections[i];
if (connection->IsEnabledEffective() && connection->GetEndPoint())
{
const Matrix3x4& transform = connection->GetNode()->GetWorldTransform();
NavigationGeometryInfo info;
info.component_ = connection;
info.boundingBox_ = BoundingBox(Sphere(transform.Translation(), connection->GetRadius())).Transformed(inverse);
geometryList.Push(info);
}
}
}
开发者ID:SkunkWorks99, 项目名称:Urho3D, 代码行数:36, 代码来源:NavigationMesh.cpp
示例5: PROFILE
void GoldenJokerState::Update()
{
PROFILE(__FUNCTION__);
if(ENGINE->GetProcessManager()->GetNumQueueProcesses())
{
return;
}
if(GetCurrentError())
{
return;
}
if(!global_quit)
{
POKER_GAME->GoldenJokerUpdateDrawHand();
if (POKER_GAME->GoldenJokerStage == 3)
{
if (!POKER_GAME->GoldenJokerHeldProcessEnd)
ENGINE->GetProcessManager()->AddProcessToQueue(new GoldenJokerHeldsProcess);
else
OBJECT_HANDLER->GetObject2D("GoldenJokerMsg")->SetVisible(true);
}
if (POKER_GAME->GoldenJokerStage == 4)
ENGINE->GetProcessManager()->AddProcessToQueue(new GoldenJokerCardProcess);
if (POKER_GAME->GoldenJokerStage == 5)
{
OBJECT_HANDLER->GetObject2D("GoldenJokerMsg")->SetVisible(false);
ENGINE->StateTransition("HiloGamble");
}
}
}
开发者ID:Norcinu, 项目名称:1172Dev, 代码行数:36, 代码来源:GoldenJokerState.cpp
示例6: PROFILE
/**
* input_ is available only on server or on the local client, not for
* remote tanks.
*/
void Tank::frameMove(float dt)
{
PROFILE(Tank::frameMove);
setSleeping(false);
Controllable::frameMove(dt);
// Weapon firing code is handled on client for local player only
// to have immediate feedback. Remote players receive weapon
// feedback by received state.
bool firing = false;
if (getLocation() == CL_SERVER_SIDE ||
(getLocation() == CL_CLIENT_SIDE && isLocallyControlled()))
{
firing |= weapon_system_[0]->handleInput(input_.fire1_);
firing |= weapon_system_[1]->handleInput(input_.fire2_);
firing |= weapon_system_[2]->handleInput(input_.fire3_);
firing |= weapon_system_[3]->handleInput(input_.fire4_);
}
if (getLocation() != CL_REPLAY_SIM)
{
for(unsigned w=0; w < NUM_WEAPON_SLOTS; w++)
{
weapon_system_[w]->frameMove(dt);
}
}
if (is_locally_controlled_ && getLocation() == CL_CLIENT_SIDE)
{
frameMoveTurret(dt, true);
}
frameMoveTurret(dt, false);
if (is_locally_controlled_ || getLocation() == CL_SERVER_SIDE)
{
// remote tanks don't have accurate wheel info, and no extra
// dampening needed anyway
handleExtraDampening();
// Don't calc tire physics for uncontrolled objects on client.
frameMoveTires(dt);
}
if (location_ == CL_SERVER_SIDE)
{
/// heal logic
if (!firing &&
params_.get<bool>("tank.heal_skill") &&
getGlobalLinearVel().length() < s_params.get<float>("server.logic.tank_heal_velocity_threshold") &&
getOwner() != UNASSIGNED_SYSTEM_ADDRESS)
{
startHealing();
} else
{
stopHealing();
}
// object is positioned by visual on client side. Avoid redundant
// positioning
positionCarriedObject();
if (firing)
{
setInvincible(false);
}
}
}
开发者ID:krichter722, 项目名称:zeroballistics, 代码行数:76, 代码来源:Tank.cpp
示例7: PROFILE
bool Shader::Load(Deserializer& source)
{
PROFILE(LoadShader);
Graphics* graphics = GetSubsystem<Graphics>();
if (!graphics)
return false;
vsSourceCodeLength_ = 0;
psSourceCodeLength_ = 0;
SharedPtr<XMLFile> xml(new XMLFile(context_));
if (!xml->Load(source))
return false;
XMLElement shaders = xml->GetRoot("shaders");
if (!shaders)
{
LOGERROR("No shaders element in " + source.GetName());
return false;
}
{
PROFILE(ParseShaderDefinition);
if (!vsParser_.Parse(VS, shaders))
{
LOGERROR("VS: " + vsParser_.GetErrorMessage());
return false;
}
if (!psParser_.Parse(PS, shaders))
{
LOGERROR("PS: " + psParser_.GetErrorMessage());
return false;
}
}
String path, fileName, extension;
SplitPath(GetName(), path, fileName, extension);
{
PROFILE(LoadShaderSource);
if (!ProcessSource(vsSourceCode_, vsSourceCodeLength_, path + fileName + ".vert"))
return false;
if (!ProcessSource(psSourceCode_, psSourceCodeLength_, path + fileName + ".frag"))
return false;
}
// If variations had already been created, release them and set new source code
/// \todo Should also update defines
for (HashMap<StringHash, SharedPtr<ShaderVariation> >::Iterator i = vsVariations_.Begin(); i != vsVariations_.End(); ++i)
{
i->second_->Release();
i->second_->SetSourceCode(vsSourceCode_, vsSourceCodeLength_);
}
for (HashMap<StringHash, SharedPtr<ShaderVariation> >::Iterator i = psVariations_.Begin(); i != psVariations_.End(); ++i)
{
i->second_->Release();
i->second_->SetSourceCode(psSourceCode_, psSourceCodeLength_);
}
SetMemoryUse(sizeof(Shader) + 2 * sizeof(ShaderParser) + (vsVariations_.Size() + psVariations_.Size()) *
sizeof(ShaderVariation));
return true;
}
开发者ID:jjiezheng, 项目名称:urho3d, 代码行数:67, 代码来源:OGLShader.cpp
示例8: PROFILE
bool TextureCube::SetData(CubeMapFace face, unsigned level, int x, int y, int width, int height, const void* data)
{
PROFILE(SetTextureData);
if (!object_ || !graphics_)
{
LOGERROR("No texture created, can not set data");
return false;
}
if (!data)
{
LOGERROR("Null source for setting data");
return false;
}
if (level >= levels_)
{
LOGERROR("Illegal mip level for setting data");
return false;
}
if (graphics_->IsDeviceLost())
{
LOGWARNING("Texture data assignment while device is lost");
dataPending_ = true;
return true;
}
if (IsCompressed())
{
x &= ~3;
y &= ~3;
}
int levelWidth = GetLevelWidth(level);
int levelHeight = GetLevelHeight(level);
if (x < 0 || x + width > levelWidth || y < 0 || y + height > levelHeight || width <= 0 || height <= 0)
{
LOGERROR("Illegal dimensions for setting data");
return false;
}
graphics_->SetTextureForUpdate(this);
bool wholeLevel = x == 0 && y == 0 && width == levelWidth && height == levelHeight;
unsigned format = GetSRGB() ? GetSRGBFormat(format_) : format_;
if (!IsCompressed())
{
if (wholeLevel)
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, format, width, height, 0, GetExternalFormat(format_),
GetDataType(format_), data);
else
glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, x, y, width, height, GetExternalFormat(format_),
GetDataType(format_), data);
}
else
{
if (wholeLevel)
glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, format, width, height, 0,
GetDataSize(width, height), data);
else
glCompressedTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, x, y, width, height, format,
GetDataSize(width, height), data);
}
graphics_->SetTexture(0, 0);
return true;
}
开发者ID:asherkin, 项目名称:Urho3D, 代码行数:70, 代码来源:OGLTextureCube.cpp
示例9: HandleMessage
virtual void HandleMessage(const CMessage& msg, bool UNUSED(global))
{
switch (msg.GetType())
{
case MT_Interpolate:
{
PROFILE("Position::Interpolate");
const CMessageInterpolate& msgData = static_cast<const CMessageInterpolate&> (msg);
float rotY = m_RotY.ToFloat();
if (rotY != m_InterpolatedRotY)
{
float delta = rotY - m_InterpolatedRotY;
// Wrap delta to -M_PI..M_PI
delta = fmodf(delta + (float)M_PI, 2*(float)M_PI); // range -2PI..2PI
if (delta < 0) delta += 2*(float)M_PI; // range 0..2PI
delta -= (float)M_PI; // range -M_PI..M_PI
// Clamp to max rate
float deltaClamped = clamp(delta, -m_RotYSpeed*msgData.deltaSimTime, +m_RotYSpeed*msgData.deltaSimTime);
// Calculate new orientation, in a peculiar way in order to make sure the
// result gets close to m_orientation (rather than being n*2*M_PI out)
m_InterpolatedRotY = rotY + deltaClamped - delta;
// update the visual XZ rotation
if (m_InWorld)
{
m_LastInterpolatedRotX = m_InterpolatedRotX;
m_LastInterpolatedRotZ = m_InterpolatedRotZ;
UpdateXZRotation();
}
UpdateMessageSubscriptions();
}
break;
}
case MT_TurnStart:
{
m_LastInterpolatedRotX = m_InterpolatedRotX;
m_LastInterpolatedRotZ = m_InterpolatedRotZ;
if (m_InWorld && (m_LastX != m_X || m_LastZ != m_Z))
UpdateXZRotation();
// Store the positions from the turn before
m_PrevX = m_LastX;
m_PrevZ = m_LastZ;
m_LastX = m_X;
m_LastZ = m_Z;
m_LastYDifference = entity_pos_t::Zero();
// warn when a position change also causes a territory change under the entity
if (m_InWorld)
{
player_id_t newTerritory;
CmpPtr<ICmpTerritoryManager> cmpTerritoryManager(GetSystemEntity());
if (cmpTerritoryManager)
newTerritory = cmpTerritoryManager->GetOwner(m_X, m_Z);
else
newTerritory = INVALID_PLAYER;
if (newTerritory != m_Territory)
{
m_Territory = newTerritory;
CMessageTerritoryPositionChanged msg(GetEntityId(), m_Territory);
GetSimContext().GetComponentManager().PostMessage(GetEntityId(), msg);
}
}
else if (m_Territory != INVALID_PLAYER)
{
m_Territory = INVALID_PLAYER;
CMessageTerritoryPositionChanged msg(GetEntityId(), m_Territory);
GetSimContext().GetComponentManager().PostMessage(GetEntityId(), msg);
}
break;
}
case MT_TerrainChanged:
case MT_WaterChanged:
{
AdvertiseInterpolatedPositionChanges();
break;
}
case MT_Deserialized:
{
Deserialized();
break;
}
}
}
开发者ID:2asoft, 项目名称:0ad, 代码行数:94, 代码来源:CCmpPosition.cpp
示例10: cmpTerrain
void CCmpPathfinder::UpdateGrid()
{
CmpPtr<ICmpTerrain> cmpTerrain(GetSimContext(), SYSTEM_ENTITY);
if (!cmpTerrain)
return; // error
// If the terrain was resized then delete the old grid data
if (m_Grid && m_MapSize != cmpTerrain->GetTilesPerSide())
{
SAFE_DELETE(m_Grid);
SAFE_DELETE(m_ObstructionGrid);
m_TerrainDirty = true;
}
// Initialise the terrain data when first needed
if (!m_Grid)
{
m_MapSize = cmpTerrain->GetTilesPerSide();
m_Grid = new Grid<TerrainTile>(m_MapSize, m_MapSize);
m_ObstructionGrid = new Grid<u8>(m_MapSize, m_MapSize);
}
CmpPtr<ICmpObstructionManager> cmpObstructionManager(GetSimContext(), SYSTEM_ENTITY);
bool obstructionsDirty = cmpObstructionManager->Rasterise(*m_ObstructionGrid);
if (obstructionsDirty && !m_TerrainDirty)
{
PROFILE("UpdateGrid obstructions");
// Obstructions changed - we need to recompute passability
// Since terrain hasn't changed we only need to update the obstruction bits
// and can skip the rest of the data
// TODO: if ObstructionManager::SetPassabilityCircular was called at runtime
// (which should probably never happen, but that's not guaranteed),
// then TILE_OUTOFBOUNDS will change and we can't use this fast path, but
// currently it'll just set obstructionsDirty and we won't notice
for (u16 j = 0; j < m_MapSize; ++j)
{
for (u16 i = 0; i < m_MapSize; ++i)
{
TerrainTile& t = m_Grid->get(i, j);
u8 obstruct = m_ObstructionGrid->get(i, j);
if (obstruct & ICmpObstructionManager::TILE_OBSTRUCTED_PATHFINDING)
t |= 1;
else
t &= (TerrainTile)~1;
if (obstruct & ICmpObstructionManager::TILE_OBSTRUCTED_FOUNDATION)
t |= 2;
else
t &= (TerrainTile)~2;
}
}
++m_Grid->m_DirtyID;
}
else if (obstructionsDirty || m_TerrainDirty)
{
PROFILE("UpdateGrid full");
// Obstructions or terrain changed - we need to recompute passability
// TODO: only bother recomputing the region that has actually changed
CmpPtr<ICmpWaterManager> cmpWaterManager(GetSimContext(), SYSTEM_ENTITY);
// TOOD: these bits should come from ICmpTerrain
CTerrain& terrain = GetSimContext().GetTerrain();
// avoid integer overflow in intermediate calculation
const u16 shoreMax = 32767;
// First pass - find underwater tiles
Grid<bool> waterGrid(m_MapSize, m_MapSize);
for (u16 j = 0; j < m_MapSize; ++j)
{
for (u16 i = 0; i < m_MapSize; ++i)
{
fixed x, z;
TileCenter(i, j, x, z);
bool underWater = cmpWaterManager && (cmpWaterManager->GetWaterLevel(x, z) > terrain.GetExactGroundLevelFixed(x, z));
waterGrid.set(i, j, underWater);
}
}
// Second pass - find shore tiles
Grid<u16> shoreGrid(m_MapSize, m_MapSize);
for (u16 j = 0; j < m_MapSize; ++j)
{
for (u16 i = 0; i < m_MapSize; ++i)
{
// Find a land tile
if (!waterGrid.get(i, j))
{
if ((i > 0 && waterGrid.get(i-1, j)) || (i > 0 && j < m_MapSize-1 && waterGrid.get(i-1, j+1)) || (i > 0 && j > 0 && waterGrid.get(i-1, j-1))
|| (i < m_MapSize-1 && waterGrid.get(i+1, j)) || (i < m_MapSize-1 && j < m_MapSize-1 && waterGrid.get(i+1, j+1)) || (i < m_MapSize-1 && j > 0 && waterGrid.get(i+1, j-1))
//.........这里部分代码省略.........
开发者ID:temirio, 项目名称:0ad, 代码行数:101, 代码来源:CCmpPathfinder.cpp
示例11: PROFILE
inline void Density::symmetrize_density_matrix()
{
PROFILE("sirius::Density::symmetrize_density_matrix");
auto& sym = unit_cell_.symmetry();
int ndm = ctx_.num_mag_comp();
mdarray<double_complex, 4> dm(unit_cell_.max_mt_basis_size(), unit_cell_.max_mt_basis_size(),
ndm, unit_cell_.num_atoms());
dm.zero();
int lmax = unit_cell_.lmax();
int lmmax = Utils::lmmax(lmax);
mdarray<double, 2> rotm(lmmax, lmmax);
double alpha = 1.0 / double(sym.num_mag_sym());
for (int i = 0; i < sym.num_mag_sym(); i++) {
int pr = sym.magnetic_group_symmetry(i).spg_op.proper;
auto eang = sym.magnetic_group_symmetry(i).spg_op.euler_angles;
int isym = sym.magnetic_group_symmetry(i).isym;
SHT::rotation_matrix(lmax, eang, pr, rotm);
auto spin_rot_su2 = SHT::rotation_matrix_su2(sym.magnetic_group_symmetry(i).spin_rotation);
for (int ia = 0; ia < unit_cell_.num_atoms(); ia++) {
auto& atom_type = unit_cell_.atom(ia).type();
int ja = sym.sym_table(ia, isym);
for (int xi1 = 0; xi1 < unit_cell_.atom(ia).mt_basis_size(); xi1++) {
int l1 = atom_type.indexb(xi1).l;
int lm1 = atom_type.indexb(xi1).lm;
int o1 = atom_type.indexb(xi1).order;
for (int xi2 = 0; xi2 < unit_cell_.atom(ia).mt_basis_size(); xi2++) {
int l2 = atom_type.indexb(xi2).l;
int lm2 = atom_type.indexb(xi2).lm;
int o2 = atom_type.indexb(xi2).order;
std::array<double_complex, 3> dm_rot_spatial = {0, 0, 0};
for (int j = 0; j < ndm; j++) {
for (int m3 = -l1; m3 <= l1; m3++) {
int lm3 = Utils::lm_by_l_m(l1, m3);
int xi3 = atom_type.indexb().index_by_lm_order(lm3, o1);
for (int m4 = -l2; m4 <= l2; m4++) {
int lm4 = Utils::lm_by_l_m(l2, m4);
int xi4 = atom_type.indexb().index_by_lm_order(lm4, o2);
dm_rot_spatial[j] += density_matrix_(xi3, xi4, j, ja) * rotm(lm1, lm3) * rotm(lm2, lm4) * alpha;
}
}
}
/* magnetic symmetrization */
if (ndm == 1) {
dm(xi1, xi2, 0, ia) += dm_rot_spatial[0];
} else {
double_complex spin_dm[2][2] = {
{dm_rot_spatial[0], dm_rot_spatial[2]},
{std::conj(dm_rot_spatial[2]), dm_rot_spatial[1]}
};
/* spin blocks of density matrix are: uu, dd, ud
the mapping from linear index (0, 1, 2) of density matrix components is:
for the first spin index: k & 1, i.e. (0, 1, 2) -> (0, 1, 0)
for the second spin index: min(k, 1), i.e. (0, 1, 2) -> (0, 1, 1)
*/
for (int k = 0; k < ndm; k++) {
for (int is = 0; is < 2; is++) {
for (int js = 0; js < 2; js++) {
dm(xi1, xi2, k, ia) += spin_rot_su2(k & 1, is) * spin_dm[is][js] * std::conj(spin_rot_su2(std::min(k, 1), js));
}
}
}
}
}
}
}
}
dm >> density_matrix_;
if (ctx_.control().print_checksum_ && ctx_.comm().rank() == 0) {
auto cs = dm.checksum();
print_checksum("density_matrix", cs);
//for (int ia = 0; ia < unit_cell_.num_atoms(); ia++) {
// auto cs = mdarray<double_complex, 1>(&dm(0, 0, 0, ia), dm.size(0) * dm.size(1) * dm.size(2)).checksum();
// DUMP("checksum(density_matrix(%i)): %20.14f %20.14f", ia, cs.real(), cs.imag());
//}
}
}
开发者ID:dithillobothrium, 项目名称:SIRIUS, 代码行数:92, 代码来源:symmetrize_density_matrix.hpp
示例12: switch
// Return a string representation of a VAProfile
const char *string_of_VAProfile(VAProfile profile)
{
switch (profile) {
#define PROFILE(profile) \
case VAProfile##profile: return "VAProfile" #profile
PROFILE(MPEG2Simple);
PROFILE(MPEG2Main);
PROFILE(MPEG4Simple);
PROFILE(MPEG4AdvancedSimple);
PROFILE(MPEG4Main);
PROFILE(H264Baseline);
PROFILE(H264Main);
PROFILE(H264High);
PROFILE(VC1Simple);
PROFILE(VC1Main);
PROFILE(VC1Advanced);
#undef PROFILE
default: break;
}
return "<unknown>";
}
开发者ID:jlopez, 项目名称:gnash, 代码行数:22, 代码来源:vaapi_utils.cpp
示例13: PROFILE
void cApplication::fileWatching()
{
PROFILE(_T("fileWatching"));
_getCore()->fileWatching();
}
开发者ID:prodongi, 项目名称:Bread, 代码行数:6, 代码来源:BreadApplication.cpp
示例14: PROFILE
bool TextureCube::SetData(CubeMapFace face, unsigned level, int x, int y, int width, int height, const void* data)
{
PROFILE(SetTextureData);
if (!object_)
{
LOGERROR("No texture created, can not set data");
return false;
}
if (!data)
{
LOGERROR("Null source for setting data");
return false;
}
if (level >= levels_)
{
LOGERROR("Illegal mip level for setting data");
return false;
}
if (graphics_->IsDeviceLost())
{
LOGWARNING("Texture data assignment while device is lost");
dataPending_ = true;
return true;
}
if (IsCompressed())
{
x &= ~3;
y &= ~3;
}
int levelWidth = GetLevelWidth(level);
int levelHeight = GetLevelHeight(level);
if (x < 0 || x + width > levelWidth || y < 0 || y + height > levelHeight || width <= 0 || height <= 0)
{
LOGERROR("Illegal dimensions for setting data");
return false;
}
D3DLOCKED_RECT d3dLockedRect;
RECT d3dRect;
d3dRect.left = x;
d3dRect.top = y;
d3dRect.right = x + width;
d3dRect.bottom = y + height;
DWORD flags = 0;
if (level == 0 && x == 0 && y == 0 && width == levelWidth && height == levelHeight && pool_ == D3DPOOL_DEFAULT)
flags |= D3DLOCK_DISCARD;
if (FAILED(((IDirect3DCubeTexture9*)object_)->LockRect((D3DCUBEMAP_FACES)face, level, &d3dLockedRect, (flags &
D3DLOCK_DISCARD) ? 0 : &d3dRect, flags)))
{
LOGERROR("Could not lock texture");
return false;
}
if (IsCompressed())
{
height = (height + 3) >> 2;
y >>= 2;
}
unsigned char* src = (unsigned char*)data;
unsigned rowSize = GetRowDataSize(width);
// GetRowDataSize() returns CPU-side (source) data size, so need to convert for X8R8G8B8
if (format_ == D3DFMT_X8R8G8B8)
rowSize = rowSize / 3 * 4;
// Perform conversion from RGB / RGBA as necessary
switch (format_)
{
default:
for (int i = 0; i < height; ++i)
{
unsigned char* dest = (unsigned char*)d3dLockedRect.pBits + i * d3dLockedRect.Pitch;
memcpy(dest, src, rowSize);
src += rowSize;
}
break;
case D3DFMT_X8R8G8B8:
for (int i = 0; i < height; ++i)
{
unsigned char* dest = (unsigned char*)d3dLockedRect.pBits + i * d3dLockedRect.Pitch;
for (int j = 0; j < width; ++j)
{
*dest++ = src[2]; *dest++ = src[1]; *dest++ = src[0]; *dest++ = 255;
src += 3;
}
}
break;
case D3DFMT_A8R8G8B8:
for (int i = 0; i < height; ++i)
//.........这里部分代码省略.........
开发者ID:zhzhxtrrk, 项目名称:Urho3D, 代码行数:101, 代码来源:D3D9TextureCube.cpp
示例15: assert
void DebugRenderer::Render()
{
if (!HasContent())
return;
Graphics* graphics = GetSubsystem<Graphics>();
// Engine does not render when window is closed or device is lost
assert(graphics && graphics->IsInitialized() && !graphics->IsDeviceLost());
PROFILE(RenderDebugGeometry);
ShaderVariation* vs = graphics->GetShader(VS, "Basic", "VERTEXCOLOR");
ShaderVariation* ps = graphics->GetShader(PS, "Basic", "VERTEXCOLOR");
unsigned numVertices = (lines_.Size() + noDepthLines_.Size()) * 2 + (triangles_.Size() + noDepthTriangles_.Size()) * 3;
// Resize the vertex buffer if too small or much too large
if (vertexBuffer_->GetVertexCount() < numVertices || vertexBuffer_->GetVertexCount() > numVertices * 2)
vertexBuffer_->SetSize(numVertices, MASK_POSITION | MASK_COLOR, true);
float* dest = (float*)vertexBuffer_->Lock(0, numVertices, true);
if (!dest)
return;
for (unsigned i = 0; i < lines_.Size(); ++i)
{
const DebugLine& line = lines_[i];
dest[0] = line.start_.x_;
dest[1] = line.start_.y_;
dest[2] = line.start_.z_;
((unsigned&)dest[3]) = line.color_;
dest[4] = line.end_.x_;
dest[5] = line.end_.y_;
dest[6] = line.end_.z_;
((unsigned&)dest[7]) = line.color_;
dest += 8;
}
for (unsigned i = 0; i < noDepthLines_.Size(); ++i)
{
const DebugLine& line = noDepthLines_[i];
dest[0] = line.start_.x_;
dest[1] = line.start_.y_;
dest[2] = line.start_.z_;
((unsigned&)dest[3]) = line.color_;
dest[4] = line.end_.x_;
dest[5] = line.end_.y_;
dest[6] = line.end_.z_;
((unsigned&)dest[7]) = line.color_;
dest += 8;
}
for (unsigned i = 0; i < triangles_.Size(); ++i)
{
const DebugTriangle& triangle = triangles_[i];
dest[0] = triangle.v1_.x_;
dest[1] = triangle.v1_.y_;
dest[2] = triangle.v1_.z_;
((unsigned&)dest[3]) = triangle.color_;
dest[4] = triangle.v2_.x_;
dest[5] = triangle.v2_.y_;
dest[6] = triangle.v2_.z_;
((unsigned&)dest[7]) = triangle.color_;
dest[8] = triangle.v3_.x_;
dest[9] = triangle.v3_.y_;
dest[10] = triangle.v3_.z_;
((unsigned&)dest[11]) = triangle.color_;
dest += 12;
}
for (unsigned i = 0; i < noDepthTriangles_.Size(); ++i)
{
const DebugTriangle& triangle = noDepthTriangles_[i];
dest[0] = triangle.v1_.x_;
dest[1] = triangle.v1_.y_;
dest[2] = triangle.v1_.z_;
((unsigned&)dest[3]) = triangle.color_;
dest[4] = triangle.v2_.x_;
dest[5] = triangle.v2_.y_;
dest[6] = triangle.v2_.z_;
((unsigned&)dest[7]) = triangle.color_;
dest[8] = triangle.v3_.x_;
dest[9] = triangle.v3_.y_;
dest[10] = triangle.v3_.z_;
((unsigned&)dest[11]) = triangle.color_;
dest += 12;
}
vertexBuffer_->Unlock();
//.........这里部分代码省略.........
开发者ID:nonconforme, 项目名称:Urho3D, 代码行数:101, 代码来源:DebugRenderer.cpp
示例16: PROFILE
bool Technique::Load(Deserializer& source)
{
PROFILE(LoadTechnique);
SharedPtr<XMLFile> xml(new XMLFile(context_));
if (!xml->Load(source))
return false;
XMLElement rootElem = xml->GetRoot();
if (rootElem.HasAttribute("sm3"))
isSM3_ = rootElem.GetBool("sm3");
unsigned numPasses = 0;
XMLElement passElem = rootElem.GetChild("pass");
while (passElem)
{
if (passElem.HasAttribute("name"))
{
StringHash nameHash(passElem.GetAttribute("name"));
Pass* newPass = CreatePass(nameHash);
++numPasses;
if (passElem.HasAttribute("vs"))
newPass->SetVertexShader(passElem.GetAttribute("vs"));
if (passElem.HasAttribute("ps"))
newPass->SetPixelShader(passElem.GetAttribute("ps"));
if (passElem.HasAttribute("lighting"))
{
String lighting = passElem.GetAttributeLower("lighting");
newPass->SetLightingMode((PassLightingMode)GetStringListIndex(lighting.CString(), lightingModeNames,
LIGHTING_UNLIT));
}
if (passElem.HasAttribute("blend"))
{
String blend = passElem.GetAttributeLower("blend");
newPass->SetBlendMode((BlendMode)GetStringListIndex(blend.CString(), blendModeNames, BLEND_REPLACE));
}
if (passElem.HasAttribute("depthtest"))
{
String depthTest = passElem.GetAttributeLower("depthtest");
if (depthTest == "false")
newPass->SetDepthTestMode(CMP_ALWAYS);
else
newPass->SetDepthTestMode((CompareMode)GetStringListIndex(depthTest.CString(), compareModeNames, CMP_LESS));
}
if (passElem.HasAttribute("depthwrite"))
newPass->SetDepthWrite(passElem.GetBool("depthwrite"));
if (passElem.HasAttribute("alphamask"))
newPass->SetAlphaMask(passElem.GetBool("alphamask"));
}
else
LOGERROR("Missing pass name");
passElem = passElem.GetNext("pass");
}
// Calculate memory use
unsigned memoryUse = sizeof(Technique) + numPasses * sizeof(Pass);
SetMemoryUse(memoryUse);
return true;
}
开发者ID:SkunkWorks99, 项目名称:Urho3D, 代码行数:68, 代码来源:Technique.cpp
示例17: main
int main()
{
PROFILER_INIT();
FrameList frameList(10); // Keep a history of up to 100 frames (might be used by some modules)
// Modules
//BackgroundModelling_simple::BackgroundModel backgroundModel;
BackgroundModelling::BackgroundModel backgroundModel;
ForegroundProcessing::ForegroundProcessor foregroundProcessor;
Identification::Identifier identifier;
Prediction::Kalman kalmanFilter;
Evaluation evaluate(&frameList, 20);
// Init
foregroundProcessor.setAlgortihm(ForegroundProcessing::SLOW); //Use slow, toggle shadows in the init command
foregroundProcessor.init(3, 2, 125, 4, false);
foregroundProcessor.initShadow(0.5, 0.5, 0.3, 0.99);
identifier.init(Identification::Ultimate);
evaluate.readXML2FrameList("clip1.xml");
//evaluate.readXML2FrameList("CAVIAR1/fosne2gt.xml");
int waitForBGConvergence = 60;
// Load frame source
//frameList.open("CAVIAR1/OneStopNoEnter2front.mpg");
//frameList.open("clip1.mpeg");
frameList.open("camera1.mov");
//frameList.open("Renova_20080420_083025_Cam10_0000.mpeg");
//Record video
VideoWriter demo("trackingDemo.mpeg", CV_FOURCC('P','I','M','1'), 20, frameList.movieSize*2);
// Create windows
namedWindow("Info",CV_WINDOW_AUTOSIZE);
namedWindow("Background",CV_WINDOW_AUTOSIZE);
namedWindow("Foreground",CV_WINDOW_AUTOSIZE);
namedWindow("Tracking",CV_WINDOW_AUTOSIZE);
namedWindow("Raw image", CV_WINDOW_AUTOSIZE);
//namedWindow("BackgroundModel",CV_WINDOW_AUTOSIZE);
namedWindow("Evaluation", CV_WINDOW_AUTOSIZE);
while (frameList.queryNextFrame())
{
PROFILER_RESET();
sampleDown(frameList.getLatestFrame().image, frameList.getLatestFrame().image, 1); // Speed up by sampling down the image
// Do the nessecary processing
backgroundModel.update(frameList.getFrames()); PROFILE("BackgroundModel");
if (frameList.getCurrentFrameNumber() > waitForBGConvergence) //Wait for convergence
foregroundProcessor.segmentForeground(frameList.getLatestFrame()); PROFILE("ForegroundSeg.");
identifier.identify(frameList.getFrames()); PROFILE("Identification");
kalmanFilter.predict(frameList.getLatestFrame()); PROFILE("Kalman Prediction");
evaluate.currentFrame(); PROFILE("Evaluation");
// Display result
frameList.display("Tracking");
frameList.displayBackground("Background");
if (frameList.getCurrentFrameNumber() > waitForBGConvergence) //Wait for convergence
frameList.displayForeground("Foreground");
evaluate.displayInfo("Evaluation");
// Give the GUI time to render
waitKey(1); PROFILE("Display");
// Write current frame (and info) to file
demo << frameList.getLatestFrame().demoImage;
// Optional pause between each frame
//stepWiseFromFrame(frameList, 55);
PROFILE("QueryNextFrame");
PROFILE_TOTALTIME();
PROFILE("FPS");
PROFILE_FPS();
// Evaluate accuracy and precision
evaluate.MOTA();
evaluate.MOTP();
// Display info
frameList.displayInfo("Info");
}
evaluate.displaySequenceInfo("Evaluation");
waitKey(0);
return 0;
}
开发者ID:BabyFlower, 项目名称:Tracking, 代码行数:87, 代码来源:tracking.cpp
示例18: PROFILE
bool Animation::Load(Deserializer& source)
{
PROFILE(LoadAnimation);
unsigned memoryUse = sizeof(Animation);
// Check ID
if (source.ReadFileID() != "UANI")
{
LOGERROR(source.GetName() + " is not a valid animation file");
return false;
}
// Read name and length
animationName_ = source.ReadString();
animationNameHash_ = animationName_;
length_ = source.ReadFloat();
tracks_.Clear();
unsigned tracks = source.ReadUInt();
tracks_.Resize(tracks);
memoryUse += tracks * sizeof(AnimationTrack);
// Read tracks
for (unsigned i = 0; i < tracks; ++i)
{
AnimationTrack& newTrack = tracks_[i];
newTrack.name_ = source.ReadString();
newTrack.nameHash_ = newTrack.name_;
newTrack.channelMask_ = source.ReadUByte();
unsigned keyFrames = source.ReadUInt();
newTrack.keyFrames_.Resize(keyFrames);
memoryUse += keyFrames * sizeof(AnimationKeyFrame);
// Read keyframes of the track
for (unsigned j = 0; j < keyFrames; ++j)
{
AnimationKeyFrame& newKeyFrame = newTrack.keyFrames_[j];
newKeyFrame.time_ = source.ReadFloat();
if (newTrack.channelMask_ & CHANNEL_POSITION)
newKeyFrame.position_ = source.ReadVector3();
if (newTrack.channelMask_ & CHANNEL_ROTATION)
newKeyFrame.rotation_ = source.ReadQuaternion();
if (newTrack.channelMask_ & CHANNEL_SCALE)
newKeyFrame.scale_ = source.ReadVector3();
}
}
// Optionally read triggers from an XML file
ResourceCache* cache = GetSubsystem<ResourceCache>();
String xmlName = ReplaceExtension(GetName(), ".xml");
if (cache->Exists(xmlName))
{
XMLFile* file = cache->GetResource<XMLFile>(xmlName);
if (file)
{
XMLElement rootElem = file->GetRoot();
XMLElement triggerElem = rootElem.GetChild("trigger");
while (triggerElem)
{
if (triggerElem.HasAttribute("normalizedtime"))
AddTrigger(triggerElem.GetFloat("normalizedtime"), true, triggerElem.GetVariant());
else if (triggerElem.HasAttribute("time"))
AddTrigger(triggerElem.GetFloat("time"), false, triggerElem.GetVariant());
triggerElem = triggerElem.GetNext("trigger");
}
memoryUse += triggers_.Size() * sizeof(AnimationTriggerPoint);
}
}
SetMemoryUse(memoryUse);
return true;
}
开发者ID:CarloMaker, 项目名称:Urho3D, 代码行数:77, 代码来源:Animation.cpp
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:19274| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:10014| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8341| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8710| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8655| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9684| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8643| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:8011| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8680| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7547| 2022-11-06
请发表评论