コード例 #1
0
void CRenderNode::frameMove(const Matrix& mWorld, double fTime, float fElapsedTime)
{
	updateWorldMatrix();
	m_mRealMatrix = mWorld;
	if (m_pParent&&m_pParent->getType()==NODE_SKELETON)
	{
		CSkeletonNode* pModel = (CSkeletonNode*)m_pParent;
		if (pModel->getSkeletonData())
		{
			// ----
			if (m_nBindingBoneID==-1)
			{
				m_nBindingBoneID = pModel->getSkeletonData()->getBoneIDByName(m_strBindingBoneName.c_str());
			}
			// ----
			if (m_nBindingBoneID>=0&&m_nBindingBoneID<pModel->getBonesMatrix().size())
			{
				Matrix mBoneLocal = pModel->getSkeletonData()->m_Bones[m_nBindingBoneID].m_mInvLocal;
				mBoneLocal.Invert();
				Matrix mBone = pModel->getBonesMatrix()[m_nBindingBoneID]*mBoneLocal;
				m_mRealMatrix *= mBone;
			}
		}
	}
	m_mRealMatrix *= m_mWorldMatrix;
	BBox bbox;
	FOR_IN(it,m_mapChildNode)
	{
		(*it)->frameMove(m_mRealMatrix, fTime, fElapsedTime);
		// ----
		// # Update BBox
		// ----
		bbox += (*it)->getWorldBBox();
	}
コード例 #2
0
ファイル: itemview.cpp プロジェクト: zoltanp/ktechlab-0.3
void CVBEditor::canvasResized(const QRect & oldSize, const QRect & newSize) {
	updateWorldMatrix();

	return;

	kdDebug() << k_funcinfo << endl;

	QPoint delta = oldSize.topLeft() - newSize.topLeft();
	delta *= p_itemView->zoomLevel();
	scrollBy(delta.x(), delta.y());
}
コード例 #3
0
//-----------------------------------------------------------------------------
// updateWorldMatrixParent()
//-----------------------------------------------------------------------------
void LLJoint::updateWorldMatrixParent()
{
	if (mDirtyFlags & MATRIX_DIRTY)
	{
		LLJoint *parent = getParent();
		if (parent)
		{
			parent->updateWorldMatrixParent();
		}
		updateWorldMatrix();
	}
}
コード例 #4
0
//-----------------------------------------------------------------------------
// updateWorldMatrixChildren()
//-----------------------------------------------------------------------------
void LLJoint::updateWorldMatrixChildren()
{	
	if (!this->mUpdateXform) return;

	if (mDirtyFlags & MATRIX_DIRTY)
	{
		updateWorldMatrix();
	}
	for (child_list_t::iterator iter = mChildren.begin();
		 iter != mChildren.end(); ++iter)
	{
		LLJoint* joint = *iter;
		joint->updateWorldMatrixChildren();
	}
}
コード例 #5
0
ファイル: GameObject.cpp プロジェクト: BSkin/MTG
GameObject::GameObject(string mPath, string tPath, string sPath, glm::vec3 position, glm::vec3 direction, glm::vec3 up)
{
	init();

	modelPath = mPath;
	texturePath = tPath;
	shaderPath = sPath;
	model = assetManager->getModel(modelPath);
	texture = assetManager->getTexture(texturePath);
	shader = assetManager->getShader(shaderPath);

	this->position = position;
	this->direction = direction;
	this->up = up;
	updateWorldMatrix();
}
コード例 #6
0
void baseObj::update(float dt)
{
	m_pAM->Update(dt);

	setDimensions(m_pAM->GetEngine(nAnimNumber)->GetCurrentFrame()->GetWidth(),
				m_pAM->GetEngine(nAnimNumber)->GetCurrentFrame()->GetHeight());

	pt anchor = *(pt*)(&m_pAM->GetEngine(nAnimNumber)->GetCurrentFrame()->pAnchor);
	rect draw = *(rect*)&m_pAM->GetEngine(nAnimNumber)->GetCurrentFrame()->rSource; 

	imgCenter.x = anchor.x - draw.left;
	imgCenter.y = anchor.y - draw.top;

	frameTime = dt;
	polyEditedThisFrame = false;
	updateWorldMatrix();
}
コード例 #7
0
ファイル: GameObject.cpp プロジェクト: BSkin/MTG
GameObject::GameObject(string mPath, string tPath, string sPath)
{
	init();

	modelPath = mPath;
	texturePath = tPath;
	shaderPath = sPath;
	model = assetManager->getModel(modelPath);
	texture = assetManager->getTexture(texturePath);
	shader = assetManager->getShader(shaderPath);

	position = glm::vec3(0,0,0);
	direction = glm::vec3(0,0,-1);
	up = glm::vec3(0,1,0);
	
	updateWorldMatrix();
}
コード例 #8
0
ファイル: BoidManager.cpp プロジェクト: hxshly/FYP
void BoidManager::updateBirdsPosition()
{
	XMVECTOR acceleration, Seek, Avoid, Align, Wall, CurPos;
	XMFLOAT4 newPos;

	float maxSpeed = 0.0f;
	maxSpeed += 10.0f;
	if (maxSpeed > 1.0f)
		maxSpeed = 1.0f;

	float seekFactor = 1.0f;
	float avoidFactor = 2.0f;
	float alignFactor = 1.0f;



	for (int i = 0; i < maxBirds; i++)
	{
		Seek = findSeek(*m_birds.at(i)) * seekFactor;
		Avoid = findAvoid(*m_birds.at(i)) * avoidFactor;
		Align = findAlign(*m_birds.at(i)) * alignFactor;
		
		//Calculate the desired vector
		acceleration = m_birds.at(i)->getVector() + Seek + Align + Avoid;

		//turn around if about to hit wall
		Wall = avoidWall(*m_birds.at(i), acceleration);
		acceleration = vMult(XMVector4Normalize(acceleration), Wall);
		

		CurPos = XMLoadFloat4(&m_birds.at(i)->getPosition());
		CurPos += acceleration;
		XMStoreFloat4(&newPos, CurPos);


		m_birds.at(i)->setVector(acceleration);
		m_birds.at(i)->setPosition(newPos);
		updateWorldMatrix(*m_birds.at(i));
	}

}
コード例 #9
0
ファイル: llviewerjoint.cpp プロジェクト: kow/Astra-Viewer-2
void LLViewerJointCollisionVolume::renderCollision()
{
	updateWorldMatrix();
	
	gGL.pushMatrix();
	glMultMatrixf( &mXform.getWorldMatrix().mMatrix[0][0] );

	gGL.color3f( 0.f, 0.f, 1.f );
	
	gGL.begin(LLRender::LINES);
	
	LLVector3 v[] = 
	{
		LLVector3(1,0,0),
		LLVector3(-1,0,0),
		LLVector3(0,1,0),
		LLVector3(0,-1,0),

		LLVector3(0,0,-1),
		LLVector3(0,0,1),
	};

	//sides
	gGL.vertex3fv(v[0].mV); 
	gGL.vertex3fv(v[2].mV);

	gGL.vertex3fv(v[0].mV); 
	gGL.vertex3fv(v[3].mV);

	gGL.vertex3fv(v[1].mV); 
	gGL.vertex3fv(v[2].mV);

	gGL.vertex3fv(v[1].mV); 
	gGL.vertex3fv(v[3].mV);


	//top
	gGL.vertex3fv(v[0].mV); 
	gGL.vertex3fv(v[4].mV);

	gGL.vertex3fv(v[1].mV); 
	gGL.vertex3fv(v[4].mV);

	gGL.vertex3fv(v[2].mV); 
	gGL.vertex3fv(v[4].mV);

	gGL.vertex3fv(v[3].mV); 
	gGL.vertex3fv(v[4].mV);


	//bottom
	gGL.vertex3fv(v[0].mV); 
	gGL.vertex3fv(v[5].mV);

	gGL.vertex3fv(v[1].mV); 
	gGL.vertex3fv(v[5].mV);

	gGL.vertex3fv(v[2].mV); 
	gGL.vertex3fv(v[5].mV);

	gGL.vertex3fv(v[3].mV); 
	gGL.vertex3fv(v[5].mV);

	gGL.end();

	gGL.popMatrix();
}
コード例 #10
0
void magnetGun::update(float dt)
{
	pos = owner->getPosition();
	pos.y -= 30;

	float mod = 0;
	if(((playerObj*)owner)->GetAnimNumber() == 1)
		mod -= 4;
	else
		mod += 4;

	mod *= owner->getFacing();
	pos.x += mod;
	if(target)
		aimVect = target->getPosition() - pos;
	else
		aimVect = theMouse->getPos() - pos;

	aimVect.normalize();

	if(fabs(pos.x - theMouse->getPos().x) > 3)
	{
	if(aimVect.x > 0)
		owner->setFacing(FACE_LEFT);
	else
		owner->setFacing(FACE_RIGHT);
	}

	updateWorldMatrix();

	if(mode != MAG_OFF)
	{
		if(target)
		{
			target->setVel(vector3());
			target->setAcc(vector3(0,-GRAVITY));
		}
		else
		{
		//	((movingObj*)owner)->setVel(vector3());
		//	((movingObj*)owner)->setAcc(vector3(0,-GRAVITY));
		}

		float len = 0;
		//vector3 traj = (theMouse->getPos() - pos).normalized();

#define traj aimVect
		switch(mode)
		{
		case MAG_PUSH:
			if(target)
			{
				if((target->getPosition() - pos).length() < range)
					target->modPos(traj * (power * dt));
			}
			else
				owner->modPos(traj * -(power * dt));
			break;
		case MAG_PULL:
			if(target)
				target->modPos(traj * -(power * dt));
			else
				owner->modPos(traj * (power * dt));
			break;
		case MAG_HOLD:
			traj = (theMouse->getPos() - target->getPosition());
			 len = traj.length();
			if(len > HOLDRANGE)
				ceaseFire();
			else if(len > 10)
				target->modPos(traj.normalized() * (power * 0.75f * dt));
			break;
		default:
			break;
		}
	}
}