本文整理汇总了C++中GetPitch函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPitch函数的具体用法?C++ GetPitch怎么用?C++ GetPitch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPitch函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetPitch
void CBaseTexture::ClampToEdge()
{
unsigned int imagePitch = GetPitch(m_imageWidth);
unsigned int imageRows = GetRows(m_imageHeight);
unsigned int texturePitch = GetPitch(m_textureWidth);
unsigned int textureRows = GetRows(m_textureHeight);
if (imagePitch < texturePitch)
{
unsigned int blockSize = GetBlockSize();
unsigned char *src = m_pixels + imagePitch - blockSize;
unsigned char *dst = m_pixels;
for (unsigned int y = 0; y < imageRows; y++)
{
for (unsigned int x = imagePitch; x < texturePitch; x += blockSize)
memcpy(dst + x, src, blockSize);
dst += texturePitch;
}
}
if (imageRows < textureRows)
{
unsigned char *dst = m_pixels + imageRows * texturePitch;
for (unsigned int y = imageRows; y < textureRows; y++)
{
memcpy(dst, dst - texturePitch, texturePitch);
dst += texturePitch;
}
}
}
开发者ID:AWilco,项目名称:xbmc,代码行数:29,代码来源:Texture.cpp
示例2: while
void CBaseTexture::Allocate(unsigned int width, unsigned int height, unsigned int format)
{
m_imageWidth = width;
m_imageHeight = height;
m_format = format;
m_orientation = 0;
m_textureWidth = m_imageWidth;
m_textureHeight = m_imageHeight;
if (m_format & XB_FMT_DXT_MASK)
while (GetPitch() < g_Windowing.GetMinDXTPitch())
m_textureWidth += GetBlockSize();
if (!g_Windowing.SupportsNPOT((m_format & XB_FMT_DXT_MASK) != 0))
{
m_textureWidth = PadPow2(m_textureWidth);
m_textureHeight = PadPow2(m_textureHeight);
}
if (m_format & XB_FMT_DXT_MASK)
{ // DXT textures must be a multiple of 4 in width and height
m_textureWidth = ((m_textureWidth + 3) / 4) * 4;
m_textureHeight = ((m_textureHeight + 3) / 4) * 4;
}
// check for max texture size
#define CLAMP(x, y) { if (x > y) x = y; }
CLAMP(m_textureWidth, g_Windowing.GetMaxTextureSize());
CLAMP(m_textureHeight, g_Windowing.GetMaxTextureSize());
CLAMP(m_imageWidth, m_textureWidth);
CLAMP(m_imageHeight, m_textureHeight);
delete[] m_pixels;
m_pixels = new unsigned char[GetPitch() * GetRows()];
}
开发者ID:AWilco,项目名称:xbmc,代码行数:35,代码来源:Texture.cpp
示例3: Allocate
void CBaseTexture::Update(unsigned int width, unsigned int height, unsigned int pitch, unsigned int format, const unsigned char *pixels, bool loadToGPU)
{
if (pixels == NULL)
return;
if (format & XB_FMT_DXT_MASK)
return;
Allocate(width, height, format);
unsigned int srcPitch = pitch ? pitch : GetPitch(width);
unsigned int srcRows = GetRows(height);
unsigned int dstPitch = GetPitch(m_textureWidth);
unsigned int dstRows = GetRows(m_textureHeight);
if (srcPitch == dstPitch)
memcpy(m_pixels, pixels, srcPitch * std::min(srcRows, dstRows));
else
{
const unsigned char *src = pixels;
unsigned char* dst = m_pixels;
for (unsigned int y = 0; y < srcRows && y < dstRows; y++)
{
memcpy(dst, src, std::min(srcPitch, dstPitch));
src += srcPitch;
dst += dstPitch;
}
}
ClampToEdge();
if (loadToGPU)
LoadToGPU();
}
开发者ID:69thelememt,项目名称:xbmc,代码行数:33,代码来源:Texture.cpp
示例4: while
void CBaseTexture::Allocate(unsigned int width, unsigned int height, unsigned int format)
{
m_imageWidth = m_originalWidth = width;
m_imageHeight = m_originalHeight = height;
m_format = format;
m_orientation = 0;
m_textureWidth = m_imageWidth;
m_textureHeight = m_imageHeight;
if (m_format & XB_FMT_DXT_MASK)
while (GetPitch() < CServiceBroker::GetRenderSystem().GetMinDXTPitch())
m_textureWidth += GetBlockSize();
if (!CServiceBroker::GetRenderSystem().SupportsNPOT((m_format & XB_FMT_DXT_MASK) != 0))
{
m_textureWidth = PadPow2(m_textureWidth);
m_textureHeight = PadPow2(m_textureHeight);
}
if (m_format & XB_FMT_DXT_MASK)
{ // DXT textures must be a multiple of 4 in width and height
m_textureWidth = ((m_textureWidth + 3) / 4) * 4;
m_textureHeight = ((m_textureHeight + 3) / 4) * 4;
}
else
{
// align all textures so that they have an even width
// in some circumstances when we downsize a thumbnail
// which has an uneven number of pixels in width
// we crash in CPicture::ScaleImage in ffmpegs swscale
// because it tries to access beyond the source memory
// (happens on osx and ios)
// UPDATE: don't just update to be on an even width;
// ffmpegs swscale relies on a 16-byte stride on some systems
// so the textureWidth needs to be a multiple of 16. see ffmpeg
// swscale headers for more info.
m_textureWidth = ((m_textureWidth + 15) / 16) * 16;
}
// check for max texture size
#define CLAMP(x, y) { if (x > y) x = y; }
CLAMP(m_textureWidth, CServiceBroker::GetRenderSystem().GetMaxTextureSize());
CLAMP(m_textureHeight, CServiceBroker::GetRenderSystem().GetMaxTextureSize());
CLAMP(m_imageWidth, m_textureWidth);
CLAMP(m_imageHeight, m_textureHeight);
_aligned_free(m_pixels);
m_pixels = NULL;
if (GetPitch() * GetRows() > 0)
{
size_t size = GetPitch() * GetRows();
m_pixels = (unsigned char*) _aligned_malloc(size, 32);
if (m_pixels == nullptr)
{
CLog::Log(LOGERROR, "%s - Could not allocate %zu bytes. Out of memory.", __FUNCTION__, size);
}
}
}
开发者ID:Montellese,项目名称:xbmc,代码行数:59,代码来源:Texture.cpp
示例5: GetEyePosition
Vector3d cPlayer::GetThrowStartPos(void) const
{
Vector3d res = GetEyePosition();
// Adjust the position to be just outside the player's bounding box:
res.x += 0.16 * cos(GetPitch());
res.y += -0.1;
res.z += 0.16 * sin(GetPitch());
return res;
}
开发者ID:Kortak,项目名称:MCServer,代码行数:11,代码来源:Player.cpp
示例6: ASSERT
void CSSE2Surface32Intrinsic::OnCreated()
{
ASSERT(GetBitDepth() == 32);
ASSERT((GetPitch() & 0xF) == 0);
ASSERT(GetVisibleWidth() && GetVisibleHeight());
ASSERT(sizeof(RGBQUAD) == 4);
int width = GetVisibleWidth();
m_qwpl = GetPitch()/8; // qwords Per Line
m_width = (width+3)/4; // 4 pixels at a time
}
开发者ID:jetlive,项目名称:skiaming,代码行数:11,代码来源:SSE2Surface32.cpp
示例7: while
void CBaseTexture::Allocate(unsigned int width, unsigned int height, unsigned int format)
{
m_imageWidth = m_originalWidth = width;
m_imageHeight = m_originalHeight = height;
m_format = format;
m_orientation = 0;
m_textureWidth = m_imageWidth;
m_textureHeight = m_imageHeight;
if (m_format & XB_FMT_DXT_MASK)
while (GetPitch() < g_Windowing.GetMinDXTPitch())
m_textureWidth += GetBlockSize();
if (!g_Windowing.SupportsNPOT((m_format & XB_FMT_DXT_MASK) != 0))
{
m_textureWidth = PadPow2(m_textureWidth);
m_textureHeight = PadPow2(m_textureHeight);
}
if (m_format & XB_FMT_DXT_MASK)
{ // DXT textures must be a multiple of 4 in width and height
m_textureWidth = ((m_textureWidth + 3) / 4) * 4;
m_textureHeight = ((m_textureHeight + 3) / 4) * 4;
}
else
{
// align all textures so that they have an even width
// in some circumstances when we downsize a thumbnail
// which has an uneven number of pixels in width
// we crash in CPicture::ScaleImage in ffmpegs swscale
// because it tries to access beyond the source memory
// (happens on osx and ios)
// UPDATE: don't just update to be on an even width;
// ffmpegs swscale relies on a 16-byte stride on some systems
// so the textureWidth needs to be a multiple of 16. see ffmpeg
// swscale headers for more info.
m_textureWidth = ((m_textureWidth + 15) / 16) * 16;
}
// check for max texture size
#define CLAMP(x, y) { if (x > y) x = y; }
CLAMP(m_textureWidth, g_Windowing.GetMaxTextureSize());
CLAMP(m_textureHeight, g_Windowing.GetMaxTextureSize());
CLAMP(m_imageWidth, m_textureWidth);
CLAMP(m_imageHeight, m_textureHeight);
delete[] m_pixels;
m_pixels = NULL;
if (GetPitch() * GetRows() > 0)
{
m_pixels = new unsigned char[GetPitch() * GetRows()];
}
}
开发者ID:davilla,项目名称:mrmc,代码行数:53,代码来源:Texture.cpp
示例8: GetScaling
Matrix4* BMaxObject::GetRenderMatrix(Matrix4& mxWorld, int nRenderNumber /*= 0*/)
{
mxWorld.identity();
// order of rotation: roll * pitch * yaw , where roll is applied first.
bool bIsIdentity = true;
float fScaling = GetScaling();
if (fScaling != 1.f)
{
Matrix4 matScale;
ParaMatrixScaling((Matrix4*)&matScale, fScaling, fScaling, fScaling);
mxWorld = (bIsIdentity) ? matScale : matScale.Multiply4x3(mxWorld);
bIsIdentity = false;
}
float fYaw = GetYaw();
if (fYaw != 0.f)
{
Matrix4 matYaw;
ParaMatrixRotationY((Matrix4*)&matYaw, fYaw);
mxWorld = (bIsIdentity) ? matYaw : matYaw.Multiply4x3(mxWorld);
bIsIdentity = false;
}
if (GetPitch() != 0.f)
{
Matrix4 matPitch;
ParaMatrixRotationX(&matPitch, GetPitch());
mxWorld = (bIsIdentity) ? matPitch : matPitch.Multiply4x3(mxWorld);
bIsIdentity = false;
}
if (GetRoll() != 0.f)
{
Matrix4 matRoll;
ParaMatrixRotationZ(&matRoll, GetRoll());
mxWorld = (bIsIdentity) ? matRoll : matRoll.Multiply4x3(mxWorld);
bIsIdentity = false;
}
// world translation
Vector3 vPos = GetRenderOffset();
mxWorld._41 += vPos.x;
mxWorld._42 += vPos.y;
mxWorld._43 += vPos.z;
return &mxWorld;
}
开发者ID:zhangleio,项目名称:NPLRuntime,代码行数:49,代码来源:BMaxObject.cpp
示例9: GetWidth
bool CImageEx::SetGray()
{
int nWidth = GetWidth();
int nHeight = GetHeight();
BYTE* pArray = (BYTE*)GetBits();
int nPitch = GetPitch();
int nBitCount = GetBPP() / 8;
for (int i = 0; i < nHeight; i++)
{
for (int j = 0; j < nWidth; j++)
{
int grayVal = (BYTE)(((*(pArray + nPitch * i + j * nBitCount) * 306)
+ (*(pArray + nPitch * i + j * nBitCount + 1) * 601)
+ (*(pArray + nPitch * i + j * nBitCount + 2) * 117) + 512 ) >> 10); // ¼ÆËã»Ò¶ÈÖµ
*(pArray + nPitch * i + j * nBitCount) = grayVal; // ¸³»Ò¶ÈÖµ
*(pArray + nPitch * i + j * nBitCount + 1) = grayVal;
*(pArray + nPitch * i + j * nBitCount + 2) = grayVal;
}
}
return true;
}
开发者ID:9crk,项目名称:EasyClient,代码行数:25,代码来源:ImageEx.cpp
示例10: DrawScreenSpec
void DrawScreenSpec()
{
int i,j,k;
unsigned char * pbPixels=E_BeginPaint();
int pitch=GetPitch();
unsigned char bt, cl, color;
pbPixels+=(44*pitch+16);
unsigned char * pbPix;
for (i=0;i<256;i++)
{
pbPix=pbPixels;
for (j=0;j<48;j++)
{
bt=mempage0[0x9000+(j<<8)+i];
cl=color_mem[(j<<8)+i];
for (k=0;k<8;k++)
{
color=(bt&0x80)?cl:0;
bt<<=1;
*(pbPix+pitch)=color;
*(pbPix+pitch+1)=color;
*(pbPix++)=color;
*(pbPix++)=color;
}
}
pbPixels+=pitch;
pbPixels+=pitch;
}
E_EndPaint();
}
开发者ID:timtashpulatov,项目名称:emu80,代码行数:30,代码来源:sdllayer.cpp
示例11: GetPitch
void dCustomHinge::SubmitConstraintsFrictionAndLimit(const dMatrix& matrix0, const dMatrix& matrix1, dFloat timestep)
{
dFloat angle = GetPitch();
if (angle < m_minAngle) {
dFloat relAngle = m_minAngle - angle;
NewtonUserJointAddAngularRow(m_joint, relAngle, &matrix1.m_front[0]);
NewtonUserJointSetRowStiffness(m_joint, m_stiffness);
NewtonUserJointSetRowMinimumFriction(m_joint, -m_friction);
// m_lastRowWasUsed = true;
} else if (angle > m_maxAngle) {
dFloat relAngle = m_maxAngle - angle;
NewtonUserJointAddAngularRow(m_joint, relAngle, &matrix1.m_front[0]);
NewtonUserJointSetRowStiffness(m_joint, m_stiffness);
NewtonUserJointSetRowMaximumFriction(m_joint, m_friction);
// m_lastRowWasUsed = true;
} else {
// friction but not limits
dFloat alpha = m_jointOmega / timestep;
NewtonUserJointAddAngularRow(m_joint, 0, &matrix1.m_front[0]);
NewtonUserJointSetRowAcceleration(m_joint, -alpha);
NewtonUserJointSetRowStiffness(m_joint, m_stiffness);
NewtonUserJointSetRowMinimumFriction(m_joint, -m_friction);
NewtonUserJointSetRowMaximumFriction(m_joint, m_friction);
// m_lastRowWasUsed = true;
}
}
开发者ID:fly-man-,项目名称:newton-dynamics,代码行数:26,代码来源:dCustomHinge.cpp
示例12: AString
bool cPlayer::SaveToDisk()
{
cFile::CreateFolder(FILE_IO_PREFIX + AString("players"));
// create the JSON data
Json::Value JSON_PlayerPosition;
JSON_PlayerPosition.append(Json::Value(GetPosX()));
JSON_PlayerPosition.append(Json::Value(GetPosY()));
JSON_PlayerPosition.append(Json::Value(GetPosZ()));
Json::Value JSON_PlayerRotation;
JSON_PlayerRotation.append(Json::Value(GetRotation()));
JSON_PlayerRotation.append(Json::Value(GetPitch()));
JSON_PlayerRotation.append(Json::Value(GetRoll()));
Json::Value JSON_Inventory;
m_Inventory.SaveToJson(JSON_Inventory);
Json::Value root;
root["position"] = JSON_PlayerPosition;
root["rotation"] = JSON_PlayerRotation;
root["inventory"] = JSON_Inventory;
root["health"] = m_Health;
root["xpTotal"] = m_LifetimeTotalXp;
root["xpCurrent"] = m_CurrentXp;
root["air"] = m_AirLevel;
root["food"] = m_FoodLevel;
root["foodSaturation"] = m_FoodSaturationLevel;
root["foodTickTimer"] = m_FoodTickTimer;
root["foodExhaustion"] = m_FoodExhaustionLevel;
root["world"] = GetWorld()->GetName();
if (m_GameMode == GetWorld()->GetGameMode())
{
root["gamemode"] = (int) eGameMode_NotSet;
}
else
{
root["gamemode"] = (int) m_GameMode;
}
Json::StyledWriter writer;
std::string JsonData = writer.write(root);
AString SourceFile;
Printf(SourceFile, "players/%s.json", m_PlayerName.c_str() );
cFile f;
if (!f.Open(SourceFile, cFile::fmWrite))
{
LOGERROR("ERROR WRITING PLAYER \"%s\" TO FILE \"%s\" - cannot open file", m_PlayerName.c_str(), SourceFile.c_str());
return false;
}
if (f.Write(JsonData.c_str(), JsonData.size()) != (int)JsonData.size())
{
LOGERROR("ERROR WRITING PLAYER JSON TO FILE \"%s\"", SourceFile.c_str());
return false;
}
return true;
}
开发者ID:Noraaron1,项目名称:MCServer,代码行数:60,代码来源:Player.cpp
示例13: switch
void cHangingEntity::SpawnOn(cClientHandle & a_ClientHandle)
{
int Dir = 0;
// The client uses different values for item frame directions and block faces. Our constants are for the block faces, so we convert them here to item frame faces
switch (m_BlockFace)
{
case BLOCK_FACE_ZP: break; // Initialised to zero
case BLOCK_FACE_ZM: Dir = 2; break;
case BLOCK_FACE_XM: Dir = 1; break;
case BLOCK_FACE_XP: Dir = 3; break;
default: ASSERT(!"Unhandled block face when trying to spawn item frame!"); return;
}
if ((Dir == 0) || (Dir == 2)) // Probably a client bug, but two directions are flipped and contrary to the norm, so we do -180
{
SetYaw((Dir * 90) - 180);
}
else
{
SetYaw(Dir * 90);
}
a_ClientHandle.SendSpawnObject(*this, 71, Dir, (Byte)GetYaw(), (Byte)GetPitch());
a_ClientHandle.SendEntityMetadata(*this);
}
开发者ID:ChriPiv,项目名称:MCServer,代码行数:26,代码来源:HangingEntity.cpp
示例14: GetPitch
/**
* Recreates the surface with a new size.
* Old contents will not be altered, and may be
* cropped to fit the new size.
* @param width Width in pixels.
* @param height Height in pixels.
*/
void Surface::resize(int width, int height)
{
// Set up new surface
Uint8 bpp = _surface->format->BitsPerPixel;
int pitch = GetPitch(bpp, width);
void *alignedBuffer = NewAligned(bpp, width, height);
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(alignedBuffer, width, height, bpp, pitch, 0, 0, 0, 0);
if (surface == 0)
{
throw Exception(SDL_GetError());
}
// Copy old contents
SDL_SetColorKey(surface, SDL_SRCCOLORKEY, 0);
SDL_SetColors(surface, getPalette(), 0, 255);
SDL_BlitSurface(_surface, 0, surface, 0);
// Delete old surface
DeleteAligned(_alignedBuffer);
SDL_FreeSurface(_surface);
_alignedBuffer = alignedBuffer;
_surface = surface;
_clear.w = getWidth();
_clear.h = getHeight();
}
开发者ID:stavrossk,项目名称:OpenXcom,代码行数:34,代码来源:Surface.cpp
示例15: GetPitch
float Source::GetPitch() const
{
#ifdef HAS_AUDIO_SOURCE
return impl->GetPitch();
#else
throw System::PunkException(L"Audio source is not available");
#endif
}
开发者ID:Mikalai,项目名称:punk_project_a,代码行数:8,代码来源:audio_source.cpp
示例16: while
void CBaseTexture::Allocate(unsigned int width, unsigned int height, unsigned int format)
{
m_imageWidth = m_originalWidth = width;
m_imageHeight = m_originalHeight = height;
m_format = format;
m_orientation = 0;
m_textureWidth = m_imageWidth;
m_textureHeight = m_imageHeight;
if (m_format & XB_FMT_DXT_MASK)
while (GetPitch() < g_Windowing.GetMinDXTPitch())
m_textureWidth += GetBlockSize();
#if !defined(TARGET_RASPBERRY_PI)
if (!g_Windowing.SupportsNPOT((m_format & XB_FMT_DXT_MASK) != 0))
{
m_textureWidth = PadPow2(m_textureWidth);
m_textureHeight = PadPow2(m_textureHeight);
}
#endif
if (m_format & XB_FMT_DXT_MASK)
{ // DXT textures must be a multiple of 4 in width and height
m_textureWidth = ((m_textureWidth + 3) / 4) * 4;
m_textureHeight = ((m_textureHeight + 3) / 4) * 4;
}
else
{
// align all textures so that they have an even width
// in some circumstances when we downsize a thumbnail
// which has an uneven number of pixels in width
// we crash in CPicture::ScaleImage in ffmpegs swscale
// because it tries to access beyond the source memory
// (happens on osx and ios)
m_textureWidth = ((m_textureWidth + 1) / 2) * 2;
}
// check for max texture size
#define CLAMP(x, y) { if (x > y) x = y; }
CLAMP(m_textureWidth, g_Windowing.GetMaxTextureSize());
CLAMP(m_textureHeight, g_Windowing.GetMaxTextureSize());
CLAMP(m_imageWidth, m_textureWidth);
CLAMP(m_imageHeight, m_textureHeight);
delete[] m_pixels;
m_pixels = new unsigned char[GetPitch() * GetRows()];
}
开发者ID:schererANGEL,项目名称:xbmc,代码行数:46,代码来源:Texture.cpp
示例17: EulerToVector
void cPlayer::TossItems(const cItems & a_Items)
{
m_Stats.AddValue(statItemsDropped, a_Items.Size());
double vX = 0, vY = 0, vZ = 0;
EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);
vY = -vY * 2 + 1.f;
m_World->SpawnItemPickups(a_Items, GetPosX(), GetEyeHeight(), GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because created by player
}
开发者ID:Kortak,项目名称:MCServer,代码行数:9,代码来源:Player.cpp
示例18: GetPitch
//-----------------------------------------------------------------------------
// Purpose: Pitches the camera forward axis toward the camera's down axis a
// given number of degrees.
//-----------------------------------------------------------------------------
void CCamera::Pitch(float fDegrees)
{
if (fDegrees != 0)
{
float fPitch = GetPitch();
fPitch += fDegrees;
SetPitch(fPitch);
}
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:13,代码来源:camera.cpp
示例19: GetYaw
bool CCameraInputHelper::UpdateTargetInterpolation()
{
if(!m_bInterpolationTargetActive || HasForceDirection())
return false;
//check timeout just in case
m_fInterpolationTargetTimeout -= gEnv->pTimer->GetFrameTime();
if(m_fInterpolationTargetTimeout < 0.0f)
{
m_bInterpolationTargetActive = false;
return true;
}
//work in 0 .. 2pi range
float targetYaw = m_fInterpolationTargetYaw + gf_PI;
float curYaw = GetYaw() + gf_PI;
//compute yaw delta
float yawDelta = targetYaw - curYaw;
if(yawDelta > gf_PI)
yawDelta = -(gf_PI2 - yawDelta);
else if(yawDelta < -gf_PI)
yawDelta = gf_PI2 + yawDelta;
//compute pitch delta
float pitchDelta = m_fInterpolationTargetPitch - GetPitch();
//termination
float absYawDelta = fabsf(yawDelta);
float absPitchDelta = fabsf(pitchDelta);
if(absYawDelta < m_fInterpolationTargetMaxError && absPitchDelta < m_fInterpolationTargetMaxError)
{
m_bInterpolationTargetActive = false;
return true;
}
//compute safe rotation speed
float interpolationSpeed = m_fInterpolationTargetSpeed * gEnv->pTimer->GetFrameTime();
if(absYawDelta < INTERPOLATION_SLOWDOWN_DIST && absYawDelta > INTERPOLATION_TARGET_MAX_ERROR)
interpolationSpeed *= max(0.02f, absYawDelta / INTERPOLATION_SLOWDOWN_DIST);
else if(absPitchDelta < INTERPOLATION_SLOWDOWN_DIST && absPitchDelta > INTERPOLATION_TARGET_MAX_ERROR)
interpolationSpeed *= max(0.02f, absPitchDelta / INTERPOLATION_SLOWDOWN_DIST);
//scale yaw and pitch delta
if(absYawDelta > interpolationSpeed)
yawDelta = ((yawDelta < 0.0f)?-1.0f:1.0f) * interpolationSpeed;
if(absPitchDelta > interpolationSpeed)
pitchDelta = ((pitchDelta < 0.0f)?-1.0f:1.0f) * interpolationSpeed * INTERPOLATION_PITCH_REL_SPEED;
//set deltas
if(absYawDelta >= INTERPOLATION_TARGET_MAX_ERROR)
SetYawDelta(yawDelta);
if(absPitchDelta >= INTERPOLATION_TARGET_MAX_ERROR)
SetPitchDelta(pitchDelta);
return true;
}
开发者ID:Oliverreason,项目名称:bare-minimum-cryengine3,代码行数:56,代码来源:CameraInputHelper.cpp
示例20: EulerToVector
void cPlayer::TossPickup(const cItem & a_Item)
{
cItems Drops;
Drops.push_back(a_Item);
double vX = 0, vY = 0, vZ = 0;
EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);
vY = -vY * 2 + 1.f;
m_World->SpawnItemPickups(Drops, GetPosX(), GetEyeHeight(), GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because created by player
}
开发者ID:crexalbo,项目名称:MCServer,代码行数:10,代码来源:Player.cpp
注:本文中的GetPitch函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论