Ejemplo n.º 1
0
 public Object3D(ObjectPrototype proto) :
     this(proto.Shape, proto.Material)
 {
     Position = proto.Position;
     Scale    = proto.Scale;
     rotation = new MatrixTransform3D(proto.Rotation);
     Material = proto.Material;
 }
Ejemplo n.º 2
0
        public static ObjectPrototype ReadFromFile(BinaryReader br)
        {
            var shape    = Shape3D.ReadShapeFromFile(br);
            var material = new BasicMaterial(br);
            var position = br.ReadVector3D();
            var scale    = br.ReadVector3D();
            var rotation = br.ReadMatrix3D();

            return(new ObjectPrototype(shape, material, position, scale, rotation));
        }
        private void AddMaterial(BasicMaterial material)
        {
            var    color = material.Color;
            string name  = color.ToString();
            float  r     = (float)color.R / 255;
            float  g     = (float)color.G / 255;
            float  b     = (float)color.B / 255;
            float  a     = (float)color.A / 255;

            materialCodes.Add(material, materialCodes.Count);
            AddMaterialX(materialCodes[material], name, r, g, b, a, (float)material.Fresnel, (float)material.Roughness);
        }
Ejemplo n.º 4
0
        /// <param name="shape">The shape (geometry) of the object</param>
        /// <param name="material">The material of the object</param>
        public Object3D(Shape3D shape, BasicMaterial material)
        {
            this.Shape = shape;
            Material   = material;

            // Create transformation
            var transGroup = new Transform3DGroup();

            transGroup.Children.Add(scale);
            transGroup.Children.Add(rotation);
            transGroup.Children.Add(translation);
        }
Ejemplo n.º 5
0
        public ObjectPrototype(Shape3D shape, BasicMaterial material, Vector3D position, Vector3D scale,
                               Matrix3D rotation)
        {
            if (!position.IsValid() || !scale.IsValid())
            {
                throw new ArgumentException("Infinity or not-a-number passed into ObjectPrototype!");
            }

            Shape    = shape;
            Material = material;
            Position = position;
            Scale    = scale;
            Rotation = rotation;
        }
Ejemplo n.º 6
0
 public ObjectPrototype(Shape3D shape, BasicMaterial material, Vector position, Vector scale) :
     this(shape, material, position, scale, DongUtility.Rotation.Identity)
 {
 }
Ejemplo n.º 7
0
 public ObjectPrototype(Shape3D shape, BasicMaterial material, Vector position, Vector scale, Rotation rotation) :
     this(shape, material, ConvertVector(position), ConvertVector(scale), ConvertToMatrix3D(rotation.Matrix))
 {
 }
Ejemplo n.º 8
0
 public ObjectPrototype(Shape3D shape, BasicMaterial material, Vector3D position, Vector3D scale) :
     this(shape, material, position, scale, Matrix3D.Identity)
 {
 }
Ejemplo n.º 9
0
 public ObjectPrototype(Shape3D shape, BasicMaterial material) :
     this(shape, material, new Vector3D(0, 0, 0), new Vector3D(1, 1, 1))
 {
 }