Commits

Tobias Bohnen committed fffdc9b

  • Participants
  • Parent commits 06aadf8

Comments (0)

Files changed (8)

File CgNet/NativeMethods.cs

         [SuppressUnmanagedCodeSecurity]
         public static extern IntPtr cgGetNamedProgramParameter(IntPtr prog, NameSpace nameSpace, string name);
 
+        //CGparameter cgGetNamedProgramUniformBuffer ( CGeffect program,       const char * blockName );
+        [DllImport(CgNativeLibrary, CallingConvention = Convention)]
+        [SuppressUnmanagedCodeSecurity]
+        public static extern IntPtr cgGetNamedProgramUniformBuffer(IntPtr program, string blockName);
+
         // CGDLL_API CGstate cgGetNamedSamplerState(CGcontext, string name);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
         [SuppressUnmanagedCodeSecurity]
         public static extern IntPtr cgGetNamedTechniqueAnnotation(IntPtr technique, string name);
 
-        //CGparameter cgGetNamedProgramUniformBuffer ( CGeffect program,       const char * blockName );
-        [DllImport(CgNativeLibrary, CallingConvention = Convention)]
-        [SuppressUnmanagedCodeSecurity]
-        public static extern IntPtr cgGetNamedUniformBuffer(IntPtr program, string blockName);
-
         //CGparameter cgGetNamedUniformBufferParameter( CGparameter param,  const char * name );
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
         // CGDLL_API CGstatecallback cgGetStateResetCallback(CGstate);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern State.CgStateCallbackDelegate cgGetStateResetCallback(IntPtr state);
+        public static extern State.CallbackDelegate cgGetStateResetCallback(IntPtr state);
 
         /// <summary>
         /// 
         // CGDLL_API CGstatecallback cgGetStateSetCallback(CGstate);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern State.CgStateCallbackDelegate cgGetStateSetCallback(IntPtr state);
+        public static extern State.CallbackDelegate cgGetStateSetCallback(IntPtr state);
 
         /// <summary>
         /// 
         // CGDLL_API CGstatecallback cgGetStateValidateCallback(CGstate);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern State.CgStateCallbackDelegate cgGetStateValidateCallback(IntPtr state);
+        public static extern State.CallbackDelegate cgGetStateValidateCallback(IntPtr state);
 
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
         // CGDLL_API void cgSetStateCallbacks(CGstate, CGstatecallback set, CGstatecallback reset, CGstatecallback validate);
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]
-        public static extern void cgSetStateCallbacks(IntPtr state, State.CgStateCallbackDelegate set, State.CgStateCallbackDelegate reset, State.CgStateCallbackDelegate validate);
+        public static extern void cgSetStateCallbacks(IntPtr state, State.CallbackDelegate set, State.CallbackDelegate reset, State.CallbackDelegate validate);
 
         [DllImport(CgNativeLibrary, CallingConvention = Convention)]
         [SuppressUnmanagedCodeSecurity]

File CgNet/Parameter.cs

             }
         }
 
-        public int ConnectedToCount
+        public int ConnectedToParametersCount
         {
             get
             {
 
         #region Public Static Methods
 
-        public static void ConnectParameters(Parameter from, Parameter to)
+        public static void Connect(Parameter from, Parameter to)
         {
             NativeMethods.cgConnectParameter(from.Handle, to.Handle);
         }
             return f[0];
         }
 
-        public bool IsParameterUsed(WrapperObject container)
+        public bool IsUsed(WrapperObject container)
         {
             return NativeMethods.cgIsParameterUsed(this.Handle, container.Handle);
         }

File CgNet/Program.cs

             }
         }
 
+        public Domain Domain
+        {
+            get
+            {
+                return NativeMethods.cgGetProgramDomain(this.Handle);
+            }
+        }
+
         public int DomainsCount
         {
             get
             }
         }
 
+        public ProgramInput Input
+        {
+            get
+            {
+                return NativeMethods.cgGetProgramInput(this.Handle);
+            }
+        }
+
         public bool IsCompiled
         {
             get
             }
         }
 
+        public string[] Options
+        {
+            get
+            {
+                return Cg.IntPtrToStringArray(NativeMethods.cgGetProgramOptions(this.Handle));
+            }
+        }
+
+        public ProgramOutput Output
+        {
+            get
+            {
+                return NativeMethods.cgGetProgramOutput(this.Handle);
+            }
+        }
+
         public int OutputVertices
         {
             get
             }
         }
 
-        public Domain ProgramDomain
-        {
-            get
-            {
-                return NativeMethods.cgGetProgramDomain(this.Handle);
-            }
-        }
-
-        public ProgramInput ProgramInput
-        {
-            get
-            {
-                return NativeMethods.cgGetProgramInput(this.Handle);
-            }
-        }
-
-        public string[] ProgramOptions
-        {
-            get
-            {
-                return Cg.IntPtrToStringArray(NativeMethods.cgGetProgramOptions(this.Handle));
-            }
-        }
-
-        public ProgramOutput ProgramOutput
-        {
-            get
-            {
-                return NativeMethods.cgGetProgramOutput(this.Handle);
-            }
-        }
-
         public ProgramType Type
         {
             get;
 
         #region Public Static Methods
 
-        public static Program CombinePrograms(params Program[] programs)
+        public static Program Combine(params Program[] programs)
         {
             var buf = new IntPtr[programs.Length];
             for (int i = 0; i < programs.Length; i++)
             return new Annotation(ptr);
         }
 
-        public float[] EvaluateProgram(int ncomps, int nx, int ny, int nz)
+        public float[] Evaluate(int ncomps, int nx, int ny, int nz)
         {
             var retValue = new float[ncomps * nx * ny * nz];
             NativeMethods.cgEvaluateProgram(this.Handle, retValue, ncomps, nx, ny, nz);
             };
         }
 
+        public ProfileType GetDomainProfile(int index)
+        {
+            return NativeMethods.cgGetProgramDomainProfile(this.Handle, index);
+        }
+
+        public Program GetDomainProgram(int index)
+        {
+            var ptr = NativeMethods.cgGetProgramDomainProgram(this.Handle, index);
+            return ptr == IntPtr.Zero ? null : new Program(ptr)
+            {
+                OwnsHandle = false
+            };
+        }
+
         public Parameter GetFirstLeafParameter(NameSpace nameSpace)
         {
             var ptr = NativeMethods.cgGetFirstLeafParameter(this.Handle, nameSpace);
             };
         }
 
-        public Parameter GetNamedProgramUniformBuffer(string blockName)
+        public Parameter GetNamedUniformBuffer(string blockName)
         {
-            var ptr = NativeMethods.cgGetNamedUniformBuffer(this.Handle, blockName);
+            var ptr = NativeMethods.cgGetNamedProgramUniformBuffer(this.Handle, blockName);
             return ptr == IntPtr.Zero ? null : new Parameter(ptr)
             {
                 OwnsHandle = false
             return NativeMethods.cgGetNamedUserType(this.Handle, name);
         }
 
-        public ProfileType GetProgramDomainProfile(int index)
-        {
-            return NativeMethods.cgGetProgramDomainProfile(this.Handle, index);
-        }
-
-        public Program GetProgramDomainProgram(int index)
-        {
-            var ptr = NativeMethods.cgGetProgramDomainProgram(this.Handle, index);
-            return ptr == IntPtr.Zero ? null : new Program(ptr)
-            {
-                OwnsHandle = false
-            };
-        }
-
-        public string GetProgramString(SourceType sourceType)
+        public string GetString(SourceType sourceType)
         {
             return Marshal.PtrToStringAnsi(NativeMethods.cgGetProgramString(this.Handle, sourceType));
         }
             return NativeMethods.cgGetUserType(this.Handle, index);
         }
 
+        public void SetBuffer(int bufferIndex, Buffer buffer)
+        {
+            NativeMethods.cgSetProgramBuffer(this.Handle, bufferIndex, buffer.Handle);
+        }
+
         public void SetLastListing(string listing)
         {
             NativeMethods.cgSetLastListing(this.Handle, listing);
             NativeMethods.cgSetPassProgramParameters(this.Handle);
         }
 
-        public void SetProgramBuffer(int bufferIndex, Buffer buffer)
-        {
-            NativeMethods.cgSetProgramBuffer(this.Handle, bufferIndex, buffer.Handle);
-        }
-
         public void UpdateParameters()
         {
             NativeMethods.cgUpdateProgramParameters(this.Handle);

File CgNet/State.cs

         #region Delegates
 
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-        public delegate bool CgStateCallbackDelegate(IntPtr cGstateassignment);
+        public delegate bool CallbackDelegate(IntPtr cGstateassignment);
 
         #endregion Delegates
 
             }
         }
 
-        public CgStateCallbackDelegate ResetCallback
+        public CallbackDelegate ResetCallback
         {
             get
             {
             }
         }
 
-        public CgStateCallbackDelegate SetCallback
+        public CallbackDelegate SetCallback
         {
             get
             {
             }
         }
 
-        public CgStateCallbackDelegate ValidateCallback
+        public CallbackDelegate ValidateCallback
         {
             get
             {
             return NativeMethods.cgGetStateEnumerantValue(this.Handle, name);
         }
 
-        public void SetCallbacks(CgStateCallbackDelegate set, CgStateCallbackDelegate reset, CgStateCallbackDelegate validate)
+        public void SetCallbacks(CallbackDelegate set, CallbackDelegate reset, CallbackDelegate validate)
         {
             NativeMethods.cgSetStateCallbacks(this.Handle, set, reset, validate);
         }

File CgNet/Technique.cs

 
         #region Public Methods
 
+        public Annotation CreateAnnotation(string name, ParameterType type)
+        {
+            var ptr = NativeMethods.cgCreateTechniqueAnnotation(this.Handle, name, type);
+            return ptr == IntPtr.Zero ? null : new Annotation(ptr);
+        }
+
         public Pass CreatePass(string name)
         {
             var ptr = NativeMethods.cgCreatePass(this.Handle, name);
             return ptr == IntPtr.Zero ? null : new Pass(ptr);
         }
 
-        public Annotation CreateTechniqueAnnotation(string name, ParameterType type)
-        {
-            var ptr = NativeMethods.cgCreateTechniqueAnnotation(this.Handle, name, type);
-            return ptr == IntPtr.Zero ? null : new Annotation(ptr);
-        }
-
         public Annotation GetNamedAnnotation(string name)
         {
             var ptr = NativeMethods.cgGetNamedTechniqueAnnotation(this.Handle, name);

File ExampleBrowser/Examples/OpenTK/Advanced/GsShrinky.cs

 
             // Enable all profiles needed
             for (int i = 0; i < combinedProgram.DomainsCount - 1; i++)
-                combinedProgram.GetProgramDomainProfile(i).Enable();
+                combinedProgram.GetDomainProfile(i).Enable();
 
             DrawStars();
 
             // Disable all profiles needed
             for (int i = combinedProgram.DomainsCount - 1; i >= 0; i--)
-                combinedProgram.GetProgramDomainProfile(i).Disable();
+                combinedProgram.GetDomainProfile(i).Disable();
 
             if (myShrinkFactor > 0.8)
             {
                 FragmentProgramName,      /* Entry function name */
                 null);                      /* No extra compiler options */
 
-            combinedProgram = Program.CombinePrograms(vertexProgram, fragmentProgram, geometryProgram);
+            combinedProgram = Program.Combine(vertexProgram, fragmentProgram, geometryProgram);
             combinedProgram.Load();
             Debug.Assert(combinedProgram.DomainsCount == 3);
 

File ExampleBrowser/Examples/OpenTK/Advanced/GsSimple.cs

                 && fragmentProfile == ProfileType.GlslF)
             {
                 /* Combine programs for GLSL... */
-                combinedProgram = Program.CombinePrograms(vertexProgram, geometryProgram, fragmentProgram);
+                combinedProgram = Program.Combine(vertexProgram, geometryProgram, fragmentProgram);
                 combinedProgram.Load();
             }
             else

File Tools/EffectViewer/Analyzer.cs

                         var vertexProgram = pass.GetProgram(Domain.VertexDomain);
                         if (vertexProgram != null)
                         {
-                            programsNode.Nodes.Add(vertexProgram.GetProgramString(SourceType.ProgramEntry));
+                            programsNode.Nodes.Add(vertexProgram.GetString(SourceType.ProgramEntry));
                         }
                         var fragmentProgram = pass.GetProgram(Domain.FragmentDomain);
                         if (fragmentProgram != null)
                         {
-                            programsNode.Nodes.Add(fragmentProgram.GetProgramString(SourceType.ProgramEntry));
+                            programsNode.Nodes.Add(fragmentProgram.GetString(SourceType.ProgramEntry));
                         }
                         var geometryProgram = pass.GetProgram(Domain.GeometryDomain);
                         if (geometryProgram != null)
                         {
-                            programsNode.Nodes.Add(geometryProgram.GetProgramString(SourceType.ProgramEntry));
+                            programsNode.Nodes.Add(geometryProgram.GetString(SourceType.ProgramEntry));
                         }
 
                         if (programsNode.Nodes.Count > 0)