本文整理汇总了C++中GetOrigin函数的典型用法代码示例。如果您正苦于以下问题:C++ GetOrigin函数的具体用法?C++ GetOrigin怎么用?C++ GetOrigin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetOrigin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartSound
//--------------------------------
// hhProxDoor::Event_Touch
//--------------------------------
void hhProxDoor::Event_Touch( idEntity *other, trace_t *trace ) {
if ( sndTrigger && trace->c.id == sndTrigger->GetId() ) {
if (other && other->IsType(hhPlayer::Type) && IsLocked() && gameLocal.time > nextSndTriggerTime) {
StartSound("snd_locked", SND_CHANNEL_ANY, 0, false, NULL );
nextSndTriggerTime = gameLocal.time + 10000;
}
return;
}
if( proxState == PROXSTATE_Active ) {
return;
}
if ( !other ) {
gameLocal.Warning("hhProxDoor: Event_Touch given NULL for other\n");
return;
}
float dist = ( other->GetOrigin() - GetOrigin() ).Length();
if (dist > movementDistance) {
return;
}
if( !IsLocked() ) {
SetDoorState( PROXSTATE_Active );
}
}
示例2: GetOrigin
/* Calculate the bounding box of this, when rotated
*/
const EDA_RECT EDA_RECT::GetBoundingBoxRotated( wxPoint aRotCenter, double aAngle )
{
wxPoint corners[4];
// Build the corners list
corners[0] = GetOrigin();
corners[2] = GetEnd();
corners[1].x = corners[0].x;
corners[1].y = corners[2].y;
corners[3].x = corners[2].x;
corners[3].y = corners[0].y;
// Rotate all corners, to find the bounding box
for( int ii = 0; ii < 4; ii ++ )
RotatePoint( &corners[ii], aRotCenter, aAngle );
// Find the corners bounding box
wxPoint start = corners[0];
wxPoint end = corners[0];
for( int ii = 1; ii < 4; ii ++ )
{
start.x = std::min( start.x, corners[ii].x);
start.y = std::min( start.y, corners[ii].y);
end.x = std::max( end.x, corners[ii].x);
end.y = std::max( end.y, corners[ii].y);
}
EDA_RECT bbox;
bbox.SetOrigin( start );
bbox.SetEnd( end );
return bbox;
}
示例3: clipBounds
/*
=================
hhProjectileCrawlerGrenade::Event_ApplyExpandWound
=================
*/
void hhProjectileCrawlerGrenade::Event_ApplyExpandWound() {
trace_t trace;
if( !modelProxy.IsValid() || !modelProxy->GetCombatModel() ) {
return;
}
idBounds clipBounds( modelProxy->GetRenderEntity()->bounds );
idVec3 traceEnd = GetOrigin();
idVec3 traceStart = traceEnd + hhUtils::RandomPointInShell( clipBounds.Expand(1.0f).GetRadius(), clipBounds.Expand(2.0f).GetRadius() );
idVec3 jointOrigin, localOrigin, localNormal;
idMat3 jointAxis, axisTranspose;
jointHandle_t jointHandle = INVALID_JOINT;
CancelEvents( &EV_ApplyExpandWound );
PostEventSec( &EV_ApplyExpandWound, spawnArgs.GetFloat("expandWoundDelay") );
if( !gameLocal.clip.TracePoint(trace, traceStart, traceEnd, modelProxy->GetCombatModel()->GetContents(), NULL) ) {
return;
}
if( trace.c.entityNum != entityNumber ) {//Make sure we hit ourselves
return;
}
modelProxy->AddDamageEffect( trace, vec3_zero, spawnArgs.GetString("def_expandDamage"), (!fl.networkSync || netSyncPhysics) );
}
示例4: StopSound
/*
=================
hhProjectileCrawlerGrenade::Event_Collision_Bounce
=================
*/
void hhProjectileCrawlerGrenade::Event_Collision_Bounce( const trace_t* collision, const idVec3 &velocity ) {
static const float minCollisionVelocity = 20.0f;
static const float maxCollisionVelocity = 90.0f;
StopSound( SND_CHANNEL_BODY, true );
// Velocity in normal direction
float len = velocity * -collision->c.normal;
if( collision->fraction < VECTOR_EPSILON || len < minCollisionVelocity ) {
idThread::ReturnInt( 0 );
return;
}
StartSound( "snd_bounce", SND_CHANNEL_BODY, 0, true, NULL );
float volume = hhUtils::CalculateSoundVolume( len, minCollisionVelocity, maxCollisionVelocity );
HH_SetSoundVolume( volume, SND_CHANNEL_BODY );
BounceSplat( GetOrigin(), -collision->c.normal );
SIMDProcessor->Memcpy( &collisionInfo, collision, sizeof(trace_t) );
collisionInfo.fraction = 0.0f;//Sometimes fraction == 1.0f
physicsObj.SetAngularVelocity( 0.5f*physicsObj.GetAngularVelocity() );
idThread::ReturnInt( 0 );
}
示例5: GetOrigin
void csCameraBase::MoveWorld (const csVector3 &v, bool cd)
{
csVector3 new_position = GetOrigin () + v;
if (sector)
{
csVector3 remember_position = new_position;
// Test if the motion crosses a portal
iSector *new_sector = sector->FollowSegment (
*this,
new_position,
mirror,
only_portals);
if (new_sector != sector)
{
sector = new_sector;
cameranr = cur_cameranr++;
FireCameraSectorListeners (sector);
}
}
FireCameraMovedListeners ();
SetOrigin (new_position);
cameranr = cur_cameranr++;
}
示例6: GetOrigin
void hhProxDoorRotator::Event_PostSpawn( void ) {
idVec3 sectionOffset;
idVec3 rotVector;
float rotAngle;
if( !spawnArgs.GetVector("section_offset", "0 0 0", sectionOffset) ) {
common->Warning( "No section offset found for '%s'", this->GetEntityDefName() );
}
if( !spawnArgs.GetVector("rot_vector", "0 0 0", rotVector) ) {
common->Warning( "No rotation vector found for '%s'", this->GetEntityDefName() );
}
if( !spawnArgs.GetFloat("rot_angle", "0 0 0", rotAngle) ) {
common->Warning( "No rotation angle found for '%s'", this->GetEntityDefName() );
}
idDict args;
args.SetVector( "origin", GetOrigin() + (sectionOffset * GetAxis()) );
args.SetMatrix( "rotation", GetAxis() );
args.SetVector( "rot_vector", rotVector );
args.SetFloat( "rot_angle", rotAngle );
bindParent = static_cast<hhProxDoorSection*>( gameLocal.SpawnEntityType(hhProxDoorRotMaster::Type, &args) );
if( !bindParent.IsValid() ) {
common->Warning( "Failed to spawn bindParent for '%s'", GetEntityDefName() );
}
else {
bindParent->proxyParent = this;
}
Bind( bindParent.GetEntity(), true );
}
示例7: Precache
void CCeilingTurret::Spawn()
{
Precache( );
SetModel( "models/combine_turrets/ceiling_turret.mdl" );
BaseClass::Spawn( );
m_iHealth = sk_turret_health.GetFloat();
m_HackedGunPos = Vector( 0, 0, 12.75 );
AngleVectors( GetAngles(), NULL, NULL, &m_vecViewOffset );
m_vecViewOffset = m_vecViewOffset * Vector( 0, 0, -64 );
m_flFieldOfView = VIEW_FIELD_FULL;
m_iRetractHeight = 16;
m_iDeployHeight = 32;
m_iMinPitch = -45;
UTIL_SetSize(this, Vector(-32, -32, -m_iRetractHeight), Vector(32, 32, m_iRetractHeight));
SetThink(Initialize);
m_pEyeGlow = CSprite::SpriteCreate( TURRET_GLOW_SPRITE, GetOrigin(), FALSE );
m_pEyeGlow->SetTransparency( kRenderGlow, 255, 0, 0, 0, kRenderFxNoDissipation );
m_pEyeGlow->SetAttachment( this, 2 );
m_eyeBrightness = 0;
SetNextThink( gpGlobals->curtime + 0.3 );
}
示例8: Vector2D
void LaserBeam::OnCollision(ICollidable *other)
{
Entity *entity = (Entity*)other;
Damage_t damage;
damage.damage = entity->GetHealth();
if (entity->IsPlayer())
{
damage.damage = 1;
}
damage.direction = Vector2D(-1, 0);
damage.inflictor = GetOwner();
if (GetOwner() != nullptr)
{
damage.statsInflictorName = GetOwner()->GetEntityClassName();
damage.statsInflictorClass = GetOwner()->GetEntityResourceClass();
}
damage.statsWeaponName = GetEntityClassName();
damage.statsWeaponClass = GetEntityResourceClass();
entity->TakeDamage(damage);
Vector2D laserCenter = GetOrigin();
laserCenter.x = entity->GetOrigin().x;
GetGameContext()->GetParticleRoot()->CreateParticles("laser_cannon_hit", laserCenter, Vector2D(-1, 0));
}
示例9: MOZ_ASSERT
void
CDMProxy::Init(PromiseId aPromiseId)
{
MOZ_ASSERT(NS_IsMainThread());
nsresult rv = mKeys->GetOrigin(mOrigin);
if (NS_FAILED(rv)) {
RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
EME_LOG("Creating CDMProxy for origin='%s'",
NS_ConvertUTF16toUTF8(GetOrigin()).get());
if (!mGMPThread) {
nsCOMPtr<mozIGeckoMediaPluginService> mps =
do_GetService("@mozilla.org/gecko-media-plugin-service;1");
if (!mps) {
RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
mps->GetThread(getter_AddRefs(mGMPThread));
if (!mGMPThread) {
RejectPromise(aPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
}
nsRefPtr<nsIRunnable> task(NS_NewRunnableMethodWithArg<uint32_t>(this, &CDMProxy::gmp_Init, aPromiseId));
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
}
示例10: GetAxis
END_CLASS
void hhShuttleTransport::Spawn() {
dockingBeam = NULL;
dockedShuttle = NULL;
shuttleCount = 0;
bLocked = false;
amountHealth = spawnArgs.GetInt("amounthealth");
amountPower = spawnArgs.GetInt("amountpower");
bCanExitLocked = spawnArgs.GetBool("canExitLocked");
bLockOnEntry = spawnArgs.GetBool("lockOnEntry");
bAllowFiring = spawnArgs.GetBool("allowFiring");
offsetNozzle = spawnArgs.GetVector("offset_nozzle1");
// offsetNozzle2 = spawnArgs.GetVector("offset_nozzle2");
offsetShuttlePoint = spawnArgs.GetVector("offset_shuttlepoint");
// dockingBeam = SpawnDockingBeam(offsetNozzle);
dockingForce.SetRestoreFactor(spawnArgs.GetFloat("dockingforce"));
dockingForce.SetTarget(GetOrigin() + offsetShuttlePoint * GetAxis());
// Fade in
SetShaderParm(SHADERPARM_TIMEOFFSET, -MS2SEC(gameLocal.time)); // Growth start time
SetShaderParm(5, 1.0f); // Growth direction (in)
SetShaderParm(6, 1.0f); // Make Beam opaque
StartSound("snd_fadein", SND_CHANNEL_ANY);
}
示例11: GetAxis
Matrix4 Matrix4::InversedFast() const {
Matrix4 out = Matrix4::Identity();
Vector3 axis1 = GetAxis(0);
Vector3 axis2 = GetAxis(1);
Vector3 axis3 = GetAxis(2);
Vector3 norm1 = axis1 / axis1.GetPoweredLength();
Vector3 norm2 = axis2 / axis2.GetPoweredLength();
Vector3 norm3 = axis3 / axis3.GetPoweredLength();
out.m[0] = norm1.x;
out.m[1] = norm2.x;
out.m[2] = norm3.x;
out.m[4] = norm1.y;
out.m[5] = norm2.y;
out.m[6] = norm3.y;
out.m[8] = norm1.z;
out.m[9] = norm2.z;
out.m[10] = norm3.z;
Vector3 s = (out * GetOrigin()).GetXYZ();
out.m[12] = -s.x;
out.m[13] = -s.y;
out.m[14] = -s.z;
return out;
}
示例12: ASSERT
/////////////////////////////////////////////////////////////////////////////
// CMyListCtrl message handlers
void CMyListCtrl::OnBeginDrag(LPNMHDR pnmhdr, LRESULT *pResult)
{
CPoint ptItem, ptAction, ptImage;
NM_LISTVIEW *pnmListView = (NM_LISTVIEW *)pnmhdr;
((CListCtrlPage *)GetParent())->ShowNotification(pnmhdr, pResult);
ASSERT(!m_bDragging);
m_bDragging = TRUE;
m_iItemDrag = pnmListView->iItem;
ptAction = pnmListView->ptAction;
GetItemPosition(m_iItemDrag, &ptItem); // ptItem is relative to (0,0) and not the view origin
GetOrigin(&m_ptOrigin);
ASSERT(m_pimageListDrag == NULL);
m_pimageListDrag = CreateDragImage(m_iItemDrag, &ptImage);
m_sizeDelta = ptAction - ptImage; // difference between cursor pos and image pos
m_ptHotSpot = ptAction - ptItem + m_ptOrigin; // calculate hotspot for the cursor
m_pimageListDrag->DragShowNolock(TRUE); // lock updates and show drag image
m_pimageListDrag->SetDragCursorImage(0, m_ptHotSpot); // define the hot spot for the new cursor image
m_pimageListDrag->BeginDrag(0, CPoint(0, 0));
ptAction -= m_sizeDelta;
m_pimageListDrag->DragEnter(this, ptAction);
m_pimageListDrag->DragMove(ptAction); // move image to overlap original icon
SetCapture();
}
示例13: GetExtendedStyle
void CMyListCtrl::OnBeginDrag(LPNMHDR pnmhdr,LRESULT*)
{
CPoint ptItem,ptAction,ptImage;
NM_LISTVIEW *pnmListView = (NM_LISTVIEW *)pnmhdr;
m_oldDNDStyle = GetExtendedStyle();
if(m_oldDNDStyle != 0)SetExtendedStyle(0);
ASSERT(!m_bDragging);
m_bDragging = TRUE;
m_iItemDrag = pnmListView->iItem;
ptAction = pnmListView->ptAction;
GetItemPosition(m_iItemDrag,&ptItem);
GetOrigin(&m_ptOrigin);
ASSERT(m_pImageListDrag == NULL);
m_pImageListDrag = CreateDragImage(m_iItemDrag,&ptImage);
m_sizeDelta = ptAction - ptImage;
m_ptHotSpot = ptAction - ptItem + m_ptOrigin;
m_pImageListDrag->DragShowNolock(TRUE);
m_pImageListDrag->SetDragCursorImage(0,CPoint(0,0));
m_pImageListDrag->BeginDrag(0,CPoint(0,0));
ptAction -=m_sizeDelta;
m_pImageListDrag->DragEnter(this,ptAction);
m_pImageListDrag->DragMove(ptAction);
m_iItemDrop = -1;
SetCapture();
}
示例14: GetOrigin
void hhCenturion::AimedAttackMissile( const char *jointname, const idDict *projDef) {
idProjectile *proj;
idVec3 target, origin = GetOrigin();
bool inShuttle = false;
if ( shootTarget.IsValid() ) {
target = shootTarget->GetOrigin();
} else if ( enemy.IsValid() ) {
target = enemy->GetOrigin();
if ( enemy->IsType( idActor::Type ) ) {
target.z += enemy->EyeHeight() / 4.0f;
}
} else {
// No target? Do the default attack
Event_AttackMissile( jointname, projDef, 1 );
return;
}
// If target is too close do a non-aimed attack
if ( fabsf( origin.x - target.x ) < 256 &&
fabsf( origin.y - target.y ) < 256 ) {
Event_AttackMissile( jointname, projDef, 1 );
return;
}
idVec3 dist = origin - target;
if ( shootTarget.IsValid() ) {
proj = LaunchProjectile( jointname, shootTarget.GetEntity(), true, projDef );
} else {
proj = LaunchProjectile( jointname, enemy.GetEntity(), true, projDef );
}
}
示例15: GetOrigin
void TextShape::BoundingBox(Point& bottemLeft, Point& topRight) const
{
Coord bottem , left , width , height;
GetOrigin(bottem, left);
GetExtent(width, height);
bottemLeft = Point(bottem , left);
topRight = Point(bottem+height, left+width);
}