Exemplo n.º 1
0
void BrushInstance::testSelectComponents (Selector& selector, SelectionTest& test, SelectionSystem::EComponentMode mode)
{
	test.BeginMesh(localToWorld());

	switch (mode) {
	case SelectionSystem::eVertex: {
		for (VertexInstances::iterator i = m_vertexInstances.begin(); i != m_vertexInstances.end(); ++i) {
			(*i).testSelect(selector, test);
		}
	}
		break;
	case SelectionSystem::eEdge: {
		for (EdgeInstances::iterator i = m_edgeInstances.begin(); i != m_edgeInstances.end(); ++i) {
			(*i).testSelect(selector, test);
		}
	}
		break;
	case SelectionSystem::eFace: {
		if (test.getVolume().fill()) {
			for (FaceInstances::iterator i = m_faceInstances.begin(); i != m_faceInstances.end(); ++i) {
				(*i).testSelect(selector, test);
			}
		} else {
			for (FaceInstances::iterator i = m_faceInstances.begin(); i != m_faceInstances.end(); ++i) {
				(*i).testSelect_centroid(selector, test);
			}
		}
	}
		break;
	default:
		break;
	}
}
Exemplo n.º 2
0
void BrushInstance::selectPlanes (Selector& selector, SelectionTest& test, const PlaneCallback& selectedPlaneCallback)
{
	test.BeginMesh(localToWorld());

	PlanePointer brushPlanes[c_brush_maxFaces];
	PlanesIterator j = brushPlanes;

	for (Brush::const_iterator i = m_brush.begin(); i != m_brush.end(); ++i) {
		*j++ = &(*i)->plane3();
	}

	for (FaceInstances::iterator i = m_faceInstances.begin(); i != m_faceInstances.end(); ++i) {
		(*i).selectPlane(selector, Line(test.getNear(), test.getFar()), brushPlanes, j, selectedPlaneCallback);
	}
}
Exemplo n.º 3
0
// Selection test
void MD5Surface::testSelect(Selector& selector,
							SelectionTest& test,
							const Matrix4& localToWorld)
{
	test.BeginMesh(localToWorld);

	SelectionIntersection best;
	test.TestTriangles(
	  vertexpointer_arbitrarymeshvertex(_vertices.data()),
	  IndexPointer(_indices.data(), IndexPointer::index_type(_indices.size())),
	  best
	);

	if(best.valid()) {
		selector.addIntersection(best);
	}
}
Exemplo n.º 4
0
inline void PointVertexArray_testSelect(VertexCb* first, std::size_t count,
	SelectionTest& test, SelectionIntersection& best)
{
	test.TestLineStrip(
	    VertexPointer(&first->vertex, sizeof(VertexCb)),
	    IndexPointer::index_type(count),
	    best
	);
}
Exemplo n.º 5
0
 void testSelectComponents(Selector& selector, SelectionTest& test, SelectionSystem::EComponentMode mode)
 {
   if(mode == SelectionSystem::eVertex)
   {
     test.BeginMesh(localToWorld());
     m_curveNURBS.testSelect(selector, test);
     m_curveCatmullRom.testSelect(selector, test);
   }
 }
Exemplo n.º 6
0
void NullModel::testSelect(Selector& selector, SelectionTest& test, const Matrix4& localToWorld) {
	test.BeginMesh(localToWorld);

	SelectionIntersection best;
	aabb_testselect(_aabbLocal, test, best);

	if(best.valid()) {
		selector.addIntersection(best);
	}
}
Exemplo n.º 7
0
void MiscParticle::testSelect (Selector& selector, SelectionTest& test, const Matrix4& localToWorld)
{
	test.BeginMesh(localToWorld);

	SelectionIntersection best;
	aabb_testselect(m_aabb_local, test, best);
	if (best.valid()) {
		selector.addIntersection(best);
	}
}
Exemplo n.º 8
0
inline void PointVertexArray_testSelect(PointVertex* first, std::size_t count, SelectionTest& test, SelectionIntersection& best)
{
  test.TestLineStrip(
    VertexPointer(
      reinterpret_cast<VertexPointer::pointer>(&first->vertex),
      sizeof(PointVertex)
    ),
    IndexPointer::index_type(count),
    best
  );
}
Exemplo n.º 9
0
void Doom3GroupNode::testSelectComponents(Selector& selector, SelectionTest& test, SelectionSystem::EComponentMode mode)
{
	if (mode == SelectionSystem::eVertex)
	{
		test.BeginMesh(localToWorld());

		_originInstance.testSelect(selector, test);

		_nurbsEditInstance.testSelect(selector, test);
		_catmullRomEditInstance.testSelect(selector, test);
	}
}
Exemplo n.º 10
0
void BrushInstance::testSelect (Selector& selector, SelectionTest& test)
{
	test.BeginMesh(localToWorld());

	SelectionIntersection best;
	for (FaceInstances::iterator i = m_faceInstances.begin(); i != m_faceInstances.end(); ++i) {
		(*i).testSelect(test, best);
	}
	if (best.valid()) {
		selector.addIntersection(best);
	}
}
Exemplo n.º 11
0
  void testSelect(Selector& selector, SelectionTest& test)
  {
    test.BeginMesh(localToWorld());
    SelectionIntersection best;

    m_contained.testSelect(selector, test, best);

    if(best.valid())
    {
      Selector_add(selector, getSelectable(), best);
    }
  }
Exemplo n.º 12
0
void Doom3GroupNode::testSelect(Selector& selector, SelectionTest& test)
{
	test.BeginMesh(localToWorld());
	SelectionIntersection best;

	// Pass the selection test to the Doom3Group class
	m_contained.testSelect(selector, test, best);

	// If the selectionIntersection is non-empty, add the selectable to the SelectionPool
	if (best.valid()) {
		Selector_add(selector, getSelectable(), best);
	}
}
Exemplo n.º 13
0
	// Perform selection test
	void RenderablePicoModel::testSelect (Selector& selector, SelectionTest& test, const Matrix4& localToWorld)
	{
		// Perform a volume intersection (AABB) check on each surface. For those
		// that intersect, call the surface's own testSelection method to perform
		// a proper selection test.
		for (SurfaceList::iterator i = _surfVec.begin(); i != _surfVec.end(); ++i) {
			// Check volume intersection
			if (test.getVolume().TestAABB(i->localAABB(), localToWorld) != VOLUME_OUTSIDE) {
				// Volume intersection passed, delegate the selection test
				i->testSelect(selector, test, localToWorld);
			}
		}
	}
Exemplo n.º 14
0
// Perform selection test for this surface
void RenderablePicoSurface::testSelect(Selector& selector,
									   SelectionTest& test,
									   const Matrix4& localToWorld) const
{
	if (!_vertices.empty() && !_indices.empty())
	{
		// Test for triangle selection
		test.BeginMesh(localToWorld);
		SelectionIntersection result;

		test.TestTriangles(
			VertexPointer(&_vertices[0].vertex, sizeof(ArbitraryMeshVertex)),
      		IndexPointer(&_indices[0],
      					 IndexPointer::index_type(_indices.size())),
			result
		);

		// Add the intersection to the selector if it is valid
		if(result.valid()) {
			selector.addIntersection(result);
		}
	}
}
Exemplo n.º 15
0
void CurveEditInstance::testSelect(Selector& selector, SelectionTest& test)
{
    ASSERT_MESSAGE(_controlPointsTransformed.size() == _selectables.size(), "curve instance mismatch");

    ControlPoints::const_iterator p = _controlPointsTransformed.begin();

    for(Selectables::iterator i = _selectables.begin(); i != _selectables.end(); ++i, ++p)
    {
    	SelectionIntersection best;
		test.TestPoint(*p, best);
		if (best.valid())
		{
			Selector_add(selector, *i, best);
		}
    }
}
Exemplo n.º 16
0
void LightNode::testSelectComponents(Selector& selector, SelectionTest& test, SelectionSystem::EComponentMode mode) {
	// Get the Origin of the Light Volume AABB (NOT the localAABB() which includes the light center)
	Vector3 lightOrigin = _light.lightAABB().origin;

	Matrix4 local2World = Matrix4::getTranslation(lightOrigin);

	test.BeginMesh(local2World);

	if (mode == SelectionSystem::eVertex) {
		if (_light.isProjected()) {
			// Test the projection components for selection
			_lightTargetInstance.testSelect(selector, test);
			_lightRightInstance.testSelect(selector, test);
			_lightUpInstance.testSelect(selector, test);
			_lightStartInstance.testSelect(selector, test);
			_lightEndInstance.testSelect(selector, test);
		}
		else {
			// Test if the light center is hit by the click
			_lightCenterInstance.testSelect(selector, test);
		}
	}
}
Exemplo n.º 17
0
void Winding::testSelect(SelectionTest& test, SelectionIntersection& best)
{
	if (empty()) return;

	test.TestPolygon(VertexPointer(&front().vertex, sizeof(WindingVertex)), size(), best);
}
Exemplo n.º 18
0
void LightNode::selectPlanes(Selector& selector, SelectionTest& test, const PlaneCallback& selectedPlaneCallback) {
	test.BeginMesh(localToWorld());
	// greebo: Make sure to use the local lightAABB() for the selection test, excluding the light center
	AABB localLightAABB(Vector3(0,0,0), _light.getDoom3Radius().m_radiusTransformed);
	m_dragPlanes.selectPlanes(localLightAABB, selector, test, selectedPlaneCallback, rotation());
}