public EntityPickingResult GetResult(Dictionary <int, Entity> idToEntity)
        {
            var fraction = MeshMaterialIndex - Math.Floor(MeshMaterialIndex);
            var integral = MeshMaterialIndex - fraction;

            var result = new EntityPickingResult
            {
                ComponentId   = (int)Math.Round(ModelComponentId),
                MeshNodeIndex = (int)Math.Round(integral),
                MaterialIndex = (int)Math.Round(fraction * MaxMaterialIndex),
            };

            idToEntity.TryGetValue(result.ComponentId, out result.Entity);
            return(result);
        }
Ejemplo n.º 2
0
        public EntityPickingResult GetResult(Dictionary <int, Entity> idToEntity)
        {
            var mcFraction = ModelComponentId - Math.Floor(ModelComponentId);
            var mcIntegral = ModelComponentId - mcFraction;

            var mmiFraction = MeshMaterialIndex - Math.Floor(MeshMaterialIndex);
            var mmiIntegral = MeshMaterialIndex - mmiFraction;

            var result = new EntityPickingResult
            {
                ComponentId   = (int)Math.Round(mcIntegral),
                InstanceId    = (int)Math.Round(mcFraction * MaxInstancingId),
                MeshNodeIndex = (int)Math.Round(mmiIntegral),
                MaterialIndex = (int)Math.Round(mmiFraction * MaxMaterialIndex),
            };

            idToEntity.TryGetValue(result.ComponentId, out result.Entity);
            return(result);
        }