Example #1
0
 internal MDLMesh(Vector3 extent, Vector2i segments, bool inwardNormals, MDLGeometryType geometryType, IMDLMeshBufferAllocator allocator, int?hemisphereSegments, bool?cap, bool?isCone)
 {
     if (hemisphereSegments.HasValue)
     {
         // initCapsule
         InitializeHandle(InitCapsule(extent, segments, hemisphereSegments.Value, inwardNormals, geometryType, allocator), "initCapsuleWithExtent:cylinderSegments:hemisphereSegments:inwardNormals:geometryType:allocator:");
     }
     else if (cap.HasValue && isCone.HasValue)
     {
         // initHemisphere || initCone
         if (isCone.Value)
         {
             InitializeHandle(InitCone(extent, segments, inwardNormals, cap.Value, geometryType, allocator), "initConeWithExtent:segments:inwardNormals:cap:geometryType:allocator:");
         }
         else
         {
             InitializeHandle(InitHemisphere(extent, segments, inwardNormals, cap.Value, geometryType, allocator), "initHemisphereWithExtent:segments:inwardNormals:cap:geometryType:allocator:");
         }
     }
     else
     {
         // initSphere
         InitializeHandle(InitSphere(extent, segments, inwardNormals, geometryType, allocator), "initSphereWithExtent:segments:inwardNormals:geometryType:allocator:");
     }
 }
Example #2
0
 public SCNVector4(Vector3 v)
 {
     X = v.X;
     Y = v.Y;
     Z = v.Z;
     W = 0.0f;
 }
Example #3
0
        public void SetParameter <T>(string name, T value)
        {
            try
            {
                switch (name)
                {
                case "LightDir":
                    uniform_LightDir = (global::OpenTK.Vector3)(object) value;
                    break;

                case "MVP":
                    uniform_MVP = (global::OpenTK.Matrix4)(object) value;
                    break;

                case "MaxDisplacement":
                    uniform_MaxDisplacement = (float)(object)value;
                    break;

                default:
                    throw new global::ShaderRuntime.InvalidIdentifierException("There is no uniform variable named " + name + " in this shader.");
                }
            }
            catch (InvalidCastException e)
            {
                throw new global::ShaderRuntime.InvalidParameterTypeException("Invalid parameter type: " + name + " is not convertible from the type \"" + typeof(T).FullName + "\".");
            }
        }
Example #4
0
 // Apple deprecated initWithName:floatVector3: in macOS10.12/iOS10.0
 // and made available initWithName:vectorFloat3: so we invoke
 // the right one at runtime depending on which OS version we are running
 public SKUniform(string name, Vector3 value)
 {
     if (CheckSystemVersion())
     {
         InitializeHandle(InitWithNameVectorFloat3(name, value), "initWithName:vectorFloat3:");
     }
     else
     {
         InitializeHandle(InitWithNameFloatVector3(name, value), "initWithName:floatVector3:");
     }
 }
Example #5
0
        public static void CreateFromAxisAngle(Vector3 axis, float angle, out SCNMatrix4 result)
        {
            pfloat cos = (float)System.Math.Cos(-angle);
            pfloat sin = (float)System.Math.Sin(-angle);
            pfloat t   = 1.0f - cos;

            axis.Normalize();

            result = new SCNMatrix4(t * axis.X * axis.X + cos, t * axis.X * axis.Y - sin * axis.Z, t * axis.X * axis.Z + sin * axis.Y, 0.0f,
                                    t * axis.X * axis.Y + sin * axis.Z, t * axis.Y * axis.Y + cos, t * axis.Y * axis.Z - sin * axis.X, 0.0f,
                                    t * axis.X * axis.Z - sin * axis.Y, t * axis.Y * axis.Z + sin * axis.X, t * axis.Z * axis.Z + cos, 0.0f,
                                    0, 0, 0, 1);
        }
Example #6
0
        public static MDLMesh CreateBox(Vector3 vector, Vector3i segments, MDLGeometryType geometryType, bool inwardNormals, IMDLMeshBufferAllocator allocator, MDLMeshVectorType type = MDLMeshVectorType.Dimensions)
        {
            switch (type)
            {
            case MDLMeshVectorType.Dimensions:
                return(NewBoxWithDimensions(vector, segments, geometryType, inwardNormals, allocator));

            case MDLMeshVectorType.Extent:
                return(new MDLMesh(vector, segments, inwardNormals, geometryType, allocator));

            default:
                throw new ArgumentException("The 'MDLMeshVectorType type' argument needs a value.");
            }
        }
Example #7
0
 internal MDLMesh(Vector3 extent, Vector2i segments, bool inwardNormals, bool topCap, bool bottomCap, MDLGeometryType geometryType, IMDLMeshBufferAllocator allocator)
 {
     InitializeHandle(InitCylinder(extent, segments, inwardNormals, topCap, bottomCap, geometryType, allocator), "initCylinderWithExtent:segments:inwardNormals:topCap:bottomCap:geometryType:allocator:");
 }
Example #8
0
 public SCNVector3(Vector3 v)
 {
     X = v.X;
     Y = v.Y;
     Z = v.Z;
 }
Example #9
0
 public MDLAxisAlignedBoundingBox(Vector3 maxBounds, Vector3 minBounds)
 {
     MaxBounds = maxBounds;
     MinBounds = minBounds;
 }
Example #10
0
 public extern static void xamarin_vector_float3__Vector3_objc_msgSendSuper_stret_Vector3(out global::OpenTK.Vector3 retval, IntPtr receiver, IntPtr selector, global::OpenTK.Vector3 arg1);
Example #11
0
 public static MDLMesh CreateBox(Vector3 dimensions, Vector3i segments, MDLGeometryType geometryType, bool inwardNormals, IMDLMeshBufferAllocator allocator)
 {
     return(CreateBox(dimensions, segments, geometryType, inwardNormals, allocator, MDLMeshVectorType.Dimensions));
 }
Example #12
0
 internal MDLMesh(Vector3 extent, Vector2i segments, MDLGeometryType geometryType, IMDLMeshBufferAllocator allocator)
 {
     InitializeHandle(InitPlane(extent, segments, geometryType, allocator), "initPlaneWithExtent:segments:geometryType:allocator:");
 }
Example #13
0
 internal MDLMesh(Vector3 extent, bool inwardNormals, MDLGeometryType geometryType, IMDLMeshBufferAllocator allocator)
 {
     InitializeHandle(InitIcosahedron(extent, inwardNormals, geometryType, allocator), "initIcosahedronWithExtent:inwardNormals:geometryType:allocator:");
 }
Example #14
0
 internal MDLMesh(Vector3 extent, Vector3i segments, bool inwardNormals, MDLGeometryType geometryType, IMDLMeshBufferAllocator allocator)
 {
     InitializeHandle(InitBox(extent, segments, inwardNormals, geometryType, allocator), "initBoxWithExtent:segments:inwardNormals:geometryType:allocator:");
 }
Example #15
0
 public MDLAxisAlignedBoundingBox(Vector3 maxBounds, Vector3 minBounds)
 {
     MaxBounds = maxBounds;
     MinBounds = minBounds;
 }
Example #16
0
 public static MDLMesh CreateCylinder(Vector3 extent, Vector2i segments, bool inwardNormals, bool topCap, bool bottomCap, MDLGeometryType geometryType, IMDLMeshBufferAllocator allocator)
 {
     return(new MDLMesh(extent, segments, inwardNormals, topCap, bottomCap, geometryType, allocator));
 }
Example #17
0
 public static MDLMesh CreateIcosahedron(Vector3 extent, bool inwardNormals, MDLGeometryType geometryType, IMDLMeshBufferAllocator allocator)
 {
     return(new MDLMesh(extent, inwardNormals, geometryType, allocator));
 }
Example #18
0
 public static MDLMesh CreatePlane(Vector3 extent, Vector2i segments, MDLGeometryType geometryType, IMDLMeshBufferAllocator allocator)
 {
     return(new MDLMesh(extent, segments, geometryType, allocator));
 }
Example #19
0
 public static MDLMesh CreateCone(Vector3 dimensions, Vector2i segments, MDLGeometryType geometryType, bool inwardNormals, bool cap, IMDLMeshBufferAllocator allocator)
 {
     return(new MDLMesh(dimensions, segments, inwardNormals, geometryType, allocator, null, cap, true));
 }
Example #20
0
 public static MDLMesh CreateCapsule(Vector3 dimensions, Vector2i segments, MDLGeometryType geometryType, bool inwardNormals, int hemisphereSegments, IMDLMeshBufferAllocator allocator)
 {
     return(new MDLMesh(dimensions, segments, inwardNormals, geometryType, allocator, hemisphereSegments, null, null));
 }