Example #1
0
 public SceneDto ToDto()
 {
     return(new SceneDto
     {
         Id = Id,
         Name = Name,
         UnitOfMeasure = (Models.Uomtype)UnitOfMeasure,
         Units = Units,
         Materials = Materials.Select(x => x.ToDto()).ToList(),
         Cameras = Cameras.Select(x => x.ToDto()).ToList(),
         CurrentCamera = CurrentCamera?.Id,
         Lights = Lights.Select(x => x.ToDto()).ToList(),
         Textures = Textures.Select(x => x.ToDto()).ToList(),
         Meshes = Meshes.Select(x => x.ToDto()).ToList(),
         Skins = Skins.Select(x => x.ToDto()).ToList(),
         Root = Root.ToDto()
     });
 }
Example #2
0
        public List <CollectionItem <Camera> > GetCamerasWiThGlobalModelMatrices()
        {
            var matrix  = CalculateModelMatrix();
            var cameras = new List <CollectionItem <Camera> >();

            foreach (var obj in ComplexObjects)
            {
                cameras.AddRange(obj.GetCamerasWiThGlobalModelMatrices());
            }

            cameras.AddRange(Cameras.Select(x => new CollectionItem <Camera>()
            {
                Object            = x,
                GlobalModelMatrix = x.CalculateModelMatrix(),
            }));

            foreach (var camera in cameras)
            {
                camera.GlobalModelMatrix *= matrix;
            }

            return(cameras);
        }