Пример #1
0
 public MuseumStoryLayout(IEmbeddedResources embeddedResources, IWorldTreeService worldTreeService)
 {
     this.worldTreeService = worldTreeService;
     floorModel            = embeddedResources.PlaneModel(PlaneModelSourcePlane.Xy, PlaneModelSourceNormalDirection.Positive,
                                                          globalRadius, globalRadius, 1, 1);
     ceilingModel = embeddedResources.PlaneModel(PlaneModelSourcePlane.Xy, PlaneModelSourceNormalDirection.Negative,
                                                 globalRadius, globalRadius, 1, 1);
     exitWallModel = embeddedResources.PlaneModel(PlaneModelSourcePlane.Xz, PlaneModelSourceNormalDirection.Negative,
                                                  exitHalfLength, ceilingHalfHeight, 1, 1);
     corridorWallModel = embeddedResources.PlaneModel(PlaneModelSourcePlane.Xz, PlaneModelSourceNormalDirection.Negative,
                                                      corridorHalfWidth, ceilingHalfHeight, 1, 1);
     frustumModel  = embeddedResources.SimpleFrustumModel();
     floorMaterial = StandardMaterial.New()
                     .SetDiffuseMap(embeddedResources.Image("Textures/museum_floor.jpg"))
                     .SetNoSpecular(true)
                     .FromGlobalCache();
     ceilingMaterial = StandardMaterial.New()
                       .SetDiffuseMap(embeddedResources.Image("Textures/museum_ceiling.jpg"))
                       .SetNoSpecular(true)
                       .FromGlobalCache();
     wallMaterial = StandardMaterial.New()
                    .SetDiffuseMap(embeddedResources.Image("Textures/museum_wall.jpg"))
                    .SetNoSpecular(true)
                    .FromGlobalCache();
     frustumMaterial = StandardMaterial.New()
                       .SetDiffuseColor(Color4.Green)
                       .SetIgnoreLighting(true)
                       .FromGlobalCache();
 }
Пример #2
0
 public SphereStoryLayout(IEmbeddedResources embeddedResources)
 {
     frustumModel    = embeddedResources.SimpleFrustumModel();
     frustumMaterial = StandardMaterial.New()
                       .SetDiffuseColor(Color4.Green)
                       .SetIgnoreLighting(true)
                       .FromGlobalCache();
 }
Пример #3
0
 public DragAlongAxisGizmoComponent(IEmbeddedResources embeddedResources)
 {
     model         = embeddedResources.LineModel();
     visualElement = new ModelVisualElement <DragAlongAxisGizmoComponent>(this)
                     .SetModel(model)
                     .SetMaterial(x => x.material)
                     .SetTransform(x => x.transform);
     hittable = new LineHittable <DragAlongAxisGizmoComponent>(this, x => x.GetGlobalLine(), PixelLineWidth);
 }
        protected UserQuerySceneComponent(IUserQueryService queryService, IEmbeddedResources embeddedResources, IRtImageBuilder textImageBuilder)
        {
            this.queryService     = queryService;
            this.textImageBuilder = textImageBuilder;
            planeModel            = embeddedResources.SimplePlaneXyModel();

            optionRects    = new List <AaRectangle2>();
            visualElements = new List <IVisualElement>();
            hittable       = new RectangleHittable <UserQuerySceneComponent>(this,
                                                                             Transform.Identity, x => new AaRectangle2(Vector2.Zero, 1f, 1f), x => 0);
        }
Пример #5
0
 public OrbitStoryLayout(IEmbeddedResources embeddedResources)
 {
     frustumModel    = embeddedResources.SimpleFrustumModel();
     circleModel     = embeddedResources.CircleModel(256);
     frustumMaterial = StandardMaterial.New()
                       .SetDiffuseColor(Color4.Green)
                       .SetIgnoreLighting(true)
                       .FromGlobalCache();
     circleMaterial = StandardMaterial.New()
                      .SetDiffuseColor(Color4.Yellow)
                      .SetIgnoreLighting(true)
                      .FromGlobalCache();
 }
Пример #6
0
        public SimpleStoryLayout(IKeyboardInputProvider keyboardInputProvider, IEmbeddedResources embeddedResources)
        {
            this.keyboardInputProvider = keyboardInputProvider;

            planeModel     = embeddedResources.SimplePlaneXyModel();
            planeMaterials = new[]
            {
                new Color4(120, 222, 44),
                new Color4(222, 120, 44),
                new Color4(44, 120, 222),
                new Color4(222, 44, 120),
                new Color4(64, 222, 160),
                new Color4(120, 44, 222),
            }.Select(x => StandardMaterial.New(x).FromGlobalCache())
            .Select(x => (IStandardMaterial)x)
            .ToArray();
        }
        private void Reset()
        {
            simulationRunning   = false;
            simulationTimestamp = 0;
            prevQueue           = new Queue <FluidSimulationFrame>();
            var size     = new IntSize3(Width, Height, 1);
            var cellSize = CellSize;

            fluidSimulation.Reset(CreateConfig());
            model             = CreateModel(size, cellSize, fluidSimulation.Particles.Length);
            levelSetImageData = new byte[fluidSimulation.LevelSet.Size.Width * fluidSimulation.LevelSet.Size.Height * 4];
            levelSetImage     = new RawImage(ResourceVolatility.Volatile, new IntSize2(fluidSimulation.LevelSet.Size.Width, fluidSimulation.LevelSet.Size.Height), true, levelSetImageData);
            squareModel       = embeddedResources.SimplePlaneXyModel();
            visualElements.Clear();
            visualElements.Add(ModelVisualElement.New()
                               .SetModel(model)
                               .SetMaterial(StandardMaterial.New()
                                            .SetDiffuseColor(Color4.Yellow)
                                            .SetIgnoreLighting(true)
                                            .FromGlobalCache()));
            visualElements.Add(ModelVisualElement.New()
                               .SetModel(model)
                               .SetModelPartIndex(1)
                               .SetMaterial(StandardMaterial.New()
                                            .SetDiffuseColor(Color4.White)
                                            .SetIgnoreLighting(true)
                                            .FromGlobalCache())
                               .SetRenderState(StandardRenderState.New()
                                               .SetPointSize(3)
                                               .FromGlobalCache()));
            visualElements.Add(ModelVisualElement.New()
                               .SetModel(squareModel)
                               .SetMaterial(StandardMaterial.New()
                                            .SetDiffuseMap(levelSetImage)
                                            .SetIgnoreLighting(true)
                                            .FromGlobalCache())
                               .SetTransform(new Transform(cellSize * size.Width / 2, Quaternion.Identity, new Vector3(cellSize * size.Width / 2, cellSize * size.Height / 2, -0.1f))));
        }
 public NestedCirclesStoryLayout(IEmbeddedResources embeddedResources, ICoroutineService coroutineService)
 {
     this.coroutineService = coroutineService;
     planeModel            = embeddedResources.SimplePlaneXyModel();
     circleModel           = embeddedResources.CircleModel(64);
     lineModel             = embeddedResources.LineModel();
     circleMaterials       = new IMaterial[]
     {
         StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(1f, 0f, 0f) * 0.5f, 1.0f)).SetIgnoreLighting(true).FromGlobalCache(),
         StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(0f, 1f, 0f) * 0.5f, 1.0f)).SetIgnoreLighting(true).FromGlobalCache(),
         StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(0f, 0f, 1f) * 0.5f, 1.0f)).SetIgnoreLighting(true).FromGlobalCache(),
         StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(1f, 1f, 0f) * 0.5f, 1.0f)).SetIgnoreLighting(true).FromGlobalCache(),
         StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(1f, 0f, 1f) * 0.5f, 1.0f)).SetIgnoreLighting(true).FromGlobalCache(),
         StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(0f, 1f, 1f) * 0.5f, 1.0f)).SetIgnoreLighting(true).FromGlobalCache()
     };
     lineMaterial         = StandardMaterial.New().SetDiffuseColor(Color4.Blue).FromGlobalCache();
     lineMaterialExternal = StandardMaterial.New().SetDiffuseColor(0.7f * Color4.White).FromGlobalCache();
     circleRenderState    = StandardRenderState.New()
                            .SetLineWidth(2)
                            .SetCullFace(CullFace.Front)
                            .FromGlobalCache();
     lineRenderState = StandardRenderState.New().SetLineWidth(3).FromGlobalCache();
 }
        public NestedSpheresStoryLayout(IEmbeddedResources embeddedResources, ICoroutineService coroutineService, Lazy <IViewService> viewServiceLazy)
        {
            this.coroutineService = coroutineService;
            this.viewServiceLazy  = viewServiceLazy;
            focusVisualEffect     = new FocusVisualEffect();

            mainModel       = embeddedResources.SphereModel(64, true);
            lineModel       = embeddedResources.LineModel();
            sphereMaterials = new IMaterial[]
            {
                StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(1.0f, 0.5f, 0.5f) * 1.0f, 0.5f)).FromGlobalCache(),
                StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(0.5f, 1.0f, 0.5f) * 1.0f, 0.5f)).FromGlobalCache(),
                StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(0.5f, 0.5f, 1.0f) * 1.0f, 0.5f)).FromGlobalCache(),
                StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(1.0f, 1.0f, 0.5f) * 1.0f, 0.5f)).FromGlobalCache(),
                StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(1.0f, 0.5f, 1.0f) * 1.0f, 0.5f)).FromGlobalCache(),
                StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(0.5f, 1.0f, 1.0f) * 1.0f, 0.5f)).FromGlobalCache(),
            };
            sphereRenderState = StandardRenderState.New().SetCullFace(CullFace.Back).FromGlobalCache();

            lineMaterial         = StandardMaterial.New().SetDiffuseColor(Color4.Red).FromGlobalCache();
            lineMaterialExternal = StandardMaterial.New().SetDiffuseColor(0.7f * Color4.Red);
            lineRenderState      = StandardRenderState.New().SetLineWidth(3).FromGlobalCache();
        }
Пример #10
0
        public BuildingStoryLayout(ICoroutineService coroutineService, IEmbeddedResources embeddedResources,
                                   IInputService inputService, Lazy <INavigationService> navigationServiceLazy)
        {
            this.embeddedResources     = embeddedResources;
            this.inputService          = inputService;
            this.navigationServiceLazy = navigationServiceLazy;
            this.coroutineService      = coroutineService;
            planeModel     = embeddedResources.SimplePlaneXzModel();
            lineModel      = embeddedResources.LineModel();
            frustumModel   = embeddedResources.SimpleFrustumModel();
            colorMaterials = new IMaterial[]
            {
                StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(1f, 0f, 0f) * 0.8f, 1.0f)).SetIgnoreLighting(true),
                StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(0f, 1f, 0f) * 0.8f, 1.0f)).SetIgnoreLighting(true),
                StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(0f, 0f, 1f) * 0.8f, 1.0f)).SetIgnoreLighting(true),
                StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(1f, 1f, 0f) * 0.8f, 1.0f)).SetIgnoreLighting(true),
                StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(1f, 0f, 1f) * 0.8f, 1.0f)).SetIgnoreLighting(true),
                StandardMaterial.New().SetDiffuseColor(new Color4(new Color3(0f, 1f, 1f) * 0.8f, 1.0f)).SetIgnoreLighting(true),
            };
            frustumMaterial = StandardMaterial.New()
                              .SetDiffuseColor(new Color4(0f, 1f, 0f))
                              .SetIgnoreLighting(true)
                              .FromGlobalCache();
            lineMaterial = StandardMaterial.New()
                           .SetDiffuseColor(Color4.White)
                           .SetIgnoreLighting(true)
                           .FromGlobalCache();
            currentLineMaterial = StandardMaterial.New()
                                  .SetDiffuseColor(Color4.Red)
                                  .SetIgnoreLighting(true)
                                  .FromGlobalCache();
            lineRenderState = StandardRenderState.New().SetLineWidth(3).FromGlobalCache();

            var mirrorSampler = new ImageSampler
            {
                AddressModeU = ImageSamplerAddressMode.Mirror,
                AddressModeV = ImageSamplerAddressMode.Mirror,
                AddressModeW = ImageSamplerAddressMode.Mirror,
            }.FromGlobalCache();

            floorMaterial = StandardMaterial.New()
                            .SetDiffuseMap(embeddedResources.Image("Textures/museum_floor.jpg"))
                            .SetNoSpecular(true)
                            .SetSampler(mirrorSampler)
                            .FromGlobalCache();
            ceilingMaterial = StandardMaterial.New()
                              .SetDiffuseMap(embeddedResources.Image("Textures/museum_ceiling.jpg"))
                              .SetNoSpecular(true)
                              .SetSampler(mirrorSampler)
                              .FromGlobalCache();
            wallMaterial = StandardMaterial.New()
                           .SetDiffuseMap(embeddedResources.Image("Textures/museum_wall.jpg"))
                           .SetDiffuseColor(new Color4(92, 82, 72))
                           //.SetNoSpecular(true)
                           .SetNormalMap(embeddedResources.Image("Textures/museum_wall_2_norm.jpg"))
                           .FromGlobalCache();
            rawWallMaterial = StandardMaterial.New()
                              .SetDiffuseColor(Color4.Green)
                              .SetIgnoreLighting(true)
                              .FromGlobalCache();
        }