本文整理汇总了C++中s32函数的典型用法代码示例。如果您正苦于以下问题:C++ s32函数的具体用法?C++ s32怎么用?C++ s32使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了s32函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: s32
// fills attributes with statistics information
void CImpostorSceneNode::getStats( io::IAttributes* statistics)
{
statistics->setAttribute("Nodes", s32(Impostors.size()));
//statistics->setAttribute("Lights", 0 ); // todo
statistics->setAttribute("Buffers", s32(Buffers.size()));
s32 TotalSlots=0, UsedSlots=0;
for (u32 i=0; i<Buffers.size(); ++i)
{
TotalSlots+= Buffers[i].Slots.size();
UsedSlots += Buffers[i].Slots.size() - Buffers[i].FreeSlots;
}
statistics->setAttribute("TotalSlots", TotalSlots);
statistics->setAttribute("UsedSlots", UsedSlots);
statistics->setAttribute("SlotUsage%", f32(UsedSlots)/ f32(TotalSlots) * 100.0f);
statistics->setAttribute("TotalTextureMB", f32(Buffers.size()*TextureWidth*TextureWidth*4)/1048576.0f );
statistics->setAttribute("QueueLength", s32(RenderQueue.size()));
//statistics->setAttribute("AverageQueueLength", 0); // todo
// todo
statistics->setAttribute("RenderCount", RenderCount);
statistics->setAttribute("CacheHit%", (f32(CacheHits) / f32(CacheHits + CacheMisses)) * 100.0f );
statistics->setAttribute("CacheHits", CacheHits);
statistics->setAttribute("CacheMisses", CacheMisses);
//statistics->setAttribute("LastRegisterTime", 0);
//statistics->setAttribute("TotalRegisterTime", 0);
//statistics->setAttribute("AvgRegisterTime", 0);
//statistics->setAttribute("LastRenderTime", 0);
//statistics->setAttribute("TotalRenderTime", 0);
//statistics->setAttribute("AvgRenderTime", 0);
}
开发者ID:rexwhitten,项目名称:battlespace,代码行数:36,代码来源:CImpostorSceneNode.cpp
示例2: R_CHK
void CSoundRender_TargetD::fill_parameters()
{
inherited::fill_parameters();
// 1. Set 3D params (including mode)
{
Fvector& p_pos = pEmitter->p_source.position;
R_CHK(pControl->SetMode (pEmitter->b2D ? DS3DMODE_HEADRELATIVE : DS3DMODE_NORMAL,DS3D_DEFERRED));
R_CHK(pControl->SetMinDistance (pEmitter->p_source.min_distance, DS3D_DEFERRED));
R_CHK(pControl->SetMaxDistance (pEmitter->p_source.max_distance, DS3D_DEFERRED));
R_CHK(pControl->SetPosition (p_pos.x,p_pos.y,p_pos.z, DS3D_DEFERRED));
}
// 2. Set 2D params (volume, freq) + position(rewind)
{
float _volume = pEmitter->smooth_volume; clamp (_volume,EPS_S,1.f);
s32 hw_volume = iFloor (7000.f*logf(_volume)/5.f); clamp (hw_volume,DSBVOLUME_MIN,DSBVOLUME_MAX);
if (_abs(hw_volume-cache_hw_volume)>50){
cache_hw_volume = hw_volume;
R_CHK(pBuffer->SetVolume(hw_volume));
}
float _freq = pEmitter->p_source.freq;
s32 hw_freq = iFloor (_freq * float(wfx.nSamplesPerSec) + EPS);
if (_abs(hw_freq-cache_hw_freq)>50) {
cache_hw_freq = hw_freq;
s32 hw_freq_set = hw_freq;
clamp (hw_freq_set,s32(SoundRenderD->dsCaps.dwMinSecondarySampleRate),s32(SoundRenderD->dsCaps.dwMaxSecondarySampleRate));
R_CHK (pBuffer->SetFrequency ( hw_freq_set ));
}
}
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:33,代码来源:SoundRender_TargetD.cpp
示例3: Ceiling
inline s32 Ceiling(const T& val)
{
if(val == s32(val))
return s32(val);
else if(val < T(0))
return s32(val);
else
return (s32(val) + 1);
}
开发者ID:innatewonder,项目名称:mythril,代码行数:9,代码来源:MathCommon.hpp
示例4: Floor
inline s32 Floor(const T& val)
{
if(val == s32(val))
return s32(val);
else if(val < T(0))
return (s32(val) - 1);
else
return s32(val);
}
开发者ID:innatewonder,项目名称:mythril,代码行数:9,代码来源:MathCommon.hpp
示例5: s32
bool Jungle::treeExistAt(core::vector3df position)
{
//
position /= this->getScale();
s32 idx = s32(position.X / CHUNK_RENDER_DIMENSION);
s32 idy = s32(position.Z / CHUNK_RENDER_DIMENSION);
if(idx < 0)return false;
if(idy < 0)return false;
if(idx >= WORLD_SIZE)return false;
if(idy >= WORLD_SIZE)return false;
return chunks[idx][idy].treeExistAt(position);
}
开发者ID:tecan,项目名称:Luna,代码行数:12,代码来源:Jungle.cpp
示例6: setNewActivePhysicsRect
void setNewActivePhysicsRect(daMegaGoomba_c *actor, Vec *scale) {
float amtX = scale->x * 0.5f;
float amtY = scale->y * 0.5f;
actor->belowSensor.flags = SENSOR_LINE;
actor->belowSensor.lineA = s32((amtX * -28.0f) * 4096.0f);
actor->belowSensor.lineB = s32((amtX * 28.0f) * 4096.0f);
actor->belowSensor.distanceFromCenter = 0;
actor->adjacentSensor.flags = SENSOR_LINE;
actor->adjacentSensor.lineA = s32((amtY * 4.0f) * 4096.0f);
actor->adjacentSensor.lineB = s32((amtY * 32.0f) * 4096.0f);
actor->adjacentSensor.distanceFromCenter = s32((amtX * 46.0f) * 4096.0f);
u8 cat1 = 3, cat2 = 0;
u32 bitfield1 = 0x6f, bitfield2 = 0xffbafffe;
ActivePhysics::Info info = {
0.0f, amtY*57.0f, amtX*20.0f, amtY*31.0f,
cat1, cat2, bitfield1, bitfield2, 0, &dEn_c::collisionCallback};
actor->aPhysics.initWithStruct(actor, &info);
// Original trapezium was -12,12 to -48,48
ActivePhysics::Info left = {
amtX*-32.0f, amtY*55.0f, amtX*12.0f, amtY*30.0f,
cat1, cat2, bitfield1, bitfield2, 0, &dEn_c::collisionCallback};
actor->leftTrapAPhysics.initWithStruct(actor, &left);
actor->leftTrapAPhysics.trpValue0 = amtX * 12.0f;
actor->leftTrapAPhysics.trpValue1 = amtX * 12.0f;
actor->leftTrapAPhysics.trpValue2 = amtX * -12.0f;
actor->leftTrapAPhysics.trpValue3 = amtX * 12.0f;
actor->leftTrapAPhysics.collisionCheckType = 3;
ActivePhysics::Info right = {
amtX*32.0f, amtY*55.0f, amtX*12.0f, amtY*30.0f,
cat1, cat2, bitfield1, bitfield2, 0, &dEn_c::collisionCallback};
actor->rightTrapAPhysics.initWithStruct(actor, &right);
actor->rightTrapAPhysics.trpValue0 = amtX * -12.0f;
actor->rightTrapAPhysics.trpValue1 = amtX * -12.0f;
actor->rightTrapAPhysics.trpValue2 = amtX * -12.0f;
actor->rightTrapAPhysics.trpValue3 = amtX * 12.0f;
actor->rightTrapAPhysics.collisionCheckType = 3;
ActivePhysics::Info stalk = {
0.0f, amtY*12.0f, amtX*28.0f, amtY*12.0f,
cat1, cat2, bitfield1, bitfield2, 0, &dEn_c::collisionCallback};
actor->stalkAPhysics.initWithStruct(actor, &stalk);
}
开发者ID:InfosHack,项目名称:NewerSMBW,代码行数:49,代码来源:bossMegaGoomba.cpp
示例7: f32
s32 CGUIScrollBar::getPosFromMousePos(s32 x, s32 y) const
{
if (Horizontal)
{
const f32 w = RelativeRect.getWidth() - f32(RelativeRect.getHeight())*3.0f;
const f32 p = x - AbsoluteRect.UpperLeftCorner.X - RelativeRect.getHeight()*1.5f;
return s32( p/w * f32(Max) );
}
else
{
const f32 h = RelativeRect.getHeight() - f32(RelativeRect.getWidth())*3.0f;
const f32 p = y - AbsoluteRect.UpperLeftCorner.Y - RelativeRect.getWidth()*1.5f;
return s32( p/h * f32(Max) );
}
}
开发者ID:jivibounty,项目名称:irrlicht,代码行数:15,代码来源:CGUIScrollBar.cpp
示例8: arma_extra_debug_sigprint
inline
void
op_diagvec::apply(Mat<typename T1::elem_type>& out, const Op<T1, op_diagvec>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const s32 id = (X.aux_u32_b > 0) ? -s32(X.aux_u32_a) : s32(X.aux_u32_a);
const unwrap_check<T1> tmp(X.m, out);
const Mat<eT>& A = tmp.M;
out = A.diag(id);
}
开发者ID:Caelita,项目名称:groupsac,代码行数:15,代码来源:op_diagvec_meat.hpp
示例9: DAEDALUS_PROFILE
//*************************************************************************************
//
//*************************************************************************************
void CTraceRecorder::Analyse( SRegisterUsageInfo & register_usage )
{
DAEDALUS_PROFILE( "CTraceRecorder::Analyse" );
std::pair< s32, s32 > reg_spans[ NUM_N64_REGS ];
std::pair< s32, s32 > invalid_span( std::pair< s32, s32 >( mTraceBuffer.size(), -1 ) );
std::fill( reg_spans, reg_spans + NUM_N64_REGS, invalid_span ); // Set the interval to an invalid range
for( u32 i = 0; i < mTraceBuffer.size(); ++i )
{
const STraceEntry & ti( mTraceBuffer[ i ] );
const StaticAnalysis::RegisterUsage& usage = ti.Usage;
register_usage.RegistersRead |= usage.RegReads;
register_usage.RegistersWritten |= usage.RegWrites;
register_usage.RegistersAsBases |= usage.RegBase;
u32 all_uses( usage.RegReads | usage.RegWrites | usage.RegBase );
// Update the live span
for( s32 reg = 1; reg < NUM_N64_REGS; ++reg )
{
if( all_uses & (1<<reg) )
{
if( s32( i ) < reg_spans[ reg ].first ) reg_spans[ reg ].first = i;
if( s32( i ) > reg_spans[ reg ].second ) reg_spans[ reg ].second = i;
}
}
}
register_usage.SpanList.clear();
register_usage.SpanList.reserve( NUM_N64_REGS );
// Iterate through registers, inserting all that are used into span list
for( u32 i = 0; i < NUM_N64_REGS; ++i )
{
s32 start( reg_spans[ i ].first );
s32 end( reg_spans[ i ].second );
if( start <= end )
{
SRegisterSpan span( EN64Reg( i ), start, end );
register_usage.SpanList.push_back( span );
}
}
}
开发者ID:ThePhoenixRises,项目名称:daedalus,代码行数:51,代码来源:TraceRecorder.cpp
示例10: readHeader
// returns true on success
bool CImageLoaderRGB::readHeader(io::IReadFile* file, rgbStruct& rgb) const
{
if ( file->read(&rgb.Header, sizeof(rgb.Header)) < s32(sizeof(rgb.Header)) )
return false;
// test for INTEL or BIG ENDIAN processor
// if INTEL, then swap the byte order on 16 bit INT's to make them BIG ENDIAN
// because that is the native format for the .rgb file
#ifndef __BIG_ENDIAN__
rgb.Header.Magic = os::Byteswap::byteswap(rgb.Header.Magic);
rgb.Header.Storage = os::Byteswap::byteswap(rgb.Header.Storage);
rgb.Header.Dimension = os::Byteswap::byteswap(rgb.Header.Dimension);
rgb.Header.Xsize = os::Byteswap::byteswap(rgb.Header.Xsize);
rgb.Header.Ysize = os::Byteswap::byteswap(rgb.Header.Ysize);
rgb.Header.Zsize = os::Byteswap::byteswap(rgb.Header.Zsize);
rgb.Header.Pixmin = os::Byteswap::byteswap(rgb.Header.Pixmin);
rgb.Header.Pixmax = os::Byteswap::byteswap(rgb.Header.Pixmax);
rgb.Header.Colormap = os::Byteswap::byteswap(rgb.Header.Colormap);
#endif
// calculate the size of the buffer needed: XSIZE * YSIZE * ZSIZE * BPC
rgb.ImageSize = (rgb.Header.Xsize)*(rgb.Header.Ysize)*(rgb.Header.Zsize)*(rgb.Header.BPC);
return true;
}
开发者ID:vgck,项目名称:irrnacht,代码行数:26,代码来源:CImageLoaderRGB.cpp
示例11: inventory
void CActor::OnPrevWeaponSlot()
{
u32 ActiveSlot = inventory().GetActiveSlot();
if (ActiveSlot == NO_ACTIVE_SLOT)
ActiveSlot = inventory().GetPrevActiveSlot();
if (ActiveSlot == NO_ACTIVE_SLOT)
ActiveSlot = KNIFE_SLOT;
u32 NumSlotsToCheck = sizeof(SlotsToCheck)/sizeof(SlotsToCheck[0]);
u32 CurSlot = 0;
for (; CurSlot<NumSlotsToCheck; CurSlot++)
{
if (SlotsToCheck[CurSlot] == ActiveSlot) break;
};
if (CurSlot >= NumSlotsToCheck)
CurSlot = NumSlotsToCheck-1; //last in row
for (s32 i=s32(CurSlot-1); i>=0; i--)
{
if (inventory().ItemFromSlot(SlotsToCheck[i]))
{
if (SlotsToCheck[i] == ARTEFACT_SLOT)
{
IR_OnKeyboardPress(kARTEFACT);
}
else
IR_OnKeyboardPress(kWPN_1 + i);
return;
}
}
};
开发者ID:zcaliptium,项目名称:xray-16,代码行数:34,代码来源:ActorInput.cpp
示例12: updateCurrentViewStack
void EventSystem::propagateMouseEvent(Event* event)
{
updateCurrentViewStack(event);
if(currentViewStack.size() == 0) { return; } // bail if no views, happens when mouse outside of window
// logViewStack(currentViewStack);
event->base.bubbles = true;
event->base.stopDispatch = false;
event->base.stopPropagation = false;
EventType et = event->base.type;
if((et == ET_MouseUp) || (et == ET_MouseDown))
{
propagateUpDownEvent(event);
if(et == ET_MouseDown)
{
propagateFocusEvent(event);
}
}
else
{
// propagate scroll/move
event->base.target = currentViewStack.back();
s32 targetIndex = s32(currentViewStack.size())-1;
propagateEvent(currentViewStack, event, targetIndex);
}
// enter/leave
if(et == ET_MouseMove)
{
propagateEnterLeaveEvent(event);
previousMouseMoveStack = currentViewStack;
}
}
开发者ID:jomanto,项目名称:le2,代码行数:35,代码来源:EventSystem.cpp
示例13: is_good_motion
bool CMotionStats::is_good_motion(u32 elems_checked)
{
u32 from_index;
u32 to_index;
if (index == 0) return true;
else from_index = index-1;
if (s32(index - elems_checked) < 0) return true;
else to_index = index - elems_checked;
bool bGood = true;
float test_speed = _data[from_index].speed;
for (u32 i=from_index; i>to_index;i--) {
// считать только, если все элементы содержат одинаковые скорости
if (!fsimilar(test_speed,_data[i].speed)) break;
float cur_dist = _data[i].position.distance_to(_data[i-1].position);
TTime delta_t = _data[i].time - _data[i-1].time;
float speed = cur_dist * 1000.f / float(delta_t);
if (fsimilar(_data[i-1].speed,0.0f)) continue;
if (speed * 5.f < _data[i].speed) {
bGood = false;
break;
}
}
return bGood;
}
开发者ID:2asoft,项目名称:xray,代码行数:32,代码来源:ai_monster_motion_stats.cpp
示例14: s32
void PPCXEmitter::BLE (const void *fnptr) {
CHECK_SMALL_JUMP
s32 func = (s32)fnptr - s32(code);
u32 instr = (0x40810000 | (((s16)(((func)+1))) & 0xfffc));
Write32(instr);
}
开发者ID:metalex10,项目名称:PPSSPP-X360,代码行数:7,代码来源:ppcEmitter.cpp
示例15: defined
// This method needs a properly cleaned error state before the checked instruction is called
bool COpenGLShaderMaterialRenderer::checkError(const irr::c8* type)
{
#if defined(GL_ARB_vertex_program) || defined(GL_NV_vertex_program) || defined(GL_ARB_fragment_program) || defined(GL_NV_fragment_program)
GLenum g = glGetError();
if (g == GL_NO_ERROR)
return false;
core::stringc errString = type;
errString += " compilation failed";
errString += " at position ";
GLint errPos=-1;
#if defined(GL_ARB_vertex_program) || defined(GL_ARB_fragment_program)
glGetIntegerv( GL_PROGRAM_ERROR_POSITION_ARB, &errPos );
#else
glGetIntegerv( GL_PROGRAM_ERROR_POSITION_NV, &errPos );
#endif
errString += core::stringc(s32(errPos));
errString += ":\n";
#if defined(GL_ARB_vertex_program) || defined(GL_ARB_fragment_program)
errString += reinterpret_cast<const char*>(glGetString(GL_PROGRAM_ERROR_STRING_ARB));
#else
errString += reinterpret_cast<const char*>(glGetString(GL_PROGRAM_ERROR_STRING_NV));
#endif
#else
core::stringc errString("Shaders not supported.");
#endif
os::Printer::log(errString.c_str(), ELL_ERROR);
return true;
}
开发者ID:vgck,项目名称:irrnacht,代码行数:31,代码来源:COpenGLShaderMaterialRenderer.cpp
示例16: setMaterialRendererName
//! Sets the name of a material renderer.
void CNullDriver::setMaterialRendererName(s32 idx, const char* name)
{
if (idx < s32(sizeof(sBuiltInMaterialTypeNames) / sizeof(char*))-1 ||
idx >= (s32)MaterialRenderers.size())
return;
MaterialRenderers[idx].Name = name;
}
开发者ID:ChangerR,项目名称:dream,代码行数:9,代码来源:CNullDriver.cpp
示例17: s32
void GameScene::FogReveal(const vec3 &pos, u32 radius)
{
if (!pFog)
return;
auto px = pos.x - 20.f;
auto py = pos.y - 20.f;
auto sx = s32((px / iTileSize) + iTileSize / 2) - 4;
auto sy = s32((py / iTileSize) + iTileSize / 2) - 4;
auto r = s32(radius);
for (auto y = -r; y <= r; y++)
{
for (auto x = -r; x <= r; x++)
{
pFog->SetTileAt(sx + x, sy + y, 5); // 5 == ultimo tile, transparente
}
}
}
开发者ID:ggj,项目名称:optimalus,代码行数:18,代码来源:gamescene.cpp
示例18: SHOOT_ASSERT
//! event handlers
void ObjectViewer::OnColumnClick(wxListEvent& event)
{
m_ColumnToSort = event.GetColumn();
m_pObjectList->SortItems(ObjectViewer::ObjectViewerSort, (long)this);
SHOOT_ASSERT(m_ColumnToSort >= 0 && m_ColumnToSort < s32(NumColumns), "Invalid Column Index");
m_ColumSortDescending[m_ColumnToSort] = !m_ColumSortDescending[m_ColumnToSort];
}
开发者ID:aminere,项目名称:VLADHeavyStrikePublic,代码行数:10,代码来源:ObjectViewer.cpp
示例19: if
//! updates the visitor
void FollowCameraPathVisitor::Update()
{
if(!m_bActive)
{
return;
}
f32 fRatio = m_fTimer/m_fDuration;
m_pCamera->SetPosition(m_Path->GetPosition(m_CurrentElement, m_CurrentElement+1, fRatio));
m_pCamera->SetLookAt(m_Path->GetLookAt(m_CurrentElement, m_CurrentElement+1, fRatio));
if(m_fTimer < m_fDuration)
{
m_fTimer += g_fDeltaTime;
}
else if(m_CurrentElement < s32(m_Path->GetChildCount())-2)
{
++m_CurrentElement;
f32 newDuration = m_Path->GetElement(m_CurrentElement)->GetFollowDuration();
f32 fOverTime = (m_fTimer-m_fDuration)*(m_fDuration/newDuration);
m_fDuration = newDuration-fOverTime;
m_fTimer = fOverTime + g_fDeltaTime;
}
else
{
m_iPlayCount++;
switch(m_ePlaybackType)
{
case PT_Once:
Leave();
break;
case PT_Loop:
if((m_iMaxPlayCount < 0) || (m_iPlayCount < m_iMaxPlayCount))
{
m_CurrentElement = 0;
f32 newDuration = m_Path->GetElement(m_CurrentElement)->GetFollowDuration();
f32 fOverTime = (m_fTimer-m_fDuration)*(m_fDuration/newDuration);
m_fDuration = newDuration-fOverTime;
m_fTimer = fOverTime + g_fDeltaTime;
}
else
{
Leave();
}
break;
case PT_Toggle:
SHOOT_WARNING(false, "FollowCameraPathVisitor Unsupported PlaybackType: PT_Toggle");
Leave();
break;
default:
Leave();
}
}
}
开发者ID:aminere,项目名称:VLADHeavyStrikePublic,代码行数:58,代码来源:FollowCameraPathVisitor.cpp
示例20: m
//*************************************************************************************
//
//*************************************************************************************
EMenuOption IMainMenuScreen::AsMenuOption( s32 option )
{
s32 m( option % s32(NUM_MENU_OPTIONS) );
if( m < 0 )
m += NUM_MENU_OPTIONS;
DAEDALUS_ASSERT( m >= 0 && m < (s32)NUM_MENU_OPTIONS, "Whoops" );
return EMenuOption( m );
}
开发者ID:ThePhoenixRises,项目名称:daedalus,代码行数:13,代码来源:MainMenuScreen.cpp
注:本文中的s32函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论