Example #1
0
void Console::Render()
{
	if( !is_active ) {
		return;
	}
	
	RenderBones();
	RenderHistory();
	RenderInputLine();
	RenderTypeSuggestions();
	RenderDebug();
}
void MeshLoader::Render() {
	static double lastPlaying = 0.;

	currentTime += clock() / double(CLOCKS_PER_SEC) - lastPlaying;
	double time = currentTime;
	aiAnimation* mAnim = mAnimator->CurrentAnim();
	if (mAnim && mAnim->mDuration > 0.0) {
		double tps = mAnim->mTicksPerSecond ? mAnim->mTicksPerSecond : 25.f;
		time = fmod(time, mAnim->mDuration / tps);
	}
	mAnimator->Calculate(time);
	lastPlaying = currentTime;

	glEnable(GL_LIGHTING);
	RenderMesh(m_Scene->mRootNode);

	if (r_Skeleton) {
		RenderBones(m_Scene->mRootNode);
	}
	glDisable(GL_LIGHTING);
}
Example #3
0
void CEditableObject::RenderSkeletonSingle(const Fmatrix& parent)
{
	RenderSingle(parent);
    RenderBones(parent);
}
void ModelViewerRender::Render()
{
	if(!m_bInitilized) return ;//haven't initialized

	m_pDevice->getTimer()->tick();
	// Work out a frame delta time.
	const double frameDeltaTime = m_pDevice->getTimer()->GetElapsedTime() / 1000.0; // Time in seconds
	m_pRenderDevice->setRenderDeviceTime(m_pDevice->getTimer()->getTime(), frameDeltaTime);
	
	// notify the model current frame changed
	if(m_pMF1FileResource!=NULL&&m_pDynamicModel!=NULL)
		CModelControlDlg::NotifyPlayFrameChanged((int)(m_pDynamicModel->getAnimPlayedTime()/ISGPInstanceManager::DefaultSecondsPerFrame));
		
	m_pCamera->Update((float)frameDeltaTime);
	if(m_pDynamicModel!=NULL) m_pDynamicModel->update((float)frameDeltaTime);
	if(m_pStaticModel!=NULL) m_pStaticModel->update((float)frameDeltaTime);
	// update internal Camera position
	m_pRenderDevice->setViewMatrix3D( m_pCamera->GetRight(),m_pCamera->GetUp(),m_pCamera->GetDir(),m_pCamera->GetPos() );
	// calculate fps
	CalFPS(frameDeltaTime);
	
	ModelViewerConfig* pConfig=ModelViewerConfig::GetInstance();
	if(pConfig->m_bShowWireframe) glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
	else glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);

	m_pRenderDevice->setClearColor(pConfig->m_BkgndColor[0],pConfig->m_BkgndColor[1],\
		pConfig->m_BkgndColor[2],pConfig->m_BkgndColor[3]);

	m_pRenderDevice->beginScene(true,true,false);
	// render ground
	if(pConfig->m_bShowGround) RenderGround();
	// render model
	if(pConfig->m_bShowMesh)
	{
		if(m_pDynamicModel!=NULL) m_pDynamicModel->render();
		if(m_pStaticModel!=NULL) m_pStaticModel->render();
	}
	// render boundingbox
	if(pConfig->m_bShowBoundingBox&&m_pModelMF1!=NULL)
		RenderBoundingBox(m_pModelMF1->m_MeshAABBox);
	// render bones
	if(pConfig->m_bShowBones)
	{
		if(m_pDynamicModel!=NULL) RenderBones();
	}
	// render normals
	if(pConfig->m_bShowNormalLines)
	{
		if(m_pDynamicModel!=NULL) RenderDynamicNormals();
		if(m_pStaticModel!=NULL) RenderStaticNormals();
	}
	// render mesh box
	int meshcount=pConfig->m_bBoxShowVector.size();
	for(int i=0;i<meshcount&&m_pModelMF1!=NULL;++i)
	{
		// render mesh box
		if(pConfig->m_bBoxShowVector[i]==TRUE)
			RenderBoundingBox(m_pModelMF1->m_pLOD0Meshes[i].m_bbox);
	}
	
	// render coordinate axis
	RenderCoordinateAxis();
	
	// flush:draw objects
	m_pRenderDevice->FlushRenderBatch();

	// render attachment
	if(pConfig->m_bShowAttachment&&m_pModelMF1!=NULL) RenderAttachments();
	// render particle emitter
	if(pConfig->m_bShowParticleEmitter&&m_pModelMF1!=NULL) RenderParticleEmitter();
	m_pRenderDevice->FlushEditorLinesRenderBatch(true);

	m_pRenderDevice->BeginRenderText();
	RenderCoordinateLabel();
	RenderFPS();
	m_pRenderDevice->EndRenderText();

	m_pRenderDevice->endScene();
}