예제 #1
0
 public override string ToString()
 {
     if (block != -1)
     {
         return(type.ToString() + " " + name + " block = " + block + ", index = " + index + ", offset = " + offset);
     }
     else if (index != -1)
     {
         return(type.ToString() + " " + name + " index = " + index);
     }
     else
     {
         return(type.ToString() + " " + name);
     }
 }
예제 #2
0
        static UniformType GetUniformType(ActiveUniformType t)
        {
            switch (t)
            {
                case ActiveUniformType.Bool:
                    return UniformType.@bool;
                case ActiveUniformType.Double:
                    return UniformType.@double;
                case ActiveUniformType.DoubleVec2:
                    return UniformType.Vector2d;
                case ActiveUniformType.DoubleVec3:
                    return UniformType.Vector3d;
                case ActiveUniformType.DoubleVec4:
                    return UniformType.Vector4d;
                case ActiveUniformType.Float:
                    return UniformType.@float;
                case ActiveUniformType.FloatMat2:
                    return UniformType.Matrix2;
                case ActiveUniformType.FloatMat2x3:
                    return UniformType.Matrix2x3;
                case ActiveUniformType.FloatMat2x4:
                    return UniformType.Matrix2x4;
                case ActiveUniformType.FloatMat3:
                    return UniformType.Matrix3;
                case ActiveUniformType.FloatMat3x2:
                    return UniformType.Matrix3x2;
                case ActiveUniformType.FloatMat3x4:
                    return UniformType.Matrix3x4;
                case ActiveUniformType.FloatMat4:
                    return UniformType.Matrix4;
                case ActiveUniformType.FloatMat4x2:
                    return UniformType.Matrix4x2;
                case ActiveUniformType.FloatMat4x3:
                    return UniformType.Matrix4x3;
                case ActiveUniformType.FloatVec2:
                    return UniformType.Vector2;
                case ActiveUniformType.FloatVec3:
                    return UniformType.Vector3;
                case ActiveUniformType.FloatVec4:
                    return UniformType.Vector4;
                case ActiveUniformType.Image1D:
                    break;
                case ActiveUniformType.Image1DArray:
                    break;
                case ActiveUniformType.Image2D:
                    break;
                case ActiveUniformType.Image2DArray:
                    break;
                case ActiveUniformType.Image2DMultisample:
                    break;
                case ActiveUniformType.Image2DMultisampleArray:
                    break;
                case ActiveUniformType.Image2DRect:
                    break;
                case ActiveUniformType.Image3D:
                    break;
                case ActiveUniformType.ImageBuffer:
                    break;
                case ActiveUniformType.ImageCube:
                    break;
                case ActiveUniformType.ImageCubeMapArray:
                    break;
                case ActiveUniformType.Int:
                    return UniformType.@int;
                case ActiveUniformType.IntImage1D:
                    break;
                case ActiveUniformType.IntImage1DArray:
                    break;
                case ActiveUniformType.IntImage2D:
                    break;
                case ActiveUniformType.IntImage2DArray:
                    break;
                case ActiveUniformType.IntImage2DMultisample:
                    break;
                case ActiveUniformType.IntImage2DMultisampleArray:
                    break;
                case ActiveUniformType.IntImage2DRect:
                    break;
                case ActiveUniformType.IntImage3D:
                    break;
                case ActiveUniformType.IntImageBuffer:
                    break;
                case ActiveUniformType.IntImageCube:
                    break;
                case ActiveUniformType.IntImageCubeMapArray:
                    break;
                case ActiveUniformType.IntSampler1D:
                case ActiveUniformType.IntSampler1DArray:
                case ActiveUniformType.IntSampler2D:
                case ActiveUniformType.IntSampler2DArray:
                case ActiveUniformType.IntSampler2DMultisample:
                case ActiveUniformType.IntSampler2DMultisampleArray:
                case ActiveUniformType.IntSampler2DRect:
                case ActiveUniformType.IntSampler3D:
                case ActiveUniformType.IntSamplerBuffer:
                case ActiveUniformType.IntSamplerCube:
                case ActiveUniformType.IntSamplerCubeMapArray:
                    return UniformType.Texture;
                case ActiveUniformType.IntVec2:
                    break;
                case ActiveUniformType.IntVec3:
                    break;
                case ActiveUniformType.IntVec4:
                    break;
                case ActiveUniformType.Sampler1D:
                case ActiveUniformType.Sampler1DArray:
                case ActiveUniformType.Sampler1DArrayShadow:
                case ActiveUniformType.Sampler1DShadow:
                case ActiveUniformType.Sampler2D:
                case ActiveUniformType.Sampler2DArray:
                case ActiveUniformType.Sampler2DArrayShadow:
                case ActiveUniformType.Sampler2DMultisample:
                case ActiveUniformType.Sampler2DMultisampleArray:
                case ActiveUniformType.Sampler2DRect:
                case ActiveUniformType.Sampler2DRectShadow:
                case ActiveUniformType.Sampler2DShadow:
                case ActiveUniformType.Sampler3D:
                case ActiveUniformType.SamplerBuffer:
                case ActiveUniformType.SamplerCube:
                case ActiveUniformType.SamplerCubeMapArray:
                case ActiveUniformType.SamplerCubeMapArrayShadow:
                case ActiveUniformType.SamplerCubeShadow:
                    return UniformType.Texture;
                case ActiveUniformType.UnsignedInt:
                    return UniformType.@uint;
                case ActiveUniformType.UnsignedIntAtomicCounter:
                    break;
                case ActiveUniformType.UnsignedIntImage1D:
                    break;
                case ActiveUniformType.UnsignedIntImage1DArray:
                    break;
                case ActiveUniformType.UnsignedIntImage2D:
                    break;
                case ActiveUniformType.UnsignedIntImage2DArray:
                    break;
                case ActiveUniformType.UnsignedIntImage2DMultisample:
                    break;
                case ActiveUniformType.UnsignedIntImage2DMultisampleArray:
                    break;
                case ActiveUniformType.UnsignedIntImage2DRect:
                    break;
                case ActiveUniformType.UnsignedIntImage3D:
                    break;
                case ActiveUniformType.UnsignedIntImageBuffer:
                    break;
                case ActiveUniformType.UnsignedIntImageCube:
                    break;
                case ActiveUniformType.UnsignedIntImageCubeMapArray:
                    break;
                case ActiveUniformType.UnsignedIntSampler1D:
                case ActiveUniformType.UnsignedIntSampler1DArray:
                case ActiveUniformType.UnsignedIntSampler2D:
                case ActiveUniformType.UnsignedIntSampler2DArray:
                case ActiveUniformType.UnsignedIntSampler2DMultisample:
                case ActiveUniformType.UnsignedIntSampler2DMultisampleArray:
                case ActiveUniformType.UnsignedIntSampler2DRect:
                case ActiveUniformType.UnsignedIntSampler3D:
                case ActiveUniformType.UnsignedIntSamplerBuffer:
                case ActiveUniformType.UnsignedIntSamplerCube:
                case ActiveUniformType.UnsignedIntSamplerCubeMapArray:
                    return UniformType.Texture;
                case ActiveUniformType.UnsignedIntVec2:
                    break;
                case ActiveUniformType.UnsignedIntVec3:
                    break;
                case ActiveUniformType.UnsignedIntVec4:
                    break;
                default:
                    break;
            }

            throw new Exception("Type: " + t.ToString() + " is not supported at this time.");
        }
예제 #3
0
        private Uniform CreateUniform(
            string name,
            int location,
            ActiveUniformType type)
        {
            switch (type)
            {
            case ActiveUniformType.Float:
                return(new UniformFloatGL3x(name, location, this));

            case ActiveUniformType.FloatVec2:
                return(new UniformFloatVector2GL3x(name, location, this));

            case ActiveUniformType.FloatVec3:
                return(new UniformFloatVector3GL3x(name, location, this));

            case ActiveUniformType.FloatVec4:
                return(new UniformFloatVector4GL3x(name, location, this));

            case ActiveUniformType.Int:
                return(new UniformIntGL3x(name, location, UniformType.Int, this));

            case ActiveUniformType.IntVec2:
                return(new UniformIntVector2GL3x(name, location, this));

            case ActiveUniformType.IntVec3:
                return(new UniformIntVector3GL3x(name, location, this));

            case ActiveUniformType.IntVec4:
                return(new UniformIntVector4GL3x(name, location, this));

            case ActiveUniformType.Bool:
                return(new UniformBoolGL3x(name, location, this));

            case ActiveUniformType.BoolVec2:
                return(new UniformBoolVector2GL3x(name, location, this));

            case ActiveUniformType.BoolVec3:
                return(new UniformBoolVector3GL3x(name, location, this));

            case ActiveUniformType.BoolVec4:
                return(new UniformBoolVector4GL3x(name, location, this));

            case ActiveUniformType.FloatMat2:
                return(new UniformFloatMatrix22GL3x(name, location, this));

            case ActiveUniformType.FloatMat3:
                return(new UniformFloatMatrix33GL3x(name, location, this));

            case ActiveUniformType.FloatMat4:
                return(new UniformFloatMatrix44GL3x(name, location, this));

            case ActiveUniformType.FloatMat2x3:
                return(new UniformFloatMatrix23GL3x(name, location, this));

            case ActiveUniformType.FloatMat2x4:
                return(new UniformFloatMatrix24GL3x(name, location, this));

            case ActiveUniformType.FloatMat3x2:
                return(new UniformFloatMatrix32GL3x(name, location, this));

            case ActiveUniformType.FloatMat3x4:
                return(new UniformFloatMatrix34GL3x(name, location, this));

            case ActiveUniformType.FloatMat4x2:
                return(new UniformFloatMatrix42GL3x(name, location, this));

            case ActiveUniformType.FloatMat4x3:
                return(new UniformFloatMatrix43GL3x(name, location, this));

            case ActiveUniformType.Sampler1D:
            case ActiveUniformType.Sampler2D:
            case ActiveUniformType.Sampler2DRect:
            case ActiveUniformType.Sampler2DRectShadow:
            case ActiveUniformType.Sampler3D:
            case ActiveUniformType.SamplerCube:
            case ActiveUniformType.Sampler1DShadow:
            case ActiveUniformType.Sampler2DShadow:
            case ActiveUniformType.Sampler1DArray:
            case ActiveUniformType.Sampler2DArray:
            case ActiveUniformType.Sampler1DArrayShadow:
            case ActiveUniformType.Sampler2DArrayShadow:
            case ActiveUniformType.SamplerCubeShadow:
            case ActiveUniformType.IntSampler1D:
            case ActiveUniformType.IntSampler2D:
            case ActiveUniformType.IntSampler2DRect:
            case ActiveUniformType.IntSampler3D:
            case ActiveUniformType.IntSamplerCube:
            case ActiveUniformType.IntSampler1DArray:
            case ActiveUniformType.IntSampler2DArray:
            case ActiveUniformType.UnsignedIntSampler1D:
            case ActiveUniformType.UnsignedIntSampler2D:
            case ActiveUniformType.UnsignedIntSampler2DRect:
            case ActiveUniformType.UnsignedIntSampler3D:
            case ActiveUniformType.UnsignedIntSamplerCube:
            case ActiveUniformType.UnsignedIntSampler1DArray:
            case ActiveUniformType.UnsignedIntSampler2DArray:
                return(new UniformIntGL3x(name, location, TypeConverterGL3x.To(type), this));
            }

            //
            // A new Uniform derived class needs to be added to support this uniform type.
            //
            throw new NotSupportedException("An implementation for uniform type " + type.ToString() + " does not exist.");
        }
예제 #4
0
        private Uniform CreateUniform(
            string name, 
            int location, 
            ActiveUniformType type)
        {
            switch (type)
            {
                case ActiveUniformType.Float:
                    return new UniformFloatGL3x(name, location, this);
                case ActiveUniformType.FloatVec2:
                    return new UniformFloatVector2GL3x(name, location, this);
                case ActiveUniformType.FloatVec3:
                    return new UniformFloatVector3GL3x(name, location, this);
                case ActiveUniformType.FloatVec4:
                    return new UniformFloatVector4GL3x(name, location, this);
                case ActiveUniformType.Int:
                    return new UniformIntGL3x(name, location, UniformType.Int, this);
                case ActiveUniformType.IntVec2:
                    return new UniformIntVector2GL3x(name, location, this);
                case ActiveUniformType.IntVec3:
                    return new UniformIntVector3GL3x(name, location, this);
                case ActiveUniformType.IntVec4:
                    return new UniformIntVector4GL3x(name, location, this);
                case ActiveUniformType.Bool:
                    return new UniformBoolGL3x(name, location, this);
                case ActiveUniformType.BoolVec2:
                    return new UniformBoolVector2GL3x(name, location, this);
                case ActiveUniformType.BoolVec3:
                    return new UniformBoolVector3GL3x(name, location, this);
                case ActiveUniformType.BoolVec4:
                    return new UniformBoolVector4GL3x(name, location, this);
                case ActiveUniformType.FloatMat2:
                    return new UniformFloatMatrix22GL3x(name, location, this);
                case ActiveUniformType.FloatMat3:
                    return new UniformFloatMatrix33GL3x(name, location, this);
                case ActiveUniformType.FloatMat4:
                    return new UniformFloatMatrix44GL3x(name, location, this);
                case ActiveUniformType.FloatMat2x3:
                    return new UniformFloatMatrix23GL3x(name, location, this);
                case ActiveUniformType.FloatMat2x4:
                    return new UniformFloatMatrix24GL3x(name, location, this);
                case ActiveUniformType.FloatMat3x2:
                    return new UniformFloatMatrix32GL3x(name, location, this);
                case ActiveUniformType.FloatMat3x4:
                    return new UniformFloatMatrix34GL3x(name, location, this);
                case ActiveUniformType.FloatMat4x2:
                    return new UniformFloatMatrix42GL3x(name, location, this);
                case ActiveUniformType.FloatMat4x3:
                    return new UniformFloatMatrix43GL3x(name, location, this);
                case ActiveUniformType.Sampler1D:
                case ActiveUniformType.Sampler2D:
                case ActiveUniformType.Sampler2DRect:
                case ActiveUniformType.Sampler2DRectShadow:
                case ActiveUniformType.Sampler3D:
                case ActiveUniformType.SamplerCube:
                case ActiveUniformType.Sampler1DShadow:
                case ActiveUniformType.Sampler2DShadow:
                case ActiveUniformType.Sampler1DArray:
                case ActiveUniformType.Sampler2DArray:
                case ActiveUniformType.Sampler1DArrayShadow:
                case ActiveUniformType.Sampler2DArrayShadow:
                case ActiveUniformType.SamplerCubeShadow:
                case ActiveUniformType.IntSampler1D:
                case ActiveUniformType.IntSampler2D:
                case ActiveUniformType.IntSampler2DRect:
                case ActiveUniformType.IntSampler3D:
                case ActiveUniformType.IntSamplerCube:
                case ActiveUniformType.IntSampler1DArray:
                case ActiveUniformType.IntSampler2DArray:
                case ActiveUniformType.UnsignedIntSampler1D:
                case ActiveUniformType.UnsignedIntSampler2D:
                case ActiveUniformType.UnsignedIntSampler2DRect:
                case ActiveUniformType.UnsignedIntSampler3D:
                case ActiveUniformType.UnsignedIntSamplerCube:
                case ActiveUniformType.UnsignedIntSampler1DArray:
                case ActiveUniformType.UnsignedIntSampler2DArray:
                    return new UniformIntGL3x(name, location, TypeConverterGL3x.To(type), this);
            }

            //
            // A new Uniform derived class needs to be added to support this uniform type.
            //
            throw new NotSupportedException("An implementation for uniform type " + type.ToString() + " does not exist.");
        }
예제 #5
0
        private Uniform CreateTypedUniform(int location, int size, ActiveUniformType type, string name)
        {
            switch (type)
            {
            case ActiveUniformType.Int:
            case ActiveUniformType.Sampler2D:
            case ActiveUniformType.Sampler2DShadow:
            case ActiveUniformType.UnsignedIntSampler2D:
            case ActiveUniformType.SamplerCube:
                return(new IntUniform(Handle, location, size, type, name));

            case ActiveUniformType.UnsignedInt:
                return(new UIntUniform(Handle, location, size, type, name));

            case ActiveUniformType.Float:
                return(new FloatUniform(Handle, location, size, type, name));

            case ActiveUniformType.FloatVec2:
                return(new Vector2Uniform(Handle, location, size, type, name));

            case ActiveUniformType.FloatVec3:
                return(new Vector3Uniform(Handle, location, size, type, name));

            case ActiveUniformType.FloatVec4:
                return(new Vector4Uniform(Handle, location, size, type, name));

            case ActiveUniformType.FloatMat4:
                return(new Matrix4Uniform(Handle, location, size, type, name));

            case ActiveUniformType.FloatMat3:
                return(new Matrix3Uniform(Handle, location, size, type, name));

            default:
                throw new NotSupportedException(string.Format("Uniforms of type {0} are not yet supported.", type.ToString()));
            }
        }