Esempio n. 1
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CMaterial::Initialize( HWND hwnd )
{
	// NOTE: This gets set to true later upon creating a 3d view.
	g_materialSystemConfig = materials->GetCurrentConfigForVideoCard();
	InitMaterialSystemConfig( &g_materialSystemConfig );

	// Create a cache for material images (for browsing and uploading to the driver).
	if (g_pMaterialImageCache == NULL)
	{
		g_pMaterialImageCache = new CMaterialImageCache(500);
		if (g_pMaterialImageCache == NULL)
			return false ;
	}

	materials->OverrideConfig( g_materialSystemConfig, false );

	// Set the mode
	// When setting the mode, we need to grab the parent window
	// since that's going to enclose all our little render windows
	g_materialSystemConfig.m_VideoMode.m_Width = g_materialSystemConfig.m_VideoMode.m_Height = 0;
	g_materialSystemConfig.m_VideoMode.m_Format = IMAGE_FORMAT_BGRA8888;
	g_materialSystemConfig.m_VideoMode.m_RefreshRate = 0;
	g_materialSystemConfig.SetFlag( MATSYS_VIDCFG_FLAGS_WINDOWED, true );
	g_materialSystemConfig.SetFlag( MATSYS_VIDCFG_FLAGS_RESIZING, true );


	if (!MaterialSystemInterface()->SetMode( hwnd, g_materialSystemConfig ) )
		return false;

	return true;
}
//-----------------------------------------------------------------------------
// Purpose: Renders a selection gizmo at our bounds center.
// Input  : pRender - Rendering interface.
//-----------------------------------------------------------------------------
void Marker3D::RenderTool3D(CRender3D *pRender)
{
	if (!IsActiveTool())
	{
		return;
	}

	Vector *pPos;

	if (IsTranslating())
	{
		pPos = &m_vecTranslatePos;
	}
	else
	{
		if (IsEmpty())
		{
			return;
		}

		pPos = &m_vecPos;
	}
	
	//
	// Setup the renderer.
	//
	pRender->SetRenderMode(RENDER_MODE_WIREFRAME);

	CMeshBuilder meshBuilder;
	IMesh* pMesh = MaterialSystemInterface()->GetDynamicMesh();

	meshBuilder.Begin(pMesh, MATERIAL_LINES, 3);

	meshBuilder.Position3f(g_MIN_MAP_COORD, (*pPos)[1], (*pPos)[2]);
	meshBuilder.Color3ub(255, 0, 0);
	meshBuilder.AdvanceVertex();
	meshBuilder.Position3f(g_MAX_MAP_COORD, (*pPos)[1], (*pPos)[2]);
	meshBuilder.Color3ub(255, 0, 0);
	meshBuilder.AdvanceVertex();

	meshBuilder.Position3f((*pPos)[0], g_MIN_MAP_COORD, (*pPos)[2]);
	meshBuilder.Color3ub(0, 255, 0);
	meshBuilder.AdvanceVertex();
	meshBuilder.Position3f((*pPos)[0], g_MAX_MAP_COORD, (*pPos)[2]);
	meshBuilder.Color3ub(0, 255, 0);
	meshBuilder.AdvanceVertex();

	meshBuilder.Position3f((*pPos)[0], (*pPos)[1], g_MIN_MAP_COORD);
	meshBuilder.Color3ub(0, 0, 255);
	meshBuilder.AdvanceVertex();
	meshBuilder.Position3f((*pPos)[0], (*pPos)[1], g_MAX_MAP_COORD);
	meshBuilder.Color3ub(0, 0, 255);
	meshBuilder.AdvanceVertex();

	meshBuilder.End();
	pMesh->Draw();

	pRender->SetRenderMode(RENDER_MODE_DEFAULT);
}
void CTextureSystem::RebindDefaultCubeMap()
{
	// rebind with the default cubemap
	
	if (  m_pCubemapTexture )
	{
		CMatRenderContextPtr pRenderContext( MaterialSystemInterface() );
		pRenderContext->BindLocalCubemap( m_pCubemapTexture );
	}
}
//-----------------------------------------------------------------------------
// Purpose: Renders the connecting lines between the keyframes
// Input  : pRender - 
//-----------------------------------------------------------------------------
void CMapKeyFrame::Render3D( CRender3D *pRender )
{
	if ( m_bRebuildPath )
	{
		if (GetAnimator() != NULL)
		{
			GetAnimator()->RebuildPath();
		}
	}

	// only draw if we have a valid connection
	if ( m_pNextKeyFrame && m_flSpeed > 0 )
	{
		// only draw if we haven't already been drawn this frame
		if ( GetRenderFrame() != pRender->GetRenderFrame() )
		{
			pRender->PushRenderMode( RENDER_MODE_WIREFRAME );

			SetRenderFrame( pRender->GetRenderFrame() );

			Vector o1, o2;
			GetOrigin( o1 );
			m_pNextKeyFrame->GetOrigin( o2 );

			CMeshBuilder meshBuilder;
			CMatRenderContextPtr pRenderContext( MaterialSystemInterface() );
			IMesh *pMesh = pRenderContext->GetDynamicMesh();

			// draw connecting line going from green to red
			meshBuilder.Begin( pMesh, MATERIAL_LINE_STRIP, MAX_LINE_POINTS );

			// start point
			meshBuilder.Color3f( 0, 1.0f, 0 );
			meshBuilder.Position3f( o1[0], o1[1], o1[2] );
			meshBuilder.AdvanceVertex();

			for ( int i = 0; i < MAX_LINE_POINTS; i++ )
			{
				float red = (float)(i+1) / (float)MAX_LINE_POINTS;
				meshBuilder.Color3f( red, 1.0f - red, 0 );
				meshBuilder.Position3f( m_LinePoints[i][0], m_LinePoints[i][1], m_LinePoints[i][2] );
				meshBuilder.AdvanceVertex();
			}

			meshBuilder.End();
		    pMesh->Draw();

			pRender->PopRenderMode();
		}
	}

	
}
//-----------------------------------------------------------------------------
// Purpose: Loads textures from all texture files.
//-----------------------------------------------------------------------------
void CTextureSystem::ReloadTextures( const char *pFilterName )
{
	MaterialSystemInterface()->ReloadMaterials( pFilterName );

	for ( int i = 0; i < m_Textures.Count(); i++ )
	{
		if ( !Q_stristr( pFilterName, m_Textures[i]->GetName() ) )
			continue;

		m_Textures[i]->Reload( false );
	}
}
Esempio n. 6
0
void AllocateLightingPreviewtextures(void)
{
	static bool bHaveAllocated=false;
	if (! bHaveAllocated )
	{
		bHaveAllocated = true;
		MaterialSystemInterface()->BeginRenderTargetAllocation();
		for(int idx=0;idx<NELEMS(sg_ExtraFP16Targets);idx++)
			sg_ExtraFP16Targets[idx].Init(
				materials->CreateNamedRenderTargetTextureEx2(
					s_rt_names[idx],
					512, 512, RT_SIZE_DEFAULT, s_rt_formats[idx],
					MATERIAL_RT_DEPTH_SHARED, 
					TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT,
					CREATERENDERTARGETFLAGS_HDR )
				);
		
		// End block in which all render targets should be allocated (kicking off an Alt-Tab type
		// behavior)
		MaterialSystemInterface()->EndRenderTargetAllocation();
	}
}
Esempio n. 7
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pRender - 
//-----------------------------------------------------------------------------
void CMapLine::Render3D(CRender3D *pRender)
{
	if ( (m_pStartEntity == NULL) || (m_pEndEntity == NULL) )
		return;

	pRender->BeginRenderHitTarget(this);
	pRender->PushRenderMode(RENDER_MODE_WIREFRAME);
	
	Vector Start, End;
	
	m_pStartEntity->GetOrigin(Start);
	m_pEndEntity->GetOrigin(End);



	CMeshBuilder meshBuilder;
	CMatRenderContextPtr pRenderContext( MaterialSystemInterface() );
	IMesh* pMesh = pRenderContext->GetDynamicMesh();

	// FIXME: Can't do this...! glLineWidth(2);

	meshBuilder.Begin( pMesh, MATERIAL_LINES, 1 );

	unsigned char color[3];
	if (IsSelected())
	{
		color[0] = SELECT_EDGE_RED; 
		color[1] = SELECT_EDGE_GREEN;
		color[2] = SELECT_EDGE_BLUE;
	}
	else
	{
		color[0] = r;
		color[1] = g; 
		color[2] = b;
	}

	meshBuilder.Color3ubv( color );
	meshBuilder.Position3f(Start.x, Start.y, Start.z);
	meshBuilder.AdvanceVertex();

	meshBuilder.Color3ubv( color );
	meshBuilder.Position3f(End.x, End.y, End.z);
	meshBuilder.AdvanceVertex();

	meshBuilder.End();
	pMesh->Draw();

	pRender->EndRenderHitTarget();
	pRender->PopRenderMode();
}
//-----------------------------------------------------------------------------
// Purpose: Loads all the materials for the given game config.
//-----------------------------------------------------------------------------
void CTextureSystem::LoadMaterials(CGameConfig *pConfig)
{
	CTextureGroup *pGroup = new CTextureGroup("Materials");
	pGroup->SetTextureFormat(tfVMT);
	m_pActiveContext->Groups.AddToTail(pGroup);

	// Add all the materials to the group.
	CMaterial::EnumerateMaterials( this, "materials", (int)pGroup, INCLUDE_WORLD_MATERIALS );
	
	// Watch the materials directory recursively...
	CMaterialFileChangeWatcher *pWatcher = new CMaterialFileChangeWatcher;
	pWatcher->Init( this, (int)pGroup );
	m_ChangeWatchers.AddToTail( pWatcher );

	Assert( m_pCubemapTexture == NULL );

	m_pCubemapTexture = MaterialSystemInterface()->FindTexture( "editor/cubemap", NULL, true );

	if ( m_pCubemapTexture )
	{
		m_pCubemapTexture->IncrementReferenceCount();
		CMatRenderContextPtr pRenderContext( MaterialSystemInterface() );
		pRenderContext->BindLocalCubemap( m_pCubemapTexture );
	}
	
	// Get the nodraw texture.
	m_pNoDrawTexture = NULL;
	for ( int i=0; i < m_Textures.Count(); i++ )
	{
		if ( V_stricmp( m_Textures[i]->GetName(), "tools/toolsnodraw" ) == 0 || V_stricmp( m_Textures[i]->GetName(), "tools/toolsnodraw" ) == 0 )
		{
			m_pNoDrawTexture = m_Textures[i];
			break;
		}
	}
	if ( !m_pNoDrawTexture )				
		m_pNoDrawTexture = CMaterial::CreateMaterial( "tools/toolsnodraw", true );
}
//-----------------------------------------------------------------------------
// Purpose: Renders us in the 3D view.
// Input  : pRender - Interface to use for rendering.
//-----------------------------------------------------------------------------
void CMapSideList::Render3D(CRender3D *pRender)
{
	if (Parent->IsSelected())
	{
		//
		// Draw lines from us to the center of all faces in the list.
		//
		pRender->SetRenderMode(RENDER_MODE_WIREFRAME);

		CMeshBuilder meshBuilder;
		IMesh *pMesh = MaterialSystemInterface()->GetDynamicMesh();

		meshBuilder.Begin(pMesh, MATERIAL_LINES, m_Faces.Count());

		for (int i = 0; i < m_Faces.Count(); i++)
		{
			CMapFace *pFace = m_Faces.Element(i);

			Vector Center;
			pFace->GetCenter(Center);

			unsigned char color[3];
			color[0] = SELECT_EDGE_RED; 
			color[1] = SELECT_EDGE_GREEN;
			color[2] = SELECT_EDGE_BLUE;

			meshBuilder.Color3ubv( color );
			meshBuilder.Position3f(m_Origin.x, m_Origin.y, m_Origin.z);
			meshBuilder.AdvanceVertex();

			meshBuilder.Color3ubv( color );
			meshBuilder.Position3f(Center.x, Center.y, Center.z);
			meshBuilder.AdvanceVertex();
		}

		meshBuilder.End();
		pMesh->Draw();
	}
}
Esempio n. 10
0
void CGizmo::DrawGizmoAxis(CRender3D *pRender, Vector& Origin, 
						   Vector& EndPoint, int red, int green, int blue, 
						   unsigned int uAxisHandle)
{
	CCamera *pCamera = pRender->GetCamera();

	Vector ViewUp;
	pCamera->GetViewUp(ViewUp);

	Vector ViewPoint;
	Vector ViewForward;
	pCamera->GetViewPoint(ViewPoint);
	VectorSubtract(Origin, ViewPoint, ViewForward);

	Vector Axis;
	VectorSubtract(EndPoint, Origin, Axis);

	CrossProduct(ViewForward, Axis, ViewUp);
	VectorNormalize(ViewUp);

	Vector Start;
	Vector End;

	//
	// Draw the first segment of the gizmo axis.
	//
	VectorMA(Origin, 0.1, Axis, Start);
	VectorMA(Origin, 0.25, Axis, End);
	
	pRender->BindTexture( g_pAxisTexture );
	
	CMeshBuilder meshBuilder;

	CMatRenderContextPtr pRenderContext( MaterialSystemInterface() );
	IMesh* pMesh = pRenderContext->GetDynamicMesh( );
	meshBuilder.Begin( pMesh, MATERIAL_POLYGON, 4 );

	meshBuilder.TexCoord2f(0, 0, 0);
	meshBuilder.Position3f(Start[0] - ViewUp[0] * GIZMO_AXIS_WIDTH, Start[1] - ViewUp[1] * GIZMO_AXIS_WIDTH, Start[2] - ViewUp[2] * GIZMO_AXIS_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f(0, 2, 0);
	meshBuilder.Position3f(End[0] - ViewUp[0] * GIZMO_AXIS_WIDTH, End[1] - ViewUp[1] * GIZMO_AXIS_WIDTH, End[2] - ViewUp[2] * GIZMO_AXIS_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f(0, 2, 1);
	meshBuilder.Position3f(End[0] + ViewUp[0] * GIZMO_AXIS_WIDTH, End[1] + ViewUp[1] * GIZMO_AXIS_WIDTH, End[2] + ViewUp[2] * GIZMO_AXIS_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f(0, 0, 1);
	meshBuilder.Position3f(Start[0] + ViewUp[0] * GIZMO_AXIS_WIDTH, Start[1] + ViewUp[1] * GIZMO_AXIS_WIDTH, Start[2] + ViewUp[2] * GIZMO_AXIS_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.End();
	pMesh->Draw();

	//
	// Draw the scale handle.
	//
	Start = End;
	VectorMA(Origin, 0.35, Axis, End);
	
	pRender->BeginRenderHitTarget(this, uAxisHandle + GIZMO_HANDLE_SCALE);

	pRender->BindTexture( g_pScaleHandleTexture );

	pMesh = pRenderContext->GetDynamicMesh( );
	meshBuilder.Begin( pMesh, MATERIAL_POLYGON, 4 );

	meshBuilder.TexCoord2f( 0, 0, 0);
	meshBuilder.Position3f(Start[0] - ViewUp[0] * GIZMO_HANDLE_WIDTH, Start[1] - ViewUp[1] * GIZMO_HANDLE_WIDTH, Start[2] - ViewUp[2] * GIZMO_HANDLE_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f( 0, 1, 0);
	meshBuilder.Position3f(End[0] - ViewUp[0] * GIZMO_HANDLE_WIDTH, End[1] - ViewUp[1] * GIZMO_HANDLE_WIDTH, End[2] - ViewUp[2] * GIZMO_HANDLE_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f( 0, 1, 1);
	meshBuilder.Position3f(End[0] + ViewUp[0] * GIZMO_HANDLE_WIDTH, End[1] + ViewUp[1] * GIZMO_HANDLE_WIDTH, End[2] + ViewUp[2] * GIZMO_HANDLE_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f( 0, 0, 1);
	meshBuilder.Position3f(Start[0] + ViewUp[0] * GIZMO_HANDLE_WIDTH, Start[1] + ViewUp[1] * GIZMO_HANDLE_WIDTH, Start[2] + ViewUp[2] * GIZMO_HANDLE_WIDTH);
	meshBuilder.AdvanceVertex();

	meshBuilder.End();
	pMesh->Draw();

	pRender->EndRenderHitTarget();

	//
	// Draw the second segment of the gizmo axis.
	//
	Start = End;
	VectorMA(Origin, 0.5, Axis, End);
	
	pRender->BindTexture( g_pAxisTexture );

	pMesh = pRenderContext->GetDynamicMesh( );
	meshBuilder.Begin( pMesh, MATERIAL_POLYGON, 4 );

	meshBuilder.TexCoord2f( 0, 0, 0);
	meshBuilder.Position3f(Start[0] - ViewUp[0] * GIZMO_AXIS_WIDTH, Start[1] - ViewUp[1] * GIZMO_AXIS_WIDTH, Start[2] - ViewUp[2] * GIZMO_AXIS_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f( 0, 2, 0);
	meshBuilder.Position3f(End[0] - ViewUp[0] * GIZMO_AXIS_WIDTH, End[1] - ViewUp[1] * GIZMO_AXIS_WIDTH, End[2] - ViewUp[2] * GIZMO_AXIS_WIDTH);
	meshBuilder.AdvanceVertex();
	meshBuilder.Color3ub(red, green, blue);

	meshBuilder.TexCoord2f( 0, 2, 1);
	meshBuilder.Position3f(End[0] + ViewUp[0] * GIZMO_AXIS_WIDTH, End[1] + ViewUp[1] * GIZMO_AXIS_WIDTH, End[2] + ViewUp[2] * GIZMO_AXIS_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f( 0, 0, 1);
	meshBuilder.Position3f(Start[0] + ViewUp[0] * GIZMO_AXIS_WIDTH, Start[1] + ViewUp[1] * GIZMO_AXIS_WIDTH, Start[2] + ViewUp[2] * GIZMO_AXIS_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.End();
	pMesh->Draw();

	//
	// Draw the rotate handle.
	//
	Start = End;
	VectorMA(Origin, 0.6, Axis, End);
	
	pRender->BeginRenderHitTarget(this, uAxisHandle + GIZMO_HANDLE_ROTATE);

	pRender->BindTexture( g_pRotateHandleTexture );
	pMesh = pRenderContext->GetDynamicMesh( );
	meshBuilder.Begin( pMesh, MATERIAL_POLYGON, 4 );

	meshBuilder.TexCoord2f( 0, 0, 0);
	meshBuilder.Position3f(Start[0] - ViewUp[0] * GIZMO_HANDLE_WIDTH, Start[1] - ViewUp[1] * GIZMO_HANDLE_WIDTH, Start[2] - ViewUp[2] * GIZMO_HANDLE_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f( 0, 1, 0);
	meshBuilder.Position3f(End[0] - ViewUp[0] * GIZMO_HANDLE_WIDTH, End[1] - ViewUp[1] * GIZMO_HANDLE_WIDTH, End[2] - ViewUp[2] * GIZMO_HANDLE_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f( 0, 1, 1);
	meshBuilder.Position3f(End[0] + ViewUp[0] * GIZMO_HANDLE_WIDTH, End[1] + ViewUp[1] * GIZMO_HANDLE_WIDTH, End[2] + ViewUp[2] * GIZMO_HANDLE_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f( 0, 0, 1);
	meshBuilder.Position3f(Start[0] + ViewUp[0] * GIZMO_HANDLE_WIDTH, Start[1] + ViewUp[1] * GIZMO_HANDLE_WIDTH, Start[2] + ViewUp[2] * GIZMO_HANDLE_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.End();
	pMesh->Draw();

	pRender->EndRenderHitTarget();

	//
	// Draw the third segment of the gizmo axis.
	//
	Start = End;
	VectorMA(Origin, 0.75, Axis, End);
	
	pRender->BindTexture( g_pAxisTexture );
	pMesh = pRenderContext->GetDynamicMesh( );
	meshBuilder.Begin( pMesh, MATERIAL_POLYGON, 4 );

	meshBuilder.TexCoord2f( 0, 0, 0);
	meshBuilder.Position3f(Start[0] - ViewUp[0] * GIZMO_AXIS_WIDTH, Start[1] - ViewUp[1] * GIZMO_AXIS_WIDTH, Start[2] - ViewUp[2] * GIZMO_AXIS_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f( 0, 2, 0);
	meshBuilder.Position3f(End[0] - ViewUp[0] * GIZMO_AXIS_WIDTH, End[1] - ViewUp[1] * GIZMO_AXIS_WIDTH, End[2] - ViewUp[2] * GIZMO_AXIS_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f( 0, 2, 1);
	meshBuilder.Position3f(End[0] + ViewUp[0] * GIZMO_AXIS_WIDTH, End[1] + ViewUp[1] * GIZMO_AXIS_WIDTH, End[2] + ViewUp[2] * GIZMO_AXIS_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f( 0, 0, 1);
	meshBuilder.Position3f(Start[0] + ViewUp[0] * GIZMO_AXIS_WIDTH, Start[1] + ViewUp[1] * GIZMO_AXIS_WIDTH, Start[2] + ViewUp[2] * GIZMO_AXIS_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.End();
	pMesh->Draw();

	//
	// Draw the translate handle (arrowhead).
	//
	Start = End;
	
	pRender->BeginRenderHitTarget(this, uAxisHandle + GIZMO_HANDLE_TRANSLATE);

	pRender->BindTexture( g_pTranslateHandleTexture );
	pMesh = pRenderContext->GetDynamicMesh( );
	meshBuilder.Begin( pMesh, MATERIAL_TRIANGLES, 1 );

	meshBuilder.TexCoord2f( 0, 0, 0);
	meshBuilder.Position3f(Start[0] - ViewUp[0] * GIZMO_HANDLE_WIDTH, Start[1] - ViewUp[1] * GIZMO_HANDLE_WIDTH, Start[2] - ViewUp[2] * GIZMO_HANDLE_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f( 0, 1, 0.5);
	meshBuilder.Position3f(EndPoint[0], EndPoint[1], EndPoint[2]);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.TexCoord2f( 0, 0, 1);
	meshBuilder.Position3f(Start[0] + ViewUp[0] * GIZMO_HANDLE_WIDTH, Start[1] + ViewUp[1] * GIZMO_HANDLE_WIDTH, Start[2] + ViewUp[2] * GIZMO_HANDLE_WIDTH);
	meshBuilder.Color3ub(red, green, blue);
	meshBuilder.AdvanceVertex();

	meshBuilder.End();
	pMesh->Draw();

	pRender->EndRenderHitTarget();
}