static void loadBackgroundInEditor(SceneContainer container) { foreach (Object go in container.backgrounds) { EditorSceneManager.OpenScene(AssetDatabase.GetAssetPath(go), OpenSceneMode.Additive); //go.name,UnityEngine.SceneManagement.LoadSceneMode.Additive } }
// Init is called on startup. public override void Init() { // Set the clear color for the backbuffer to "greenery" ;-) (https://store.pantone.com/de/de/color-of-the-year-2017/). RC.ClearColor = new float4(136f / 255f, 176f / 255f, 75f / 255f, 1); // Create a scene with a cube // The three components: one Transform, one ShaderEffect (blue material) and the Mesh _cubeTransform = new Transform { Translation = new float3(0, 0, 0) }; _cubeEffect = MakeEffect.FromDiffuseSpecular((float4)ColorUint.Blue, float4.Zero); var cubeMesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10)); // Assemble the cube node containing the three components var cubeNode = new SceneNode(); cubeNode.Components.Add(_cubeTransform); cubeNode.Components.Add(_cubeEffect); cubeNode.Components.Add(cubeMesh); // Create the scene containing the cube as the only object _scene = new SceneContainer(); _scene.Children.Add(cubeNode); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRendererForward(_scene); _camAngle = 0; }
// Init is called on startup. public override void Init() { // Set the clear color for the backbuffer to white (100% intensity in all color channels R, G, B, A). RC.ClearColor = new float4(0.7f, 0.9f, 0.5f, 1); // Load the drone model _droneScene = AssetStorage.Get <SceneContainer>("GroundNoMat.fus"); var droneBody = _droneScene.Children.FindNodes(node => node.Name == "Body")?.FirstOrDefault(); _drone = new Drone(droneBody); _camera = new Camera(); //Add resize delegate var projComp = _droneScene.Children[0].GetComponent <ProjectionComponent>(); AddResizeDelegate(delegate { projComp.Resize(Width, Height); }); // Wrap a SceneRenderer around the model. _sceneRenderer = new SceneRenderer(_droneScene); //_guiRenderer = new SceneRenderer(_gui); DroneRoot = _droneScene.Children.FindNodes(node => node.Name == "Body")?.FirstOrDefault(); }
[Timeout(5000)] // タイムアウトは5秒(5000ms) public IEnumerator TestSphereScaleWithFixedRandomizer() { float targetScale = 0.45678f; // InjectされるRandomizer StaticContext.Container .BindInterfacesAndSelfTo <FixedRandomizer>() .AsSingle() .WithArguments <float>(targetScale); // シーンの読み込み yield return(LoadScene(sceneName)); var resolved = SceneContainer.Resolve <IRandomizer>(); Assert.IsInstanceOf <FixedRandomizer>(resolved); // テスト対象のGeameObjectを取得 var targetObject = GameObject.Find("RandomScaleSphere"); yield return(null); // 1frame動かす // Start()後のスケールを確認 Vector3 localScale = targetObject.transform.localScale; Assert.AreEqual(new Vector3(targetScale, targetScale, targetScale), localScale); }
private void menu_open_map_Click(object sender, EventArgs e) { if (container != null) { return; } var file = new OpenFileDialog(); file.Filter = ".scn|*.scn"; if (file.ShowDialog() == DialogResult.OK) { container = SceneContainer.ReadFrom(file.FileName); if (undo_manager == null) { undo_manager = new SceneUndoManager(50); undo_manager.ObjectSaved += Undo_manager_ObjectSaved; } container_path = file.FileName; undo_manager.Save(container); Extensions.EnableOrDisable(ComponentState.Disable, menu_new_map, menu_open_map); Extensions.EnableOrDisable(ComponentState.Enable, menu_close_map, menu_save, menu_edit); Extensions.EnableOrDisable(ComponentState.Enable, txt_find); update_view(); update_status(); } }
// Init is called on startup. public override void Init() { // Set the clear color for the backbuffer to white (100% intensity in all color channels R, G, B, A). RC.ClearColor = new float4(1, 1, 1, 1); // Load the model _scene = AssetStorage.Get <SceneContainer>("roboter_arm.fus"); //Set Transforms for the Axles _lowerAxleTransform = _scene.Children.FindNodes(node => node.Name == "LowerAxle")?.FirstOrDefault()?.GetTransform(); _middleAxleTransform = _scene.Children.FindNodes(node => node.Name == "MiddleAxle")?.FirstOrDefault()?.GetTransform(); _upperAxleTransform = _scene.Children.FindNodes(node => node.Name == "UpperAxle")?.FirstOrDefault()?.GetTransform(); _footTransform = _scene.Children.FindNodes(node => node.Name == "Foot")?.FirstOrDefault()?.GetTransform(); _rightPincerTransform = _scene.Children.FindNodes(node => node.Name == "RightLowerAxle")?.FirstOrDefault()?.GetTransform(); _leftPincerTransform = _scene.Children.FindNodes(node => node.Name == "LeftLowerAxle")?.FirstOrDefault()?.GetTransform(); _rightPincerTransformUp = _scene.Children.FindNodes(node => node.Name == "RightHigherAxle")?.FirstOrDefault()?.GetTransform(); _leftPincerTransformUp = _scene.Children.FindNodes(node => node.Name == "LeftHigherAxle")?.FirstOrDefault()?.GetTransform(); _pointer = _scene.Children.FindNodes(node => node.Name == "Pointer")?.FirstOrDefault()?.GetTransform(); _virtualPos = new float3(0, 5, 0); //at the position of the upper axle _open = false; AddResizeDelegate(delegate { _scene.Children[0].GetComponent <ProjectionComponent>().Resize(Width, Height); }); // Wrap a SceneRenderer around the model. _sceneRenderer = new SceneRenderer(_scene); }
// Init is called on startup. public override void Init() { // Set the clear color for the backbuffer to white (100% intensity in all color channels R, G, B, A). RC.ClearColor = new float4(0.8f, 1, 0.4f, 1); // Create a scene with a cube // The three components: one XForm, one Material and the Mesh _cubeTransform = new Transform { Translation = new float3(0, 0, 0) }; var cubeShader = ShaderCodeBuilder.MakeShaderEffect(new float4(0, 0, 1, 1)); var cubeMesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10)); // Assemble the cube node containing the three components var cubeNode = new SceneNode(); cubeNode.Components.Add(_cubeTransform); cubeNode.Components.Add(cubeShader); cubeNode.Components.Add(cubeMesh); // Create the scene containing the cube as the only object _scene = new SceneContainer(); _scene.Children.Add(cubeNode); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRendererForward(_scene); }
// Init is called on startup. public override void Init() { _initWindowWidth = Width; _initWindowHeight = Height; _initCanvasWidth = Width / 100f; _initCanvasHeight = Height / 100f; _canvasHeight = _initCanvasHeight; _canvasWidth = _initCanvasWidth; _aspectRatio = Width / (float)Height; // Set the clear color for the back buffer to white (100% intensity in all color channels R, G, B, A). RC.ClearColor = new float4(1, 1, 1, 1); // Create the robot model _scene = CreateScene(); // Wrap a SceneRenderer around the model. _sceneRenderer = new SceneRenderer(_scene); _scenePicker = new ScenePicker(_scene); var projComp = _scene.Children[0].GetComponent <ProjectionComponent>(); AddResizeDelegate(delegate { projComp.Resize(Width, Height); }); #if GUI_SIMPLE _gui = CreateGui(); // Create the interaction handler _sih = new SceneInteractionHandler(_gui); _guiRenderer = new SceneRenderer(_gui); #endif }
// Init is called on startup. public override void Init() { // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A). RC.ClearColor = new float4(0.8f, 0.9f, 0.7f, 1); _scene = AssetStorage.Get<SceneContainer>("Traktor.fus"); _bodyTransform = _scene.Children.FindNodes(Node => Node.Name == "Body")?.FirstOrDefault()?.GetTransform(); _schaufelTransform = _scene.Children.FindNodes(Node => Node.Name == "Schaufel")?.FirstOrDefault()?.GetTransform(); _oberarmTransform = _scene.Children.FindNodes(Node => Node.Name == "Oberarm")?.FirstOrDefault()?.GetTransform(); _unterarmTransform = _scene.Children.FindNodes(Node => Node.Name == "Arm")?.FirstOrDefault()?.GetTransform(); _leftFrontWheelTransform = _scene.Children.FindNodes(Node => Node.Name == "LeftFrontWheel")?.FirstOrDefault()?.GetTransform(); _rightFrontWheelTransform = _scene.Children.FindNodes(Node => Node.Name == "RightFrontWheel")?.FirstOrDefault()?.GetTransform(); _leftRearWheelTransform = _scene.Children.FindNodes(Node => Node.Name == "LeftRearWheel")?.FirstOrDefault()?.GetTransform(); _rightRearWheelTransform = _scene.Children.FindNodes(Node => Node.Name == "RightRearWheel")?.FirstOrDefault()?.GetTransform(); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); _scenePicker = new ScenePicker(_scene); }
public void SetTrackableEH(DefaultTrackableEventHandler go) { if (go.scene == null) { var sc = _currentGC.GetSceneContainerByName(go.name); if (sc == null) { Debug.Log("SceneContainer is not initialized"); if (_currentGameRunningType == GameRunningType.Edit) { Debug.Log("Add new scene to quest"); sc = new SceneContainer(true); sc.name = go.name; } else { go.gameObject.SetActive(false); return; } } _currentT = go; GameObject newSM = new GameObject(); ARQuestCreator.SceneCreator.SceneManager newSceneManager = newSM.AddComponent <ARQuestCreator.SceneCreator.SceneManager>(); newSceneManager.SetScene(sc); _currentT.scene = newSceneManager; ScreenSpaceUIManager.Instance.GetComponentInChildren <UIEditiSceneController>().SetSceneManager(newSceneManager); } }
// Init is called on startup. public override void Init() { // Set the clear color for the backbuffer to white (100% intensity in all color channels R, G, B, A). RC.ClearColor = new float4(1, 1, 1, 1); // Load the rocket model _houseScene = AssetStorage.Get <SceneContainer>("rover.fus"); //Get transform components for (int i = 0; i < 3; i++) { leftWheelTransforms[i] = _houseScene.Children.FindNodes(node => node.Name == "Rad_L_0" + (i + 1))?.FirstOrDefault()?.GetTransform(); } for (int i = 0; i < 3; i++) { rightWheelTransforms[i] = _houseScene.Children.FindNodes(node => node.Name == "Rad_R_0" + (i + 1))?.FirstOrDefault()?.GetTransform(); } for (int i = 0; i < 2; i++) { armTransforms[i] = _houseScene.Children.FindNodes(node => node.Name == "Arm_0" + (i + 1))?.FirstOrDefault()?.GetTransform(); } // Wrap a SceneRenderer around the model. _sceneRenderer = new SceneRendererForward(_houseScene); _scenePicker = new ScenePicker(_houseScene); }
public TowerBlock(SceneContainer model, int screenWidth, int screenHeight, float speed) { this.model = model; parseModel(); transformComponent.Translation.y = screenHeight / 2 - 100; x = transformComponent.Translation.x; y = transformComponent.Translation.y; z = transformComponent.Translation.z; towerPosition = Instances.Tower.GetHeight(); if (Instances.Tower.GetCountBlocks() > 3) { y += (Instances.Tower.GetBlockHeight() * (Instances.Tower.GetCountBlocks() - 3)); } transformComponent.Translation = new float3(x, y, z); transformComponent.Rotation = new float3(0, 0, 0); transformComponent.Scale = new float3(Instances.Tower.upperWidth / 200, 1, 0.75f); this.screenWidth = screenWidth; this.screenHeight = screenHeight; this.speed = speed; }
// Init is called on startup. public override void Init() { // Set the clear color for the backbuffer to light green (intensities in R, G, B, A). RC.ClearColor = new float4(0.7f, 1.0f, 0.5f, 1.0f); // Create a scene with a cube // The three components: one XForm, one Material and the Mesh _cubeTransform = new TransformComponent { Scale = new float3(1, 1, 1), Translation = new float3(0, 0, 0) }; var cubeShader = new ShaderEffectComponent { Effect = SimpleMeshes.MakeShaderEffect(new float3(0, 0, 1), new float3(1, 1, 1), 4) }; var cubeMesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10)); // Assemble the cube node containing the three components var cubeNode = new SceneNodeContainer(); cubeNode.Components = new List <SceneComponentContainer>(); cubeNode.Components.Add(_cubeTransform); cubeNode.Components.Add(cubeShader); cubeNode.Components.Add(cubeMesh); // Create the scene containing the cube as the only object _scene = new SceneContainer(); _scene.Children = new List <SceneNodeContainer>(); _scene.Children.Add(cubeNode); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); }
// Init is called on startup. public override void Init() { var green = ColorUint.Green.Tofloat3(); var blue = ColorUint.Blue.Tofloat3(); var cyan = ColorUint.Cyan.Tofloat3(); var magenta = ColorUint.Magenta.Tofloat3(); var yellow = ColorUint.Yellow.Tofloat3(); var white = ColorUint.White.Tofloat3(); // var red = ColorUint.Red.Tofloat3(); // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A). RC.ClearColor = new float4(1, 1, 1, 1); // Load the rocket model _scene = CreateScene(); // Wrap a SceneRenderer around the model. _sceneRenderer = new SceneRenderer(_scene); // _upperArm = _scene.Children.FindNodes(node => node.Name == "Arm02Rot").First()?.GetTransform(); // _foreArm = _scene.Children.FindNodes(node => node.Name == "Arm03Rot").First()?.GetTransform(); _upperArm = FindNodeByName(_scene.Children, "Arm02Rot")?.GetTransform(); _foreArm = FindNodeByName(_scene.Children, "Arm03Rot")?.GetTransform(); }
// Init is called on startup. public override void Init() { // Load the scene _scene = AssetStorage.Get <SceneContainer>("WuggyLand.fus"); _sceneScale = float4x4.CreateScale(0.04f); // Instantiate our self-written renderer _renderer = new Renderer(RC); // Find some transform nodes we want to manipulate in the scene _wuggyTransform = _scene.Children.FindNodes(c => c.Name == "Wuggy").First()?.GetTransform(); _wgyWheelBigR = _scene.Children.FindNodes(c => c.Name == "WheelBigR").First()?.GetTransform(); _wgyWheelBigL = _scene.Children.FindNodes(c => c.Name == "WheelBigL").First()?.GetTransform(); _wgyWheelSmallR = _scene.Children.FindNodes(c => c.Name == "WheelSmallR").First()?.GetTransform(); _wgyWheelSmallL = _scene.Children.FindNodes(c => c.Name == "WheelSmallL").First()?.GetTransform(); _wgyNeckHi = _scene.Children.FindNodes(c => c.Name == "NeckHi").First()?.GetTransform(); // Find the trees and store them in a list _trees = new List <SceneNodeContainer>(); _trees.AddRange(_scene.Children.FindNodes(c => c.Name.Contains("Tree"))); // Set the clear color for the backbuffer RC.ClearColor = new float4(1, 1, 1, 1); }
// Init is called on startup. public override void Init() { // Set the clear color for the backbuffer to white (100% intensity in all color channels R, G, B, A). RC.ClearColor = new float4(136f / 255f, 176f / 255f, 75f / 255f, 1); // Create a scene with a cube // The three components: one Transform, one ShaderEffect (blue material) and the Mesh _cubeTransform = new Transform { Translation = new float3(0, 0, 50), Rotation = new float3(0, 0.4f, 0) }; var cubeShader = MakeEffect.FromDiffuseSpecular((float4)ColorUint.Blue, float4.Zero); var cubeMesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10)); // Assemble the cube node containing the three components var cubeNode = new SceneNode(); cubeNode.Components.Add(_cubeTransform); cubeNode.Components.Add(cubeShader); cubeNode.Components.Add(cubeMesh); // Create the scene containing the cube as the only object _scene = new SceneContainer(); _scene.Children.Add(cubeNode); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRendererForward(_scene); _camAngle = 0; }
// Init is called on startup. public override void Init() { // Set the clear color for the backbuffer to white (100% intensity in all color channels R, G, B, A). RC.ClearColor = new float4(1, 1, 1, 1); // Load the model - Monkey.fus for flat shading, MonkeySmooth.fus for smooth shading _rocketScene = AssetStorage.Get <SceneContainer>("terrain.fus"); // Wrap a SceneRenderer around the model. _sceneRenderer = new SceneRenderer(_rocketScene); _scenePicker = new ScenePicker(_rocketScene); _LookAtDefaultPosition = float3.Zero; _LookFromDefaultPosition = new float3(0, 1, -4); _LookUpDefault = float3.UnitY; _LookAtPositionLerpFrom = _LookAtDefaultPosition; _LookAtPositionLerpTo = _LookAtDefaultPosition; _LookFromPositionLerpFrom = _LookFromDefaultPosition; _LookFromPositionLerpTo = _LookFromDefaultPosition; _LerpTimer = 0; _LerpSpeed = 3; _DistanceFactor = 1.5f; }
public virtual void AddPoint(int x, int y) { SharpGL.SceneGraph.Primitives.Point point = new SharpGL.SceneGraph.Primitives.Point(); point.Vertex = new Vertex(x, y, 0); SceneContainer.AddChild(point); }
// Init is called on startup. public override void Init() { // Load the scene file "Cube.fus" SceneContainer sc = AssetStorage.Get <SceneContainer>("Cube.fus"); // Extract the 'First' object of type 'MeshComponent' found in 'sc'`s list of 'Children' without // further specifying any search criterion ('c => true' means: any found MeshComponent will do). MeshComponent mc = sc.Children.FindComponents <MeshComponent>(c => true).First(); // Generate a mesh from the MeshComponent's vertices, normals and triangles. _mesh = new Mesh { Vertices = mc.Vertices, Normals = mc.Normals, Triangles = mc.Triangles }; var shader = RC.CreateShader(_vertexShader, _pixelShader); RC.SetShader(shader); _xformParam = RC.GetShaderParam(shader, "xform"); _xform = float4x4.Identity; // Set the clear color for the backbuffer RC.ClearColor = new float4(1, 1, 1, 1); }
// Init is called on startup. public override void Init() { RC.ClearColor = new float4(0.8f, 0.9f, 0.7f, 1); // _scene = CreateScene(); _scene = AssetStorage.Get <SceneContainer>("Excavator_new.fus"); //Search children of _scene and find the nodes with the exact name. Then get the transform component of each and give the value to the variable. _firstExcavatorArmTransform = _scene.Children.FindNodes(node => node.Name == "FirstExcavatorArm")?.FirstOrDefault()?.GetTransform(); // or GetComponent<Transform>(); _rightWheelFrontTransform = _scene.Children.FindNodes(node => node.Name == "RightWheelFront")?.FirstOrDefault()?.GetTransform(); // or GetComponent<Transform>(); _leftWheelFrontTransform = _scene.Children.FindNodes(node => node.Name == "LeftWheelFront")?.FirstOrDefault()?.GetTransform(); _rightWheelBackTransform = _scene.Children.FindNodes(node => node.Name == "RightWheelBack")?.FirstOrDefault()?.GetTransform(); _leftWheelBackTransform = _scene.Children.FindNodes(node => node.Name == "LeftWheelBack")?.FirstOrDefault()?.GetTransform(); _bodyTransform = _scene.Children.FindNodes(node => node.Name == "Body")?.FirstOrDefault()?.GetTransform(); //Search children of _scene and find the nodes with the exact name. Then get the SourceEffect component of each and give the value to the variable. _rightWheelFrontEffect = _scene.Children.FindNodes(node => node.Name == "RightWheelFront") !.FirstOrDefault()?.GetComponent <SurfaceEffect>(); _leftWheelFrontEffect = _scene.Children.FindNodes(node => node.Name == "LeftWheelFront")?.FirstOrDefault()?.GetComponent <SurfaceEffect>(); _rightWheelBackEffect = _scene.Children.FindNodes(node => node.Name == "RightWheelBack")?.FirstOrDefault()?.GetComponent <SurfaceEffect>(); _leftWheelBackEffect = _scene.Children.FindNodes(node => node.Name == "LeftWheelBack")?.FirstOrDefault()?.GetComponent <SurfaceEffect>(); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRendererForward(_scene); _scenePicker = new ScenePicker(_scene); //Change colors of nodes _rightWheelFrontEffect.SurfaceInput.Albedo = (float4)ColorUint.DarkOliveGreen; _leftWheelFrontEffect.SurfaceInput.Albedo = (float4)ColorUint.SkyBlue; _rightWheelBackEffect.SurfaceInput.Albedo = (float4)ColorUint.Cornsilk; _leftWheelBackEffect.SurfaceInput.Albedo = (float4)ColorUint.Green; }
// Init is called on startup. public override void Init() { #if GUI_SIMPLE _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(RC); _guiFuseeLink = new GUIButton(6, 6, 157, 87); _guiFuseeLink.ButtonColor = new float4(0, 0, 0, 0); _guiFuseeLink.BorderColor = new float4(0, 0.6f, 0.2f, 1); _guiFuseeLink.BorderWidth = 0; _guiFuseeLink.OnGUIButtonDown += _guiFuseeLink_OnGUIButtonDown; _guiFuseeLink.OnGUIButtonEnter += _guiFuseeLink_OnGUIButtonEnter; _guiFuseeLink.OnGUIButtonLeave += _guiFuseeLink_OnGUIButtonLeave; _guiHandler.Add(_guiFuseeLink); _guiFuseeLogo = new GUIImage(AssetStorage.Get <ImageData>("FuseeLogo150.png"), 10, 10, -5, 150, 80); _guiHandler.Add(_guiFuseeLogo); var fontLato = AssetStorage.Get <Font>("Lato-Black.ttf"); fontLato.UseKerning = true; _guiLatoBlack = new FontMap(fontLato, 18); _guiSubText = new GUIText("Simple FUSEE Example", _guiLatoBlack, 100, 100); _guiSubText.TextColor = new float4(0.05f, 0.25f, 0.15f, 0.8f); _guiHandler.Add(_guiSubText); _subtextWidth = GUIText.GetTextWidth(_guiSubText.Text, _guiLatoBlack); _subtextHeight = GUIText.GetTextHeight(_guiSubText.Text, _guiLatoBlack); #endif // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A). RC.ClearColor = new float4(1, 1, 1, 1); // Load the rocket model _rocketScene = AssetStorage.Get <SceneContainer>("RocketModel.fus"); // Wrap a SceneRenderer around the model. _sceneRenderer = new SceneRenderer(_rocketScene); }
// Init is called on startup. public override void Init() { // Set the clear color for the backbuffer to light green (intensities in R, G, B, A). RC.ClearColor = new float4(0.2f, 0.2f, 0.2f, 1.0f); // Create a scene with a cube // The three components: one XForm, one Material and the Mesh _cubeTransform = new TransformComponent { Scale = new float3(1, 0.3f, 1), Translation = new float3(0, 0, 0) }; _cube2 = new TransformComponent { Scale = new float3(1, 0.3f, 1), Translation = new float3(0, 10, 0) }; _cube3 = new TransformComponent { Scale = new float3(1, 0.3f, 1), Translation = new float3(0, -10, 0) }; var cubeMaterial = new MaterialComponent { Diffuse = new MatChannelContainer { Color = new float3(1, 0.7f, 0.2f) }, Specular = new SpecularChannelContainer { Color = float3.One, Shininess = 4 } }; var cubeMesh = SimpleMeshes.CreateCuboid(new float3(10, 10, 10)); // Assemble the cube nodes containing the three components var cubeNode = new SceneNodeContainer(); cubeNode.Components = new List <SceneComponentContainer>(); cubeNode.Components.Add(_cubeTransform); cubeNode.Components.Add(cubeMaterial); cubeNode.Components.Add(cubeMesh); var cubeNode2 = new SceneNodeContainer(); cubeNode2.Components = new List <SceneComponentContainer>(); cubeNode2.Components.Add(_cube2); cubeNode2.Components.Add(cubeMaterial); cubeNode2.Components.Add(cubeMesh); var cubeNode3 = new SceneNodeContainer(); cubeNode3.Components = new List <SceneComponentContainer>(); cubeNode3.Components.Add(_cube3); cubeNode3.Components.Add(cubeMaterial); cubeNode3.Components.Add(cubeMesh); // Create the scene containing the cube as the only object _scene = new SceneContainer(); _scene.Children = new List <SceneNodeContainer>(); _scene.Children.Add(cubeNode); _scene.Children.Add(cubeNode2); _scene.Children.Add(cubeNode3); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); }
// Init is called on startup. public override void Init() { _initWindowWidth = Width; _initWindowHeight = Height; if (_canvasRenderMode == CanvasRenderMode.Screen) { _initCanvasWidth = Width / 100f; _initCanvasHeight = Height / 100f; } else { _initCanvasWidth = 16; _initCanvasHeight = 9; } _canvasHeight = _initCanvasHeight; _canvasWidth = _initCanvasWidth; var fontLato = AssetStorage.Get <Font>("Lato-Black.ttf"); _fontMap1 = new FontMap(fontLato, 8); _fontMap = new FontMap(fontLato, 24); // Set the clear color for the back buffer to white (100% intensity in all color channels R, G, B, A). RC.ClearColor = new float4(1, 1, 1, 1); _bltDestinationTex = new Texture(AssetStorage.Get <ImageData>("townmusicians.jpg")); var bltScrTex = new Texture(AssetStorage.Get <ImageData>("censored_79_16.png")); _bltDestinationTex.Blt(180, 225, bltScrTex); _btnCanvas = new GUIButton { Name = "Canvas_Button" }; _btnCanvas.OnMouseUp += OnBtnCanvasUp; _btnCanvas.OnMouseDown += OnBtnCanvasDown; _btnCanvas.OnMouseEnter += OnBtnCanvasEnter; _btnCanvas.OnMouseExit += OnBtnCanvasExit; _btnCanvas.OnMouseOver += OnMouseOverBtnCanvas; _btnCat = new GUIButton { Name = "Cat_Button" }; _btnCat.OnMouseUp += OnBtnCatUp; _btnCat.OnMouseDown += OnBtnCatDown; _btnCat.OnMouseEnter += OnBtnCatEnter; _btnCat.OnMouseExit += OnBtnCatExit; _btnCat.OnMouseOver += OnMouseOverBtnCat; // Set the scene by creating a scene graph _scene = CreateNineSliceScene(); // Create the interaction handler _sih = new SceneInteractionHandler(_scene); // Wrap a SceneRenderer around the model. _sceneRenderer = new SceneRendererForward(_scene); }
protected SceneChunk(SceneContainer container) { Name = ""; SubName = ""; Unk1 = 0.1f; Matrix = Matrix4x4.Identity; Container = container; }
public SceneRenderer(SceneContainer sc /*, string scenePathDirectory*/) { _lights = new List <LightInfo>(); _sc = sc; // _scenePathDirectory = scenePathDirectory; _state = new RendererState(); InitAnimations(_sc); }
// Init is called on startup. public override void Init() { // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A). RC.ClearColor = new float4(0.8f, 0.9f, 0.7f, 1); _scene = CreateScene(); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); }
// Init is called on startup. public override void Init() { #if GUI_SIMPLE _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(RC); _guiFuseeLink = new GUIButton(6, 6, 157, 87); _guiFuseeLink.ButtonColor = new float4(0, 0, 0, 0); _guiFuseeLink.BorderColor = new float4(0, 0.6f, 0.2f, 1); _guiFuseeLink.BorderWidth = 0; _guiFuseeLink.OnGUIButtonDown += _guiFuseeLink_OnGUIButtonDown; _guiFuseeLink.OnGUIButtonEnter += _guiFuseeLink_OnGUIButtonEnter; _guiFuseeLink.OnGUIButtonLeave += _guiFuseeLink_OnGUIButtonLeave; _guiHandler.Add(_guiFuseeLink); _guiFuseeLogo = new GUIImage(AssetStorage.Get <ImageData>("FuseeLogo150.png"), 10, 10, -5, 150, 80); _guiHandler.Add(_guiFuseeLogo); var fontLato = AssetStorage.Get <Font>("Lato-Black.ttf"); fontLato.UseKerning = true; _guiLatoBlack = new FontMap(fontLato, 18); _guiSubText = new GUIText("FUSEE Example", _guiLatoBlack, 100, 100); _guiSubText.TextColor = new float4(0.05f, 0.25f, 0.15f, 0.8f); _guiHandler.Add(_guiSubText); _subtextWidth = GUIText.GetTextWidth(_guiSubText.Text, _guiLatoBlack); _subtextHeight = GUIText.GetTextHeight(_guiSubText.Text, _guiLatoBlack); #endif // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A). RC.ClearColor = new float4(1, 1, 1, 1); // Load the rocket model _rocketScene = AssetStorage.Get <SceneContainer>("RocketModel.fus"); //Create StereoCam for S3D rendering _stereoCam = new StereoCameraRig(Stereo3DMode.Anaglyph, Width, Height, 6.5f); _stereoCam.AttachToContext(RC); //Create ScreenS3DTextures object holding the 4 textures to be used with the ScreenS3D object ScreenS3DTextures screenTex = new ScreenS3DTextures(); screenTex.Left = RC.CreateTexture(AssetStorage.Get <ImageData>("left.png")); screenTex.LeftDepth = RC.CreateTexture(AssetStorage.Get <ImageData>("depthLeft.png")); screenTex.Right = RC.CreateTexture(AssetStorage.Get <ImageData>("right.png")); screenTex.RightDepth = RC.CreateTexture(AssetStorage.Get <ImageData>("depthRight.png")); //Create ScreenS3D Object using the ScreenS3Dtextures object from above _screen = new ScreenS3D(RC, screenTex); //Set the config fort the Screen objet. This can also be doene using a whole ScreenConfig object and assiging direktly to the ScreenS3D object _screen.Config.ScaleSize = 1000; _screen.Config.ScaleDepth = 5; _screen.Config.Transform = float4x4.CreateTranslation(0, 200, 0); // Wrap a SceneRenderer around the model. _sceneRenderer = new SceneRenderer(_rocketScene); // vl = AssetStorage.Get<VideoStream>("left.mkv"); capL = new Capture("Assets/left.mkv"); capLD = new Capture("Assets/depthLeft.mkv"); capR = new Capture("Assets/right.mkv"); capRD = new Capture("Assets/depthRight.mkv"); }
void OnEnable() { hideFlags = HideFlags.HideAndDontSave; if (objs == null) { objs = ScriptableObject.CreateInstance<SceneContainer>(); } if (so == null) { so = new SerializedObject (objs); } }
public ModelChunk(SceneContainer container) : base(container) { Shader = Shader.None; TextureData = new TextureData(this); Mesh = new MeshData(this); WeightBone = new List <WeightBone>(); Animation = new List <ModelAnimation>(); }
/// <summary> /// Restituisce un menù di pausa che sarà collegato al contenitore di scene. /// </summary> /// <param name="sc">Contenitore di scene da collegare al menù di pausa.</param> public PauseMenu(SceneContainer sc) { curPath = GameApp.CurDir() + GameConstraints.PauseMenu.Path; curName = GameConstraints.PauseMenu.LogicDir; GameMenuMutualPart(sc); ItemsSetup(); updateText(); LoadAndGatherResources(); }
private void UpdateScore(int numberOfUpdates) { var scoreProcessor = SceneContainer.Resolve <ScoreProcessor>(); for (int i = 0; i < numberOfUpdates; i++) { scoreProcessor.UpdateScore(); } }
// Use this for initialization public SceneInfo LoadScene(string scene) { if (SceneContainer.LoadDataFromXML() != null) { sceneContainer = SceneContainer.LoadDataFromXML(); foreach (var sceneInfo in sceneContainer.SceneInfos) { if (sceneInfo.name == scene) return sceneInfo; } } sceneContainer = new SceneContainer(); sceneContainer.Add(new SceneInfo(scene, GameObject.FindGameObjectWithTag("Player").transform.position)); return sceneContainer.SceneInfos[0]; }
public override void KernelLoaded() { base.KernelLoaded(); //init container _sceneContainer = new SceneContainer(); _CURR_CONTAINER = _sceneContainer; //bind events string sceneName = GetComponent<uFrame.Kernel.Scene>().GetType().Name; this.OnEvent<SceneLoaderEvent>().Where((_) => { if (_.SceneRoot == null) return false; return _.SceneRoot.Name == sceneName && _.State == SceneState.Loaded; }).Subscribe(_ =>{ SceneLoaded(); }); }
IEnumerator LoadProcess (string ui, string level) { curScene = null; CharactersRoot.instance.characters.Clear (); CharactersRoot.instance.ghosters.Clear (); preloadMonsters.Clear (); foreach (GameObject go in SceneCache) { if (go != null) { Destroy (go); } } SceneCache.Clear (); yield return new WaitForSeconds (0.01f);//等待 destroy 执行完成 yield return Resources.UnloadUnusedAssets (); GC.Collect (); GUIRoot.instance.loading.SetLoadingPercent (40); yield return new WaitForSeconds (0.01f); if (!String.IsNullOrEmpty (level)) { //Application.LoadLevel ("empty"); loadLevel = level; Application.LoadLevel (loadLevel); targetSundries = ui; } else { LoadSundries (ui); } }
protected override void OnDestroy() { base.OnDestroy(); _CURR_CONTAINER = null; }