Пример #1
0
        public static void Model(ObjectInstance position, ObjectInstance rotation, string shaderPath, string modelPath)
        {
            var rot       = Disaster.TypeInterface.Vector3(rotation);
            var pos       = Disaster.TypeInterface.Vector3(position);
            var transform = new Disaster.Transformation(pos, rot, Vector3.One);
            var model     = Disaster.Assets.Model(modelPath);
            var shader    = Disaster.Assets.Shader(shaderPath);

            Disaster.ModelRenderer.EnqueueRender(model, shader, transform);
        }
Пример #2
0
        public static void Model(ObjectInstance position, ObjectInstance rotation, string modelPath)
        {
            var rot = Disaster.TypeInterface.Vector3(rotation);
            var pos = Disaster.TypeInterface.Vector3(position);
            //Matrix4x4 matrix = Matrix4x4.CreateFromYawPitchRoll(rot.Y, rot.X, rot.Z) * Matrix4x4.CreateTranslation(pos);
            var transform = new Disaster.Transformation(pos, rot, Vector3.One);

            var model = Disaster.Assets.Model(modelPath);

            Disaster.ModelRenderer.EnqueueRender(model, Disaster.Assets.defaultShader, transform);
        }
Пример #3
0
        public static void Wireframe(ObjectInstance position, ObjectInstance rotation, ObjectInstance color, string modelPath, bool backfaceCulling, bool drawDepth, bool filled)
        {
            var rot       = Disaster.TypeInterface.Vector3(rotation);
            var pos       = Disaster.TypeInterface.Vector3(position);
            var transform = new Disaster.Transformation(pos, rot, Vector3.One);
            var col       = Disaster.TypeInterface.Color32(color);

            var model = Disaster.Assets.Model(modelPath);

            unsafe
            {
                var mesh = ((Raylib_cs.Mesh *)model.meshes.ToPointer())[0];
                Disaster.SoftwareCanvas.Wireframe(mesh, transform.ToMatrix(), col, backfaceCulling, drawDepth, filled);
            }
        }
Пример #4
0
        public static ObjectInstance GetCollisionRayModel(ObjectInstance ray, ObjectInstance position, ObjectInstance rotation, string modelPath)
        {
            var rayo      = Disaster.TypeInterface.Ray(ray);
            var model     = Disaster.Assets.Model(modelPath);
            var transform = new Disaster.Transformation(Disaster.TypeInterface.Vector3(position), Disaster.TypeInterface.Vector3(rotation), Vector3.One).ToMatrix();

            Matrix4x4.Invert(transform, out Matrix4x4 inverse);
            rayo.position  = Vector3.Transform(rayo.position, inverse);
            rayo.direction = Vector3.TransformNormal(rayo.direction, inverse);
            //model.transform = transform;

            RayHitInfo output = Raylib.GetCollisionRayModel(rayo, model);

            //model.transform = Matrix4x4.Identity;
            return(Disaster.TypeInterface.Object(output));
        }