diff --git a/Makefile b/Makefile index ae94f48bfd..2cfca502f1 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CSC = gmcs CSFLAGS = -nologo -warn:4 -debug:+ -debug:full -optimize- -codepage:utf8 -unsafe DEFINE = DEBUG;TRACE -PROGRAMS =fileformats gl game ra cnc seqed editor ralint filex tsbuild utility +PROGRAMS = fileformats rcg game ra cnc seqed editor ralint filex tsbuild utility prefix = /usr/local datarootdir = $(prefix)/share datadir = $(datarootdir) @@ -18,13 +18,13 @@ fileformats_TARGET = OpenRA.FileFormats.dll fileformats_KIND = library fileformats_LIBS = $(COMMON_LIBS) thirdparty/Tao/Tao.Sdl.dll System.Windows.Forms.dll thirdparty/WindowsBase.dll -gl_SRCS = $(shell find OpenRA.Gl/ -iname '*.cs') -gl_TARGET = OpenRA.Gl.dll -gl_KIND = library -gl_DEPS = $(fileformats_TARGET) $(game_TARGET) -gl_LIBS = $(COMMON_LIBS) System.Windows.Forms.dll \ - thirdparty/Tao/Tao.Cg.dll thirdparty/Tao/Tao.OpenGl.dll thirdparty/Tao/Tao.Sdl.dll \ - $(gl_DEPS) $(game_TARGET) +rcg_SRCS = $(shell find OpenRA.Renderer.Cg/ -iname '*.cs') +rcg_TARGET = OpenRA.Renderer.Cg.dll +rcg_KIND = library +rcg_DEPS = $(fileformats_TARGET) $(game_TARGET) +rcg_LIBS = $(COMMON_LIBS) System.Windows.Forms.dll \ + thirdparty/Tao/Tao.Cg.dll thirdparty/Tao/Tao.OpenGl.dll thirdparty/Tao/Tao.Sdl.dll \ + $(rcg_DEPS) $(game_TARGET) game_SRCS = $(shell find OpenRA.Game/ -iname '*.cs') game_TARGET = OpenRA.Game.exe @@ -91,14 +91,14 @@ utility_LIBS = $(COMMON_LIBS) $(utility_DEPS) .SUFFIXES: .PHONY: clean all game tool default mods mod_ra mod_cnc install uninstall editor_res editor tsbuild ralint seqed filex utility -game: $(fileformats_TARGET) $(gl_TARGET) $(game_TARGET) $(ra_TARGET) $(cnc_TARGET) $(utility_TARGET) +game: $(fileformats_TARGET) $(rcg_TARGET) $(game_TARGET) $(ra_TARGET) $(cnc_TARGET) $(utility_TARGET) clean: @-rm *.exe *.dll *.mdb mods/**/*.dll mods/**/*.mdb *.resources distclean: clean -CORE = fileformats gl game editor utility +CORE = fileformats rcg game editor utility install: all @-echo "Installing OpenRA to $(INSTALL_DIR)" diff --git a/OpenRA.Editor/OpenRA.Editor.csproj b/OpenRA.Editor/OpenRA.Editor.csproj index a6b94efb4b..a83a03a11a 100644 --- a/OpenRA.Editor/OpenRA.Editor.csproj +++ b/OpenRA.Editor/OpenRA.Editor.csproj @@ -1,4 +1,4 @@ - + Debug @@ -13,8 +13,6 @@ v3.5 512 OpenRA.Editor.Icon.ico - - true diff --git a/OpenRA.Game/Graphics/Renderer.cs b/OpenRA.Game/Graphics/Renderer.cs index 2edb10c48e..06c4e6157f 100644 --- a/OpenRA.Game/Graphics/Renderer.cs +++ b/OpenRA.Game/Graphics/Renderer.cs @@ -133,7 +133,7 @@ namespace OpenRA.Graphics internal static void Initialize( OpenRA.FileFormats.Graphics.WindowMode windowMode ) { var resolution = GetResolution( windowMode ); - device = CreateDevice( Assembly.LoadFile( Path.GetFullPath( "OpenRA.Gl.dll" ) ), resolution.Width, resolution.Height, windowMode, false ); + device = CreateDevice( Assembly.LoadFile( Path.GetFullPath( "OpenRA.Renderer.Cg.dll" ) ), resolution.Width, resolution.Height, windowMode, false ); } static Size GetResolution(WindowMode windowmode) diff --git a/OpenRA.Gl/GraphicsDevice.cs b/OpenRA.Renderer.Cg/GraphicsDevice.cs similarity index 91% rename from OpenRA.Gl/GraphicsDevice.cs rename to OpenRA.Renderer.Cg/GraphicsDevice.cs index f955eca486..da9bc8cf64 100755 --- a/OpenRA.Gl/GraphicsDevice.cs +++ b/OpenRA.Renderer.Cg/GraphicsDevice.cs @@ -16,9 +16,9 @@ using Tao.Cg; using Tao.OpenGl; using Tao.Sdl; -[assembly: Renderer(typeof(OpenRA.GlRenderer.GraphicsDevice))] +[assembly: Renderer(typeof(OpenRA.Renderer.Cg.GraphicsDevice))] -namespace OpenRA.GlRenderer +namespace OpenRA.Renderer.Cg { public class GraphicsDevice : IGraphicsDevice { @@ -83,12 +83,12 @@ namespace OpenRA.GlRenderer windowSize = new Size( width, height ); - cgContext = Cg.cgCreateContext(); + cgContext = Tao.Cg.Cg.cgCreateContext(); - Cg.cgSetErrorCallback( CgErrorCallback ); + Tao.Cg.Cg.cgSetErrorCallback( CgErrorCallback ); - CgGl.cgGLRegisterStates( cgContext ); - CgGl.cgGLSetManageTextureParameters( cgContext, true ); + Tao.Cg.CgGl.cgGLRegisterStates( cgContext ); + Tao.Cg.CgGl.cgGLSetManageTextureParameters( cgContext, true ); vertexProfile = CgGl.cgGLGetLatestProfile( CgGl.CG_GL_VERTEX ); fragmentProfile = CgGl.cgGLGetLatestProfile( CgGl.CG_GL_FRAGMENT ); @@ -103,10 +103,10 @@ namespace OpenRA.GlRenderer Sdl.SDL_SetModState( 0 ); // i have had enough. } - static Cg.CGerrorCallbackFuncDelegate CgErrorCallback = () => + static Tao.Cg.Cg.CGerrorCallbackFuncDelegate CgErrorCallback = () => { - var err = Cg.cgGetError(); - var str = Cg.cgGetErrorString( err ); + var err = Tao.Cg.Cg.cgGetError(); + var str = Tao.Cg.Cg.cgGetErrorString( err ); throw new InvalidOperationException( string.Format( "CG Error: {0}: {1}", err, str ) ); }; diff --git a/OpenRA.Gl/IndexBuffer.cs b/OpenRA.Renderer.Cg/IndexBuffer.cs similarity index 93% rename from OpenRA.Gl/IndexBuffer.cs rename to OpenRA.Renderer.Cg/IndexBuffer.cs index f070daec47..82773ee08f 100644 --- a/OpenRA.Gl/IndexBuffer.cs +++ b/OpenRA.Renderer.Cg/IndexBuffer.cs @@ -12,7 +12,7 @@ using System; using OpenRA.FileFormats.Graphics; using Tao.OpenGl; -namespace OpenRA.GlRenderer +namespace OpenRA.Renderer.Cg { public class IndexBuffer : IIndexBuffer, IDisposable { diff --git a/OpenRA.Gl/OpenRA.Gl.csproj b/OpenRA.Renderer.Cg/OpenRA.Renderer.Cg.csproj similarity index 100% rename from OpenRA.Gl/OpenRA.Gl.csproj rename to OpenRA.Renderer.Cg/OpenRA.Renderer.Cg.csproj diff --git a/OpenRA.Gl/Properties/AssemblyInfo.cs b/OpenRA.Renderer.Cg/Properties/AssemblyInfo.cs similarity index 100% rename from OpenRA.Gl/Properties/AssemblyInfo.cs rename to OpenRA.Renderer.Cg/Properties/AssemblyInfo.cs diff --git a/OpenRA.Gl/Shader.cs b/OpenRA.Renderer.Cg/Shader.cs similarity index 57% rename from OpenRA.Gl/Shader.cs rename to OpenRA.Renderer.Cg/Shader.cs index 21896d6d0e..843eaf4341 100644 --- a/OpenRA.Gl/Shader.cs +++ b/OpenRA.Renderer.Cg/Shader.cs @@ -14,7 +14,7 @@ using OpenRA.FileFormats; using OpenRA.FileFormats.Graphics; using Tao.Cg; -namespace OpenRA.GlRenderer +namespace OpenRA.Renderer.Cg { public class Shader : IShader { @@ -28,22 +28,22 @@ namespace OpenRA.GlRenderer string code; using (var file = new StreamReader(FileSystem.Open("cg{0}{1}.fx".F(Path.DirectorySeparatorChar, name)))) code = file.ReadToEnd(); - effect = Cg.cgCreateEffect(dev.cgContext, code, null); + effect = Tao.Cg.Cg.cgCreateEffect(dev.cgContext, code, null); if (effect == IntPtr.Zero) { - var err = Cg.cgGetErrorString(Cg.cgGetError()); - var results = Cg.cgGetLastListing(dev.cgContext); + var err = Tao.Cg.Cg.cgGetErrorString(Tao.Cg.Cg.cgGetError()); + var results = Tao.Cg.Cg.cgGetLastListing(dev.cgContext); throw new InvalidOperationException( string.Format("Cg compile failed ({0}):\n{1}", err, results)); } - technique = Cg.cgGetFirstTechnique(effect); + technique = Tao.Cg.Cg.cgGetFirstTechnique(effect); if (technique == IntPtr.Zero) throw new InvalidOperationException("No techniques"); - while (Cg.cgValidateTechnique(technique) == 0) + while (Tao.Cg.Cg.cgValidateTechnique(technique) == 0) { - technique = Cg.cgGetNextTechnique(technique); + technique = Tao.Cg.Cg.cgGetNextTechnique(technique); if (technique == IntPtr.Zero) throw new InvalidOperationException("No valid techniques"); } @@ -51,35 +51,35 @@ namespace OpenRA.GlRenderer public void Render(Action a) { - CgGl.cgGLEnableProfile(dev.vertexProfile); - CgGl.cgGLEnableProfile(dev.fragmentProfile); + Tao.Cg.CgGl.cgGLEnableProfile(dev.vertexProfile); + Tao.Cg.CgGl.cgGLEnableProfile(dev.fragmentProfile); - var pass = Cg.cgGetFirstPass(technique); + var pass = Tao.Cg.Cg.cgGetFirstPass(technique); while (pass != IntPtr.Zero) { - Cg.cgSetPassState(pass); + Tao.Cg.Cg.cgSetPassState(pass); a(); - Cg.cgResetPassState(pass); - pass = Cg.cgGetNextPass(pass); + Tao.Cg.Cg.cgResetPassState(pass); + pass = Tao.Cg.Cg.cgGetNextPass(pass); } - CgGl.cgGLDisableProfile(dev.fragmentProfile); - CgGl.cgGLDisableProfile(dev.vertexProfile); + Tao.Cg.CgGl.cgGLDisableProfile(dev.fragmentProfile); + Tao.Cg.CgGl.cgGLDisableProfile(dev.vertexProfile); } public void SetValue(string name, ITexture t) { var texture = (Texture)t; - var param = Cg.cgGetNamedEffectParameter(effect, name); + var param = Tao.Cg.Cg.cgGetNamedEffectParameter(effect, name); if (param != IntPtr.Zero && texture != null) - CgGl.cgGLSetupSampler(param, texture.texture); + Tao.Cg.CgGl.cgGLSetupSampler(param, texture.texture); } public void SetValue(string name, float x, float y) { - var param = Cg.cgGetNamedEffectParameter(effect, name); + var param = Tao.Cg.Cg.cgGetNamedEffectParameter(effect, name); if (param != IntPtr.Zero) - CgGl.cgGLSetParameter2f(param, x, y); + Tao.Cg.CgGl.cgGLSetParameter2f(param, x, y); } public void Commit() { } diff --git a/OpenRA.Gl/Texture.cs b/OpenRA.Renderer.Cg/Texture.cs similarity index 95% rename from OpenRA.Gl/Texture.cs rename to OpenRA.Renderer.Cg/Texture.cs index 126ab02570..a366cc115c 100644 --- a/OpenRA.Gl/Texture.cs +++ b/OpenRA.Renderer.Cg/Texture.cs @@ -15,7 +15,7 @@ using Tao.OpenGl; using System.IO; using System; -namespace OpenRA.GlRenderer +namespace OpenRA.Renderer.Cg { public class Texture : ITexture { diff --git a/OpenRA.Gl/VertexBuffer.cs b/OpenRA.Renderer.Cg/VertexBuffer.cs similarity index 94% rename from OpenRA.Gl/VertexBuffer.cs rename to OpenRA.Renderer.Cg/VertexBuffer.cs index 8ec8a7163d..905c1eb295 100644 --- a/OpenRA.Gl/VertexBuffer.cs +++ b/OpenRA.Renderer.Cg/VertexBuffer.cs @@ -13,7 +13,7 @@ using System.Runtime.InteropServices; using OpenRA.FileFormats.Graphics; using Tao.OpenGl; -namespace OpenRA.GlRenderer +namespace OpenRA.Renderer.Cg { public class VertexBuffer : IVertexBuffer, IDisposable where T : struct diff --git a/OpenRA.Renderer.Null/OpenRA.Renderer.Null.csproj b/OpenRA.Renderer.Null/OpenRA.Renderer.Null.csproj index fbec25fa81..c06193fb66 100644 --- a/OpenRA.Renderer.Null/OpenRA.Renderer.Null.csproj +++ b/OpenRA.Renderer.Null/OpenRA.Renderer.Null.csproj @@ -1,4 +1,4 @@ - + Debug @@ -65,6 +65,7 @@ +