void P_Entity_Destroy ()
{
	GlobalShaderCache().detachRenderable(StaticRenderableConnectionLines::instance());

	GlobalShaderCache().release("$PIVOT");

	Light_Destroy();
}
Exemple #2
0
void Portals_destroyShaders(){
	GlobalShaderCache().release( g_state_solid );
	GlobalShaderCache().release( g_state_solid_outline );
	GlobalShaderCache().release( g_state_wireframe );
	GlobalOpenGLStateLibrary().erase( g_state_solid );
	GlobalOpenGLStateLibrary().erase( g_state_solid_outline );
	GlobalOpenGLStateLibrary().erase( g_state_wireframe );
}
void P_Entity_Construct ()
{
	Light_Construct();

	RenderablePivot::StaticShader::instance() = GlobalShaderCache().capture("$PIVOT");

	GlobalShaderCache().attachRenderable(StaticRenderableConnectionLines::instance());
}
void RadiantSelectionSystem::constructStatic() {
	_state = GlobalShaderCache().capture("$POINT");
#if defined(DEBUG_SELECTION)
	g_state_clipped = GlobalShaderCache().capture("$DEBUG_CLIPPED");
#endif
	TranslateManipulator::m_state_wire = GlobalShaderCache().capture("$WIRE_OVERLAY");
	TranslateManipulator::m_state_fill = GlobalShaderCache().capture("$FLATSHADE_OVERLAY");
	RotateManipulator::m_state_outer = GlobalShaderCache().capture("$WIRE_OVERLAY");
}
void RadiantSelectionSystem::destroyStatic() {
#if defined(DEBUG_SELECTION)
	GlobalShaderCache().release("$DEBUG_CLIPPED");
#endif
	GlobalShaderCache().release("$WIRE_OVERLAY");
	GlobalShaderCache().release("$FLATSHADE_OVERLAY");
	GlobalShaderCache().release("$WIRE_OVERLAY");
	GlobalShaderCache().release("$POINT");
}
Exemple #6
0
void Entity_Destroy()
{
  GlobalShaderCache().detachRenderable(StaticRenderableConnectionLines::instance());

  GlobalShaderCache().release("$PIVOT");

  Doom3Group_destroy();
  MiscModel_destroy();
  Light_Destroy();
}
Exemple #7
0
static void GlobalGL_sharedContextCreated (void)
{
	// report OpenGL information
	globalOutputStream() << "GL_VENDOR: " << reinterpret_cast<const char*> (glGetString(GL_VENDOR)) << "\n";
	globalOutputStream() << "GL_RENDERER: " << reinterpret_cast<const char*> (glGetString(GL_RENDERER)) << "\n";
	globalOutputStream() << "GL_VERSION: " << reinterpret_cast<const char*> (glGetString(GL_VERSION)) << "\n";
	globalOutputStream() << "GL_EXTENSIONS: " << reinterpret_cast<const char*> (glGetString(GL_EXTENSIONS)) << "\n";

	QGL_sharedContextCreated(GlobalOpenGL());

	GlobalShaderCache().realise();
	GlobalTexturesCache().realise();

	/* use default font here (Sans 10 is gtk default) */
	GtkSettings *settings = gtk_settings_get_default();
	gchar* fontname;
	g_object_get(settings, "gtk-font-name", &fontname, (char*) 0);
	g_font = glfont_create(fontname);
	// Fallbacks
	if (g_font.getPixelHeight() == -1)
		g_font = glfont_create("Sans 10");
	if (g_font.getPixelHeight() == -1)
		g_font = glfont_create("fixed 10");
	if (g_font.getPixelHeight() == -1)
		g_font = glfont_create("courier new 10");

	GlobalOpenGL().m_font = g_font.getDisplayList();
	GlobalOpenGL().m_fontHeight = g_font.getPixelHeight();
}
	//copy constructor, won't release shader
	RenderablePicoSurface::RenderablePicoSurface (RenderablePicoSurface const& other) :
		OpenGLRenderable(other), Cullable(other), _originalShaderName(other._originalShaderName), _mappedShaderName(
				other._mappedShaderName), _vertices(other._vertices), _indices(other._indices), _localAABB(
				other._localAABB)
	{
		_nIndices = other._nIndices;
		_shader = GlobalShaderCache().capture(_mappedShaderName);
	}
	~SelectionAPI() {
		GlobalShaderCache().detachRenderable(*_selectionSystem);
		GlobalSceneGraph().removeBoundsChangedCallback(_onBoundsChanged);

		// release the selection system from memory
		delete _selectionSystem;

		RadiantSelectionSystem::destroyStatic();
	}
	// Apply a skin to this surface
	void RenderablePicoSurface::applySkin (const std::string& remap)
	{
		if (!remap.empty() && remap != _mappedShaderName) { // change to a new shader
			// Switch shader objects
			GlobalShaderCache().release(_mappedShaderName);
			_shader = GlobalShaderCache().capture(remap);

			// Save the remapped shader name
			_mappedShaderName = remap;
		} else if (remap.empty() && _mappedShaderName != _originalShaderName) {
			// No remap, so reset our shader to the original unskinned shader
			GlobalShaderCache().release(_mappedShaderName);
			_shader = GlobalShaderCache().capture(_originalShaderName);

			// Reset the remapped shader name
			_mappedShaderName = _originalShaderName;
		}
	}
Exemple #11
0
void Pointfile_Construct()
{
  CPointfile::constructStatic();

  GlobalShaderCache().attachRenderable(s_pointfile);

  GlobalCommands_insert("TogglePointfile", FreeCaller<Pointfile_Toggle>());
  GlobalCommands_insert("NextLeakSpot", FreeCaller<Pointfile_Next>(), Accelerator('K', (GdkModifierType)(GDK_SHIFT_MASK|GDK_CONTROL_MASK)));
  GlobalCommands_insert("PrevLeakSpot", FreeCaller<Pointfile_Prev>(), Accelerator('L', (GdkModifierType)(GDK_SHIFT_MASK|GDK_CONTROL_MASK)));
}
Exemple #12
0
DBobView::DBobView(){
	nPathCount = 0;

	path = NULL;

	boundingShow = BOUNDS_APEX;

	constructShaders();
	GlobalShaderCache().attachRenderable( *this );
}
Exemple #13
0
DBobView::~DBobView(){
	GlobalShaderCache().detachRenderable( *this );
	destroyShaders();

	if ( path ) {
		delete[] path;
	}

	g_PathView = NULL;
}
	// Constructor
	SelectionAPI() {
		RadiantSelectionSystem::constructStatic();

		// allocate a new selection system instance on the heap
		_selectionSystem = new RadiantSelectionSystem;

		_onBoundsChanged = GlobalSceneGraph().addBoundsChangedCallback(MemberCaller<RadiantSelectionSystem, &RadiantSelectionSystem::onBoundsChanged>(*_selectionSystem));

		GlobalShaderCache().attachRenderable(*_selectionSystem);
	}
Exemple #15
0
void DBobView::constructShaders(){
	OpenGLState state;
	GlobalOpenGLStateLibrary().getDefaultState( state );
	state.m_state = RENDER_COLOURWRITE | RENDER_DEPTHWRITE | RENDER_BLEND | RENDER_LINESMOOTH;
	state.m_sort = OpenGLState::eSortOpaque;
	state.m_linewidth = 1;
	state.m_colour[0] = 1;
	state.m_colour[1] = 0;
	state.m_colour[2] = 0;
	state.m_colour[3] = 1;
	GlobalOpenGLStateLibrary().insert( DBobView_state_line, state );

	state.m_colour[0] = 0.25f;
	state.m_colour[1] = 0.75f;
	state.m_colour[2] = 0.75f;
	state.m_colour[3] = 1;
	GlobalOpenGLStateLibrary().insert( DBobView_state_box, state );

	m_shader_line = GlobalShaderCache().capture( DBobView_state_line );
	m_shader_box = GlobalShaderCache().capture( DBobView_state_box );
}
Exemple #16
0
void Entity_Construct(EGameType gameType)
{
  g_gameType = gameType;
  if(g_gameType == eGameTypeDoom3)
  {
    g_targetable_nameKey = "name";

    Static<KeyIsName>::instance().m_keyIsName = keyIsNameDoom3;
    Static<KeyIsName>::instance().m_nameKey = "name";
  }
  else
  {
    Static<KeyIsName>::instance().m_keyIsName = keyIsNameQuake3;
    Static<KeyIsName>::instance().m_nameKey = "targetname";
  }

  GlobalPreferenceSystem().registerPreference("SI_ShowNames", BoolImportStringCaller(g_showNames), BoolExportStringCaller(g_showNames));
  GlobalPreferenceSystem().registerPreference("SI_ShowAngles", BoolImportStringCaller(g_showAngles), BoolExportStringCaller(g_showAngles));
  GlobalPreferenceSystem().registerPreference("NewLightStyle", BoolImportStringCaller(g_newLightDraw), BoolExportStringCaller(g_newLightDraw));
  GlobalPreferenceSystem().registerPreference("LightRadiuses", BoolImportStringCaller(g_lightRadii), BoolExportStringCaller(g_lightRadii));

  Entity_InitFilters();
  LightType lightType = LIGHTTYPE_DEFAULT;
  if(g_gameType == eGameTypeRTCW)
  {
    lightType = LIGHTTYPE_RTCW;
  }
  else if(g_gameType == eGameTypeDoom3)
  {
    lightType = LIGHTTYPE_DOOM3;
  }
  Light_Construct(lightType);
  MiscModel_construct();
  Doom3Group_construct();

  RenderablePivot::StaticShader::instance() = GlobalShaderCache().capture("$PIVOT");

  GlobalShaderCache().attachRenderable(StaticRenderableConnectionLines::instance());
}
	// Constructor. Copy the provided picoSurface_t structure into this object
	RenderablePicoSurface::RenderablePicoSurface (picoSurface_t* surf) :
		_originalShaderName(""), _mappedShaderName("")
	{
		// Get the shader from the picomodel struct.
		picoShader_t* shader = PicoGetSurfaceShader(surf);
		if (shader != 0) {
			_originalShaderName = PicoGetShaderName(shader);
		}

		// Capture the shader
		_shader = GlobalShaderCache().capture(_originalShaderName);
		if (_shader)
			_mappedShaderName = _originalShaderName; // no skin at this time

		// Get the number of vertices and indices, and reserve capacity in our vectors in advance
		// by populating them with empty structs.
		const int nVerts = PicoGetSurfaceNumVertexes(surf);
		_nIndices = PicoGetSurfaceNumIndexes(surf);
		_vertices.resize(nVerts);
		_indices.resize(_nIndices);

		// Stream in the vertex data from the raw struct, expanding the local AABB to include
		// each vertex.
		for (int vNum = 0; vNum < nVerts; ++vNum) {
			Vertex3f vertex(PicoGetSurfaceXYZ(surf, vNum));
			_localAABB.includePoint(vertex);
			_vertices[vNum].vertex = vertex;
			_vertices[vNum].normal = Normal3f(PicoGetSurfaceNormal(surf, vNum));
			_vertices[vNum].texcoord = TexCoord2f(PicoGetSurfaceST(surf, 0, vNum));
		}

		// Stream in the index data
		picoIndex_t* ind = PicoGetSurfaceIndexes(surf, 0);
		for (unsigned int i = 0; i < _nIndices; i++)
			_indices[i] = ind[i];
	}
Exemple #18
0
void BrushInstance::constructStatic ()
{
	m_state_selpoint = GlobalShaderCache().capture("$SELPOINT");
}
Exemple #19
0
void BrushInstance::destroyStatic ()
{
	GlobalShaderCache().release("$SELPOINT");
}
Exemple #20
0
		void release ()
		{
			GlobalShaderCache().release(m_name);
		}
Exemple #21
0
		void capture ()
		{
			m_shader = GlobalShaderCache().capture(m_name);
		}
Exemple #22
0
void DBobView::destroyShaders(){
	GlobalOpenGLStateLibrary().erase( DBobView_state_line );
	GlobalOpenGLStateLibrary().erase( DBobView_state_box );
	GlobalShaderCache().release( DBobView_state_line );
	GlobalShaderCache().release( DBobView_state_box );
}
Exemple #23
0
		NullModel () :
			m_aabb_local(Vector3(0, 0, 0), Vector3(8, 8, 8)), m_renderAABBSolid(m_aabb_local), m_renderAABBWire(
					m_aabb_local)
		{
			m_state = GlobalShaderCache().capture("");
		}
Exemple #24
0
		~NullModel ()
		{
			GlobalShaderCache().release("");
		}
Exemple #25
0
void Pointfile_Destroy()
{
  GlobalShaderCache().detachRenderable(s_pointfile);

  CPointfile::destroyStatic();
}
Exemple #26
0
 static void destroyStatic()
 {
   GlobalShaderCache().release("$POINTFILE");
 }
Exemple #27
0
 static void constructStatic()
 {
   m_renderstate = GlobalShaderCache().capture("$POINTFILE");
 }
Exemple #28
0
void CamWnd::captureStates() {
	m_state_select1 = GlobalShaderCache().capture("$CAM_HIGHLIGHT");
	m_state_select2 = GlobalShaderCache().capture("$CAM_OVERLAY");
}
Exemple #29
0
void CamWnd::releaseStates() {
	GlobalShaderCache().release("$CAM_HIGHLIGHT");
	GlobalShaderCache().release("$CAM_OVERLAY");
}
Exemple #30
0
static void GlobalGL_sharedContextDestroyed (void)
{
	GlobalTexturesCache().unrealise();
	GlobalShaderCache().unrealise();
}