コード例 #1
0
//--------------------------------------------------------------
void Page::draw()
{
    preDraw();
    fillDraw();
    meshDraw();
    postDraw();
}
コード例 #2
0
ファイル: RigidBody.cpp プロジェクト: bagobor/tx
void RigidBody::draw(Interface* interface) {
	ResourceManager* rm = interface->getResourceManager();
	if(!rm || !isVisible()) {
		return;
	}

	Visual& model = getVisual();
	if(!&model) {
		return;
	}

	if(!body_) {
		Object::draw(interface);
		return;
	}

	glPushMatrix();

	btScalar m[16];
	btTransform &transform = body_->getWorldTransform();
	transform.getOpenGLMatrix(m);

	glMultMatrixf(m);

	/*glDisable(GL_LIGHTING);
	drawCube();
	glEnable(GL_LIGHTING);*/

	preDraw(interface);
	model.draw(interface);
	postDraw(interface);

	glPopMatrix();
}
コード例 #3
0
ファイル: GlutApp.cpp プロジェクト: mr-mo/oplo
	void GlutApp::drawFunc()
	{
		update();
		preDraw();
		draw();
		postDraw();
	}
コード例 #4
0
void KnotsViewer::paintEvent(QPaintEvent *event)
{
    Q_UNUSED(event)
    QPainter painter;
    painter.begin(this);
    painter.setRenderHint(QPainter::Antialiasing);

    // Save current OpenGL state
    glPushAttrib(GL_ALL_ATTRIB_BITS);
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();

    // Classical 3D drawing, usually performed by paintGL().
    preDraw();
    draw();
    postDraw();

    // Restore OpenGL state
    glMatrixMode(GL_MODELVIEW);
    glPopMatrix();
    glMatrixMode(GL_PROJECTION);
    glPopMatrix();
    glPopAttrib();

    if(bcurvature_show)
        draw_curvature_colorbar(&painter);
    if (berrordomainview)
        draw_curvature_error_colorbar(&painter);
    if (berror_show)
        draw_fitting_error_colorbar(&painter);
    painter.end();
    swapBuffers( );
}
コード例 #5
0
ファイル: b2thread.cpp プロジェクト: makeworld/Box2D
void B2Thread::run()
{
  init();

  float32 timeStep = 1.0f / 60.0f;
  int32 velocityIterations = 8;
  int32 positionIterations = 3;

  QElapsedTimer timer;
  timer.start();

  for(int step = 0; m_playing; ++step){
    {
      QMutexLocker locker(&m_mutex);
      m_b2world.Step(timeStep, velocityIterations, positionIterations);
    }

    emit preDraw();

    {
      QMutexLocker locker(&m_mutex);
      m_b2world.DrawDebugData();
    }

    qint64 remain = static_cast<qint64>(step * timeStep * 1000.0f - timer.elapsed());
    if(remain > 0){
      msleep(remain);
    }

    emit postDraw();
  }
}
コード例 #6
0
ファイル: Piece.cpp プロジェクト: JoaoLReis/OpenGL
void Piece::draw(glm::mat4 viewMatrix, glm::mat4 projectionMatrix, glm::vec3 cameraEye)
{
	prepareDraw(viewMatrix, projectionMatrix);

	sendModelMatrix(viewMatrix, createModelMatrix());

	bindDraw();

	postDraw();
}
コード例 #7
0
void WorldObjectEffect::drawInternal(DrawInfo &di)
{
	int frameIndex = xapp().getCurrentBackBufferIndex();
	if (inThreadOperation) {
		//mutex_Object.lock();
		threadLocal.commandList->RSSetViewports(1, &threadLocal.vr_eyesm[di.eyeNum].viewports[di.eyeNum]);
		threadLocal.commandList->RSSetScissorRects(1, &threadLocal.vr_eyesm[di.eyeNum].scissorRects[di.eyeNum]);
		//threadLocal.commandList->RSSetViewports(1, xapp().vr.getViewportByIndex(di.eyeNum));
		//threadLocal.commandList->RSSetScissorRects(1, xapp().vr.getScissorRectByIndex(di.eyeNum));
		threadLocal.commandList->SetGraphicsRootConstantBufferView(0, getCBVVirtualAddress(frameIndex, di.threadNum, di.objectNum, di.eyeNum));
		threadLocal.commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
		// update buffers for this text line:
		//XMStoreFloat4x4(&cbv.wvp, wvp);
		//cbv.rot = lines[0].rot;
		//memcpy(cbvGPUDest, &cbv, sizeof(cbv));
		threadLocal.commandList->IASetVertexBuffers(0, 1, &di.mesh->vertexBufferView);
		threadLocal.commandList->IASetIndexBuffer(&di.mesh->indexBufferView);
		//auto *tex = xapp().textureStore.getTexture(elvec.first);
		// Set SRV
		ID3D12DescriptorHeap* ppHeaps[] = { di.tex->m_srvHeap.Get() };
		threadLocal.commandList->SetDescriptorHeaps(_countof(ppHeaps), ppHeaps);
		threadLocal.commandList->SetGraphicsRootDescriptorTable(2, di.tex->m_srvHeap->GetGPUDescriptorHandleForHeapStart());
		threadLocal.commandList->DrawIndexedInstanced(di.numIndexes, 1, 0, 0, 0);
		//Log("draw frame/thread/obj/eye " << frameIndex << " " << di.threadNum << " " << di.objectNum << " " << di.eyeNum << endl);
		//this_thread::sleep_for(20ms);
		//mutex_Object.unlock();
		return;
	}
	mutex_Object.lock();
	preDraw(di);
	commandLists[frameIndex]->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
	// update buffers for this text line:
	//XMStoreFloat4x4(&cbv.wvp, wvp);
	//cbv.rot = lines[0].rot;
	//memcpy(cbvGPUDest, &cbv, sizeof(cbv));
	if (inBulkOperation) {
		commandLists[frameIndex]->RSSetViewports(1, &vr_eyes.viewports[di.eyeNum]);
		commandLists[frameIndex]->RSSetScissorRects(1, &vr_eyes.scissorRects[di.eyeNum]);
		//commandLists[frameIndex]->RSSetViewports(1, xapp().vr.getViewport());
		//commandLists[frameIndex]->RSSetScissorRects(1, xapp().vr.getScissorRect());
		commandLists[frameIndex]->SetGraphicsRootConstantBufferView(0, getCBVVirtualAddress(frameIndex, di.threadNum, di.objectNum, di.eyeNum));
	}
	commandLists[frameIndex]->IASetVertexBuffers(0, 1, &di.mesh->vertexBufferView);
	commandLists[frameIndex]->IASetIndexBuffer(&di.mesh->indexBufferView);
	//auto *tex = xapp().textureStore.getTexture(elvec.first);
	// Set SRV
	ID3D12DescriptorHeap* ppHeaps[] = { di.tex->m_srvHeap.Get() };
	commandLists[frameIndex]->SetDescriptorHeaps(_countof(ppHeaps), ppHeaps);
	commandLists[frameIndex]->SetGraphicsRootDescriptorTable(2, di.tex->m_srvHeap->GetGPUDescriptorHandleForHeapStart());
	commandLists[frameIndex]->DrawIndexedInstanced(di.numIndexes, 1, 0, 0, 0);
	postDraw();
	mutex_Object.unlock();
	//Sleep(50);
}
コード例 #8
0
void GLWidget::paintGL()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

    glTranslatef(0,0,-1000);
    glRotatef(rotx,1,0,0);
    glRotatef(roty,0,1,0);

    preDraw();
    draw();
    postDraw();
}
コード例 #9
0
	// Draws all the windows.  Called in a idle callback
void sgGlutApp::idleDraw()
{
	for(int i=0; i<256; i++)
	{
		if(win[i] != NULL)
		{
			glutSetWindow(i);
			preDraw();			// Do any special pre-Draw
			win[i]->draw();
			postDraw();			// Same for post draw
			glutSwapBuffers();		// Done drawing.  Swap em
		}
	}
}
コード例 #10
0
ファイル: VModel.cpp プロジェクト: bagobor/tx
/**
 * Retrieves the model data from the resource manager and rraws the
 * Model to screen using RCBC.
 * @param rm The ResourceManager to use to load the model
 */
void VModel::draw(Interface* interface) {
	if(!interface) {
		return;
	}
	
	if(!isVisible() && interface->getEditMode() == MODE_NONE) {
		return;
	}

	ResourceManager* rm = interface->getResourceManager();
	if(!rm) {
		return;
	}
	Model* model = rm->loadModel(filename_);

	bool selected;
	Object* object = interface->getSelectedObject();
	if(object) {
		Visual* visual = &object->getVisual();
		selected = (this == visual);
		glEnable(GL_COLOR_MATERIAL);
		glColor3f(1.0f, 0.2f, 0.2f);
		//DEBUG_H("Drawing selected. %s", object->getTag().c_str());
		//glEnable
	}

	if(!selected) {
		//DEBUG_H("Drawing selected. %s", object->getTag().c_str());
		glColor3f(1.0f, 1.0f, 1.0f);

		// If we are editing, draw visible objects
		if(!isVisible() && interface->getEditMode() != MODE_NONE) {
			glColor4f(0.5f, 0.5f, 1.0f, 0.5f);
		} else 

		glDisable(GL_COLOR_MATERIAL);
	}

	preDraw(interface);

	RCBC_Render(model);
	postDraw(interface);
}
コード例 #11
0
ファイル: Canvas.cpp プロジェクト: 244xiao/blender
void Canvas::Draw()
{
	if (_StyleModules.empty())
		return;
	preDraw();
	TimeStamp *timestamp = TimeStamp::instance();

	for (unsigned int i = 0; i < _StyleModules.size(); ++i) {
		_current_sm = _StyleModules[i];

		if (i < _Layers.size() && _Layers[i])
			delete _Layers[i];

		_Layers[i] = _StyleModules[i]->execute();
		if (!_Layers[i])
			continue;

		stroke_count += _Layers[i]->strokes_size();

		timestamp->increment();
	}
	postDraw();
}
コード例 #12
0
void WorldObjectEffect::endBulkUpdate()
{
	inBulkOperation = false;
	if (inThreadOperation) return;
	postDraw();
}
コード例 #13
0
ファイル: Scene.cpp プロジェクト: m1keall1son/Ecstatic
 void Scene::handleSceneDraw(EventDataRef event)
 {
     auto e = std::dynamic_pointer_cast<SceneDrawEvent>(event);
     draw();
     postDraw();
 }