Beispiel #1
0
 void visit(scene::Instance& instance) const
 {
   if(Node_getEntity(instance.path().top()) != 0
     && node_is_group(instance.path().top()))
   {
     if(m_parent.top().get_pointer() != instance.path().top().get_pointer())
     {
       parentBrushes(instance.path().top(), m_parent.top());
       Path_deleteTop(instance.path());
     }
   }
 }
Beispiel #2
0
  void operator()(scene::Instance& instance) const
  {
    if(result == 0)
    {
		  const char* value = Node_getEntity(instance.path().top())->getKeyValue("targetname");

		  if(!strcmp(value, targetname))
		  {
			  result = &instance.path();
		  }
    }
  }
Beispiel #3
0
 void operator()(scene::Instance& instance)
 {
   if(instance.path().top().get().visible())
   {
     Functor::operator()(instance);
   }
 }
Beispiel #4
0
  void operator()(scene::Instance& instance) const
  {
		const char* classname = Node_getEntity(instance.path().top())->getKeyValue("classname");

		if(!strcmp(classname, "worldspawn"))
		{
			world.LoadFromEntity(instance.path().top(), false);
			world.RemoveNonCheckBrushes(exclusionList, true);
			world.SaveToFile(pFile);
		}
		else if(strstr(classname, "info_"))
		{
			world.ClearBrushes();
			world.ClearEPairs();
			world.LoadEPairList(Node_getEntity(instance.path().top()));
			world.SaveToFile(pFile);
		}
  }
inline void matrix4_assign_rotation_for_pivot(Matrix4& matrix, scene::Instance& instance) {
	Editable* editable = Node_getEditable(instance.path().top());
	// If the instance is editable, take the localpivot point into account, otherwise just apply the rotation
	if (editable != 0) {
		matrix4_assign_rotation(matrix, matrix4_multiplied_by_matrix4(instance.localToWorld(), editable->getLocalPivot()));
	}
	else {
		matrix4_assign_rotation(matrix, instance.localToWorld());
	}
}
Beispiel #6
0
void DPatch::LoadFromPatch( scene::Instance& patch ){
	QER_entity = patch.path().parent().get_pointer();
	QER_brush = patch.path().top().get_pointer();

	PatchControlMatrix matrix = GlobalPatchCreator().Patch_getControlPoints( patch.path().top() );

	width = static_cast<int>( matrix.x() );
	height = static_cast<int>( matrix.y() );

	for ( int x = 0; x < width; x++ )
	{
		for ( int y = 0; y < height; y++ )
		{
			PatchControl& p = matrix( x, y );
			points[x][y].xyz[0] = p.m_vertex[0];
			points[x][y].xyz[1] = p.m_vertex[1];
			points[x][y].xyz[2] = p.m_vertex[2];
			points[x][y].st[0] = p.m_texcoord[0];
			points[x][y].st[1] = p.m_texcoord[1];
		}
	}
	SetTexture( GlobalPatchCreator().Patch_getShader( patch.path().top() ) );

#if 0
	SetTexture( brush->pPatch->GetShader() );

	width = brush->pPatch->getWidth();
	height = brush->pPatch->getHeight();

	for ( int x = 0; x < height; x++ )
	{
		for ( int y = 0; y < width; y++ )
		{
			float *p = brush->pPatch->ctrlAt( ROW,x,y );
			p[0] = points[x][y].xyz[0];
			p[1] = points[x][y].xyz[1];
			p[2] = points[x][y].xyz[2];
			p[3] = points[x][y].st[0];
			p[4] = points[x][y].st[1];
		}
	}
#endif
}
Beispiel #7
0
  void operator()(scene::Instance& instance) const
  {
    if(!instance.isSelected())
    {
      return;
    }
		ent.LoadFromEntity(instance.path().top());

		DEPair* pEpair = ent.FindEPairByKey("origin");
		if(!pEpair) {
			return;
		}

		vec3_t vec, out;
		sscanf( pEpair->value.GetBuffer(), "%f %f %f", &vec[0], &vec[1], &vec[2]);

		planter.FindDropPoint( vec, out );

		char buffer[256];
		sprintf( buffer, "%f %f %f", out[0], out[1], out[2] );
		ent.AddEPair( "origin", buffer );
		ent.RemoveFromRadiant();
		ent.BuildInRadiant(false);
  }
Beispiel #8
0
void visit( scene::Instance& instance ) const {
	if ( Node_isPatch( instance.path().top() ) ) {
		m_functor( instance );
	}
}
Beispiel #9
0
		void visit (scene::Instance& instance) const
		{
			if (&m_parent != &instance.path()) {
				Path_parent(m_parent, instance.path());
			}
		}