Beispiel #1
0
        /// <summary>
        /// <para>cgGetBoolAnnotationValues allows the application to  retrieve the value(s) of a boolean typed annotation.</para>
        /// <para>ERROR: CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation. CG_INVALID_PARAMETER_ERROR is generated if nvalues is NULL.</para>
        /// <para>VERSION: cgGetBoolAnnotationValues was introduced in Cg 1.5.</para>
        /// </summary>
        /// <param name="ann">The annotation.</param>
        /// <param name="nvalues">Pointer to integer where the number of returned values will be stored.</param>
        /// <returns>Returns a pointer to an array of CgBool values. The number of values in the array is returned via the nvalues param. Returns NULL if no values are available. nvalues will be 0.</returns>
        public static CgBool[] GetBoolAnnotationValues(CgAnnotation ann, out int nvalues)
        {
            var values = cgGetBoolAnnotationValues(ann, out nvalues);

            if (nvalues > 0)
            {
                var retValue = new CgBool[nvalues];
                unsafe
                {
                    var ii = (int*)values;
                    for (int i = 0; i < nvalues; i++)
                    {
                        retValue[i] = ii[i] == True;
                    }
                }
                return retValue;
            }
            return null;
        }
Beispiel #2
0
 private static extern CgBool cgSetBoolAnnotation(CgAnnotation annotation, CgBool value);
Beispiel #3
0
 /// <summary>
 /// <para>cgSetIntAnnotation sets the value of an annotation of int type.</para>
 /// <para>ERROR: CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation. CG_INVALID_PARAMETER_TYPE_ERROR is generated if ann is not an annotation of int type. CG_ARRAY_SIZE_MISMATCH_ERROR is generated if ann is not a scalar.</para>
 /// <para>VERSION: cgSetIntAnnotation was introduced in Cg 1.5.</para>
 /// </summary>
 /// <param name="ann">The annotation that will be set.</param>
 /// <param name="value">The value to which ann will be set.</param>
 /// <returns>Returns CG_TRUE if it succeeds in setting the annotation. Returns CG_FALSE otherwise.</returns>
 public static CgBool SetIntAnnotation(CgAnnotation ann, int value)
 {
     return cgSetIntAnnotation(ann, value);
 }
Beispiel #4
0
 /// <summary>
 /// <para>cgGetAnnotationName allows the application to retrieve the name of a annotation.</para>
 /// <para>This name can be used later to retrieve the annotation using cgGetNamedPassAnnotation, cgGetNamedParameterAnnotation, cgGetNamedTechniqueAnnotation, or cgGetNamedProgramAnnotation.</para>
 /// <para>ERROR: CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.</para>
 /// <para>VERSION: cgGetAnnotationName was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="ann">The annotation from which to get the name.</param>
 /// <returns>Returns the NULL-terminated name string for the annotation. Returns NULL if ann is invalid.</returns>
 public static string GetAnnotationName(CgAnnotation ann)
 {
     return Marshal.PtrToStringAnsi(cgGetAnnotationName(ann));
 }
Beispiel #5
0
        /// <summary>
        /// <para>cgGetStringAnnotationValues allows the application to retrieve the value(s) of a string typed annotation.</para>
        /// <para>ERROR: CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation. CG_INVALID_PARAMETER_ERROR is generated if nvalues is NULL.</para>
        /// <para>VERSION: cgGetStringAnnotationValues was introduced in Cg 2.0.</para>
        /// </summary>
        /// <param name="ann">The annotation from which the values will be retrieved.</param>
        /// <returns>Returns a pointer to an array of string values. The number of values in the array is returned via the nvalues param. Returns NULL if no values are available, ann is not string-typed, or an error occurs. nvalues will be 0.</returns>
        public static string[] GetStringAnnotationValues(CgAnnotation ann)
        {
            int nvalues;
            var ptr = cgGetStringAnnotationValues(ann, out nvalues);

            if (nvalues == 0) return null;

            unsafe
            {
                var byteArray = (byte**)ptr;
                var lines = new List<string>();
                var buffer = new List<byte>();

                for (int i = 0; i < nvalues; i++)
                {
                    byte* b = *byteArray;
                    for (; ; )
                    {
                        if (*b == '\0')
                        {
                            char[] cc = Encoding.ASCII.GetChars(buffer.ToArray());
                            lines.Add(new string(cc));
                            buffer.Clear();
                            break;
                        }
                        buffer.Add(*b);
                        b++;
                    }
                    byteArray++;
                }
                return lines.ToArray();
            }
        }
Beispiel #6
0
 /// <summary>
 /// <para>cgSetBoolAnnotation sets the value of an annotation of bool type.</para>
 /// <para>ERROR: CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation. CG_INVALID_PARAMETER_TYPE_ERROR is generated if ann is not an annotation of bool type. CG_ARRAY_SIZE_MISMATCH_ERROR is generated if ann is not a scalar.</para>
 /// <para>VERSION: cgSetBoolAnnotation was introduced in Cg 1.5.</para>
 /// </summary>
 /// <param name="ann">The annotation that will be set.</param>
 /// <param name="value">The value to which ann will be set.</param>
 /// <returns>Returns CG_TRUE if it succeeds in setting the annotation. Returns CG_FALSE otherwise.</returns>
 public static CgBool SetBoolAnnotation(CgAnnotation ann, CgBool value)
 {
     return cgSetBoolAnnotation(ann, value);
 }
Beispiel #7
0
 private static extern CgParameter cgGetDependentAnnotationParameter(CgAnnotation annotation, int index);
Beispiel #8
0
 /// <summary>
 /// <para>Annotations in CgFX files may include references to one or more effect parameters on the right hand side of the annotation that are used for computing the annotation's value.</para>
 /// <para>cgGetNumDependentAnnotationParameters returns the total number of such parameters.</para>
 /// <para>cgGetDependentAnnotationParameter can then be used to iterate over these parameters.</para>
 /// <para>ERROR: CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.</para>
 /// <para>VERSION: cgGetNumDependentAnnotationParameters was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="ann">The annotation handle.</param>
 /// <returns>Returns the number of parameters on which ann depends.</returns>
 public static int GetNumDependentAnnotationParameters(CgAnnotation ann)
 {
     return cgGetNumDependentAnnotationParameters(ann);
 }
Beispiel #9
0
 private static extern IntPtr cgGetAnnotationName(CgAnnotation annotation);
Beispiel #10
0
 private static extern CgType cgGetAnnotationType(CgAnnotation annotation);
Beispiel #11
0
 private static extern CgBool cgSetStringAnnotation(CgAnnotation annotation, [In] string value);
Beispiel #12
0
 private static extern CgBool cgSetIntAnnotation(CgAnnotation annotation, int value);
Beispiel #13
0
 private static extern CgBool cgSetFloatAnnotation(CgAnnotation annotation, float value);
Beispiel #14
0
 /// <summary>
 /// <para>cgGetFloatAnnotationValues allows the application to  retrieve the value(s) of a floating-point typed annotation.</para>
 /// <para>ERROR: CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation. CG_INVALID_PARAMETER_ERROR is generated if nvalues is NULL.</para>
 /// <para>VERSION: cgGetFloatAnnotationValues was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="ann">The annotation from which the values will be retrieved.</param>
 /// <param name="nvalues">Pointer to integer where the number of returned values will be stored.</param>
 /// <returns>Returns a pointer to an array of float values. The number of values in the array is returned via the nvalues param. Returns NULL if no values are available. nvalues will be 0.</returns>
 public static float[] GetFloatAnnotationValues(CgAnnotation ann, out int nvalues)
 {
     return cgGetFloatAnnotationValues(ann, out nvalues);
 }
Beispiel #15
0
 private static extern float[] cgGetFloatAnnotationValues(CgAnnotation annotation, out int nvalues);
Beispiel #16
0
 /// <summary>
 /// <para>The annotations associated with a param, pass, technique, or program can be iterated over by using cgGetNextAnnotation.</para>
 /// <para>ERROR: CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.</para>
 /// <para>VERSION: cgGetNextAnnotation was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="ann">The current annotation.</param>
 /// <returns>Returns the next annotation in the sequence of annotations associated with the annotated object. Returns NULL when ann is the last annotation.</returns>
 public static CgAnnotation GetNextAnnotation(CgAnnotation ann)
 {
     return cgGetNextAnnotation(ann);
 }
Beispiel #17
0
 private static extern int[] cgGetIntAnnotationValues(CgAnnotation annotation, out int nvalues);
Beispiel #18
0
 /// <summary>
 /// <para>cgGetStringAnnotationValue allows the application to  retrieve the value of a string typed annotation.</para>
 /// <para>ERROR: CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.</para>
 /// <para>VERSION: cgGetStringAnnotationValue was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="ann">The annotation.</param>
 /// <returns>Returns a pointer to a string contained by ann. Returns NULL if no value is available.</returns>
 public static string GetStringAnnotationValue(CgAnnotation ann)
 {
     return cgGetStringAnnotationValue(ann);
 }
Beispiel #19
0
 private static extern CgAnnotation cgGetNextAnnotation(CgAnnotation annotation);
Beispiel #20
0
 /// <summary>
 /// <para>cgIsAnnotation returns CG_TRUE if ann references a valid annotation, CG_FALSE otherwise.</para>
 /// <para>VERSION: cgIsAnnotation was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="ann">The annotation handle to check.</param>
 /// <returns>Returns CG_TRUE if ann references a valid annotation. Returns CG_FALSE otherwise.</returns>
 public static CgBool IsAnnotation(CgAnnotation ann)
 {
     return cgIsAnnotation(ann);
 }
Beispiel #21
0
 private static extern int cgGetNumDependentAnnotationParameters(CgAnnotation annotation);
Beispiel #22
0
 /// <summary>
 /// <para>cgSetFloatAnnotation sets the value of an annotation of float type.</para>
 /// <para>ERROR: CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation. CG_INVALID_PARAMETER_TYPE_ERROR is generated if ann is not an annotation of float type. CG_ARRAY_SIZE_MISMATCH_ERROR is generated if ann is not a scalar.</para>
 /// <para>VERSION: cgSetFloatAnnotation was introduced in Cg 1.5.</para>
 /// </summary>
 /// <param name="ann">The annotation that will be set.</param>
 /// <param name="value">The value to which ann will be set.</param>
 /// <returns>Returns CG_TRUE if it succeeds in setting the annotation. Returns CG_FALSE otherwise.</returns>
 public static CgBool SetFloatAnnotation(CgAnnotation ann, float value)
 {
     return cgSetFloatAnnotation(ann, value);
 }
Beispiel #23
0
 private static extern string cgGetStringAnnotationValue(CgAnnotation annotation);
Beispiel #24
0
 /// <summary>
 /// <para>cgSetStringAnnotation sets the value of an annotation of string type.</para>
 /// <para>ERROR: CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation. CG_INVALID_PARAMETER_TYPE_ERROR is generated if ann is not an annotation of string type. CG_ARRAY_SIZE_MISMATCH_ERROR is generated if ann is not a scalar.</para>
 /// <para>VERSION: cgSetStringAnnotation was introduced in Cg 1.5.</para>
 /// </summary>
 /// <param name="ann">The annotation that will be set.</param>
 /// <param name="value">The value to which ann will be set.</param>
 /// <returns>Returns CG_TRUE if it succeeds in setting the annotation. Returns CG_FALSE otherwise.</returns>
 public static CgBool SetStringAnnotation(CgAnnotation ann, [In]string value)
 {
     return cgSetStringAnnotation(ann, value);
 }
Beispiel #25
0
 private static extern IntPtr cgGetStringAnnotationValues(CgAnnotation ann, out int nvalues);
Beispiel #26
0
 /// <summary>
 /// <para>cgGetAnnotationType allows the application to retrieve the type of an annotation in a Cg effect.</para>
 /// <para>ERROR: CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.</para>
 /// <para>VERSION: cgGetAnnotationType was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="ann">The annotation from which to get the type.</param>
 /// <returns>Returns the type enumerant of ann. Returns CG_UNKNOWN_TYPE if an error occurs.</returns>
 public static CgType GetAnnotationType(CgAnnotation ann)
 {
     return cgGetAnnotationType(ann);
 }
Beispiel #27
0
 /// <summary>
 /// <para>Annotations in CgFX files may include references to one or more effect parameters on the right hand side of the annotation that are used for computing the annotation's value.</para>
 /// <para>cgGetDependentAnnotationParameter returns one of these parameters, as indicated by the given index.</para>
 /// <para>cgGetNumDependentAnnotationParameters can be used to determine the total number of such parameters.</para>
 /// <para>ERROR: CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation. CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if index is less than zero or greater than or equal to the number of dependent parameters, as returned by cgGetNumDependentAnnotationParameters.</para>
 /// <para>VERSION: cgGetDependentAnnotationParameter was introduced in Cg 1.4.</para>
 /// </summary>
 /// <param name="ann">The annotation handle.</param>
 /// <param name="index">The index of the param to return.</param>
 /// <returns>Returns a handle to the selected dependent annotation on success. Returns NULL if an error occurs.</returns>
 public static CgParameter GetDependentAnnotationParameter(CgAnnotation ann, int index)
 {
     return cgGetDependentAnnotationParameter(ann, index);
 }
Beispiel #28
0
 public static int[] GetBooleanAnnotationValues(CgAnnotation ann, out int nvalues)
 {
     return cgGetBooleanAnnotationValues(ann, out nvalues);
 }
Beispiel #29
0
 private static extern CgBool cgIsAnnotation(CgAnnotation annotation);