Ejemplo n.º 1
0
BrushByPlaneClipper::BrushByPlaneClipper(
	const Vector3& p0, const Vector3& p1, const Vector3& p2,
	const TextureProjection& projection, EBrushSplit split) :
		_p0(p0),
		_p1(p1),
		_p2(p2),
		_projection(projection),
		_split(split),
		_useCaulk(GlobalClipper().useCaulkForNewFaces()),
		_caulkShader(GlobalClipper().getCaulkShader())
{}
Ejemplo n.º 2
0
void ToolChanged ()
{
	GlobalEventManager().setToggled("ToggleClipper", GlobalClipper().clipMode());
	GlobalEventManager().setToggled("MouseTranslate", GlobalSelectionSystem().ManipulatorMode()
			== SelectionSystem::eTranslate);
	GlobalEventManager().setToggled("MouseRotate", GlobalSelectionSystem().ManipulatorMode()
			== SelectionSystem::eRotate);
	GlobalEventManager().setToggled("MouseScale", GlobalSelectionSystem().ManipulatorMode() == SelectionSystem::eScale);
	GlobalEventManager().setToggled("MouseDrag", GlobalSelectionSystem().ManipulatorMode() == SelectionSystem::eDrag);
}
/// \todo Support view-dependent nudge.
void RadiantSelectionSystem::NudgeManipulator(const Vector3& nudge, const Vector3& view)
{
    if (ManipulatorMode() == eTranslate ||
        ManipulatorMode() == eDrag ||
        ManipulatorMode() == eClip)
    {
        translateSelected(nudge);

        // In clip mode, update the clipping plane
        if (ManipulatorMode() == eClip)
        {
            GlobalClipper().update();
        }
    }
}
Ejemplo n.º 4
0
void ScaleMode (void)
{
	if (g_pParentWnd->getCurrentToolMode() == ScaleMode && g_pParentWnd->getDefaultToolMode() != ScaleMode) {
		g_pParentWnd->getDefaultToolMode()();
	} else {
		g_pParentWnd->setCurrentToolMode(ScaleMode);
		g_currentToolModeSupportsComponentEditing = true;

		GlobalClipper().onClipMode(false);

		Sys_Status(c_ScaleMode_status);
		GlobalSelectionSystem().SetManipulatorMode(SelectionSystem::eScale);
		ToolChanged();
		ModeChangeNotify();
	}
}
Ejemplo n.º 5
0
// Specialised overload, called by the general nudgeSelected() routine
void nudgeSelected(ENudgeDirection direction, float amount, EViewType viewtype)
{
	AxisBase axes(AxisBase_forViewType(viewtype));

	Vector3 view_direction(-axes.z);
	Vector3 nudge(AxisBase_axisForDirection(axes, direction) * amount);

	if (GlobalSelectionSystem().ManipulatorMode() == SelectionSystem::eTranslate ||
        GlobalSelectionSystem().ManipulatorMode() == SelectionSystem::eDrag ||
        GlobalSelectionSystem().ManipulatorMode() == SelectionSystem::eClip)
    {
        GlobalSelectionSystem().translateSelected(nudge);

        // In clip mode, update the clipping plane
        if (GlobalSelectionSystem().ManipulatorMode() == SelectionSystem::eClip)
        {
            GlobalClipper().update();
        }
    }
}
Ejemplo n.º 6
0
void CamWnd::Cam_Draw() {
	glViewport(0, 0, m_Camera.width, m_Camera.height);

	// enable depth buffer writes
	glDepthMask(GL_TRUE);

	Vector3 clearColour(0, 0, 0);
	clearColour = ColourSchemes().getColourVector3("camera_background");

	glClearColor(clearColour[0], clearColour[1], clearColour[2], 0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	render::RenderStatistics::Instance().resetStats();

	Cull_ResetStats();

	glMatrixMode(GL_PROJECTION);
	glLoadMatrixf(m_Camera.projection);

	glMatrixMode(GL_MODELVIEW);
	glLoadMatrixf(m_Camera.modelview);

	// one directional light source directly behind the viewer
	{
		GLfloat inverse_cam_dir[4], ambient[4], diffuse[4];//, material[4];

		ambient[0] = ambient[1] = ambient[2] = 0.4f;
		ambient[3] = 1.0f;
		diffuse[0] = diffuse[1] = diffuse[2] = 0.4f;
		diffuse[3] = 1.0f;

		inverse_cam_dir[0] = m_Camera.vpn[0];
		inverse_cam_dir[1] = m_Camera.vpn[1];
		inverse_cam_dir[2] = m_Camera.vpn[2];
		inverse_cam_dir[3] = 0;

		glLightfv(GL_LIGHT0, GL_POSITION, inverse_cam_dir);

		glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
		glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);

		glEnable(GL_LIGHT0);
	}

	unsigned int globalstate = RENDER_DEPTHTEST | RENDER_COLOURWRITE | RENDER_DEPTHWRITE | RENDER_ALPHATEST
			| RENDER_BLEND | RENDER_CULLFACE | RENDER_COLOURARRAY | RENDER_COLOURCHANGE;
	switch (getCameraSettings()->getMode()) {
	case drawWire:
		break;
	case drawSolid:
		globalstate |= (RENDER_FILL | RENDER_LIGHTING | RENDER_SMOOTH | RENDER_SCALED);
		break;
	case drawTexture:
		globalstate |= (RENDER_FILL | RENDER_LIGHTING | RENDER_TEXTURE_2D | RENDER_SMOOTH | RENDER_SCALED);
		break;
	default:
		globalstate = 0;
		break;
	}

	if (!getCameraSettings()->solidSelectionBoxes()) {
		globalstate |= RENDER_LINESTIPPLE;
	}

	{
		CamRenderer renderer(globalstate, m_state_select2, m_state_select1, m_view.getViewer());

		Scene_Render(renderer, m_view);

		renderer.render(m_Camera.modelview, m_Camera.projection);
	}

	// greebo: Draw the clipper's points (skipping the depth-test)
	{
		glDisable(GL_DEPTH_TEST);

		glColor4f(1, 1, 1, 1);

		glPointSize(5);

		if (GlobalClipper().clipMode()) {
			GlobalClipper().draw(1.0f);
		}

		glPointSize(1);
	}

	// prepare for 2d stuff
	glColor4f(1, 1, 1, 1);
	glDisable(GL_BLEND);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0, (float) m_Camera.width, 0, (float) m_Camera.height, -100, 100);
	glScalef(1, -1, 1);
	glTranslatef(0, -(float) m_Camera.height, 0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	if (GlobalOpenGL().GL_1_3()) {
		glClientActiveTexture(GL_TEXTURE0);
		glActiveTexture(GL_TEXTURE0);
	}

	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
	glDisableClientState(GL_NORMAL_ARRAY);
	glDisableClientState(GL_COLOR_ARRAY);

	glDisable(GL_TEXTURE_2D);
	glDisable(GL_LIGHTING);
	glDisable(GL_COLOR_MATERIAL);
	glDisable(GL_DEPTH_TEST);
	glLineWidth(1);

	// draw the crosshair
	if (m_bFreeMove) {
		glBegin(GL_LINES);
		glVertex2f((float) m_Camera.width / 2.f, (float) m_Camera.height / 2.f + 6);
		glVertex2f((float) m_Camera.width / 2.f, (float) m_Camera.height / 2.f + 2);
		glVertex2f((float) m_Camera.width / 2.f, (float) m_Camera.height / 2.f - 6);
		glVertex2f((float) m_Camera.width / 2.f, (float) m_Camera.height / 2.f - 2);
		glVertex2f((float) m_Camera.width / 2.f + 6, (float) m_Camera.height / 2.f);
		glVertex2f((float) m_Camera.width / 2.f + 2, (float) m_Camera.height / 2.f);
		glVertex2f((float) m_Camera.width / 2.f - 6, (float) m_Camera.height / 2.f);
		glVertex2f((float) m_Camera.width / 2.f - 2, (float) m_Camera.height / 2.f);
		glEnd();
	}

	glRasterPos3f(1.0f, static_cast<float> (m_Camera.height) - 1.0f, 0.0f);
	GlobalOpenGL().drawString(render::RenderStatistics::Instance().getStatString());

	glRasterPos3f(1.0f, static_cast<float> (m_Camera.height) - 11.0f, 0.0f);
	GlobalOpenGL().drawString(Cull_GetStats());

	// bind back to the default texture so that we don't have problems
	// elsewhere using/modifying texture maps between contexts
	glBindTexture(GL_TEXTURE_2D, 0);
}