// 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% 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; }
// 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); }
// 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); }
// 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() { // Set the clear color for the backbuffer to white (100% intensity in all color channels R, G, B, A). RC.ClearColor = new float4(0.2f, 0.3f, 1.0f, 1); _scene = AssetStorage.Get <SceneContainer>("fahrzeug.fus"); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); _scenePicker = new ScenePicker(_scene); }
// Init is called on startup. public override void Init() { RC.ClearColor = new float4(0.8f, 0.9f, 0.7f, 1); _scene = AssetStorage.Get <SceneContainer>("CubeCar.fus"); _rightRearTransform = _scene.Children.FindNodes(node => node.Name == "RightRearWheel")?.FirstOrDefault()?.GetTransform(); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRendererForward(_scene); _scenePicker = new ScenePicker(_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, 0.9f, 0.7f, 1); _scene = AssetStorage.Get <SceneContainer>("CubeCar.fus"); _rightRearTransform = _scene.Children.FindNodes(node => node.Name == "RightRearWheel")?.FirstOrDefault()?.GetTransform(); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRendererForward(_scene); _scenePicker = new ScenePicker(_scene); }
// Init is called on startup. public override void Init() { ////////////////// Fill SceneNodeContainer //////////////////////////////// _parentNode = new SceneNodeContainer { Components = new List <SceneComponentContainer>(), Children = new ChildList() }; var parentTrans = new TransformComponent { Rotation = float3.Zero, Scale = float3.One, Translation = new float3(0, 0, 0) }; _parentNode.Components.Add(parentTrans); _scene = new SceneContainer { Children = new List <SceneNodeContainer> { _parentNode } }; var projComp = new ProjectionComponent(ProjectionMethod.PERSPECTIVE, 1, 5000, M.PiOver4); AddResizeDelegate(delegate { projComp.Resize(Width, Height); }); _scene.Children[0].Components.Insert(0, projComp); _renderer = new SceneRenderer(_scene); _scenePicker = new ScenePicker(_scene); ////////////////////////////////////////////////////////////////////////// RC.ClearColor = new float4(.7f, .7f, .7f, 1); _activeGeometrys = new Dictionary <int, Geometry>(); //Create Geometry //Geometry sphere = CreateGeometry.CreateSpehreGeometry(2,22,11); //sphere = SubdivisionSurface.CatmullClarkSubdivision(sphere); //AddGeometryToSceneNode(sphere, new float3(0,0,0)); //Geometry cuboid = CreateGeometry.CreateCuboidGeometry(5, 2, 5); //AddGeometryToSceneNode(cuboid, new float3(-5,0,0)); }
// Init is called on startup. public override void Init() { RC.ClearColor = new float4(0.8f, 0.9f, 0.7f, 1); _scene = AssetStorage.Get <SceneContainer>("tank.fus"); _backLeftTransform = _scene.Children.FindNodes(node => node.Name == "backwheelLeft")?.FirstOrDefault()?.GetComponent <Transform>(); _backRightTransform = _scene.Children.FindNodes(node => node.Name == "backwheelRight")?.FirstOrDefault()?.GetComponent <Transform>(); _frontLeftTransform = _scene.Children.FindNodes(node => node.Name == "frontwheelLeft")?.FirstOrDefault()?.GetComponent <Transform>(); _frontRightTransform = _scene.Children.FindNodes(node => node.Name == "frontwheelRight")?.FirstOrDefault()?.GetComponent <Transform>(); //_scene = CreateScene(); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRendererForward(_scene); _scenePicker = new ScenePicker(_scene); }
// 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>("gabelstapler.fus"); _scenePicker = new ScenePicker(_scene); _RadVLTransform = _scene.Children.FindNodes(node => node.Name == "RadVL")?.FirstOrDefault()?.GetTransform(); _RadVRTransform = _scene.Children.FindNodes(node => node.Name == "RadVR")?.FirstOrDefault()?.GetTransform(); _RadHLTransform = _scene.Children.FindNodes(node => node.Name == "RadHL")?.FirstOrDefault()?.GetTransform(); _RadHRTransform = _scene.Children.FindNodes(node => node.Name == "RadHR")?.FirstOrDefault()?.GetTransform(); _LiftTransform = _scene.Children.FindNodes(node => node.Name == "Lift")?.FirstOrDefault()?.GetTransform(); _GabelTransform = _scene.Children.FindNodes(node => node.Name == "Gabel")?.FirstOrDefault()?.GetTransform(); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); }
// 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>("Tank.fus"); _rightRearTransform = _scene.Children.FindNodes(node => node.Name == "Hinteres rechtes Rad")?.FirstOrDefault()?.GetTransform(); _leftRearTransform = _scene.Children.FindNodes(node => node.Name == "Hinteres linkes Rad").FirstOrDefault().GetTransform(); _rightFrontTransform = _scene.Children.FindNodes(node => node.Name == "Vorderes rechtes Rad").FirstOrDefault().GetTransform(); _leftFrontTransform = _scene.Children.FindNodes(node => node.Name == "Vorderes linkes Rad").FirstOrDefault().GetTransform(); _bodyTransform = _scene.Children.FindNodes(node => node.Name == "Body").FirstOrDefault().GetTransform(); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); _scenePicker = new ScenePicker(_scene); }
// 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>("gabelstapler.fus"); _RadVLTransform = _scene.Children.FindNodes(node => node.Name == "RadVL")?.FirstOrDefault()?.GetTransform(); _RadVRTransform = _scene.Children.FindNodes(node => node.Name == "RadVR")?.FirstOrDefault()?.GetTransform(); _RadHLTransform = _scene.Children.FindNodes(node => node.Name == "RadHL")?.FirstOrDefault()?.GetTransform(); _RadHRTransform = _scene.Children.FindNodes(node => node.Name == "RadHR")?.FirstOrDefault()?.GetTransform(); _LiftTransform = _scene.Children.FindNodes(node => node.Name == "Lift")?.FirstOrDefault()?.GetTransform(); _GabelTransform = _scene.Children.FindNodes(node => node.Name == "Gabel")?.FirstOrDefault()?.GetTransform(); _BaseTransform = _scene.Children.FindNodes(node => node.Name == "Basis")?.FirstOrDefault()?.GetTransform(); _targetHeight = _GabelTransform.Translation.y; _TrailerTransform = new TransformComponent { Rotation = new float3(-M.Pi / 5.7f, 0, 0), Scale = float3.One, Translation = new float3(0, 0, -10) }; _scene.Children.Add(new SceneNodeContainer { Components = new List <SceneComponentContainer> { _TrailerTransform, new MaterialComponent { Diffuse = new MatChannelContainer { Color = new float3(0.7f, 0.7f, 0.7f) }, Specular = new SpecularChannelContainer { Color = new float3(1, 1, 1), Shininess = 5 } }, SimpleMeshes.CreateCuboid(new float3(2, 2, 2)) } }); _scenePicker = new ScenePicker(_scene); // Create a scene renderer holding the scene above _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, 0.9f, 0.7f, 1); _scene = AssetStorage.Get <SceneContainer>("Auto.fus"); _rechtsVorneTransform = _scene.Children.FindNodes(node => node.Name == "rechtsVorne")?.FirstOrDefault()?.GetTransform(); _linksVorneTransform = _scene.Children.FindNodes(node => node.Name == "linksVorne")?.FirstOrDefault()?.GetTransform(); _rechtsHintenTransform = _scene.Children.FindNodes(node => node.Name == "rechtsHinten")?.FirstOrDefault()?.GetTransform(); _linksHintenTransform = _scene.Children.FindNodes(node => node.Name == "linksHinten")?.FirstOrDefault()?.GetTransform(); _Arm1Transform = _scene.Children.FindNodes(node => node.Name == "Arm1")?.FirstOrDefault()?.GetTransform(); _Arm2Transform = _scene.Children.FindNodes(node => node.Name == "Arm2")?.FirstOrDefault()?.GetTransform(); _Arm3Transform = _scene.Children.FindNodes(node => node.Name == "Arm3")?.FirstOrDefault()?.GetTransform(); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); _scenePicker = new ScenePicker(_scene); }
// 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.2f, 0.2f, 0.2f, 1); _scene = AssetStorage.Get <SceneContainer>("vehicle.fus"); _baseTransform = _scene.Children.FindNodes(node => node.Name == "vehicle")?.FirstOrDefault()?.GetTransform(); canon = _scene.Children.FindNodes(node => node.Name == "canon")?.FirstOrDefault()?.GetTransform(); vr = _scene.Children.FindNodes(node => node.Name == "vr")?.FirstOrDefault()?.GetTransform(); hr = _scene.Children.FindNodes(node => node.Name == "hr")?.FirstOrDefault()?.GetTransform(); vl = _scene.Children.FindNodes(node => node.Name == "vl")?.FirstOrDefault()?.GetTransform(); hl = _scene.Children.FindNodes(node => node.Name == "hl")?.FirstOrDefault()?.GetTransform(); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); _scenePicker = new ScenePicker(_scene); }
// Init is called on startup. public override void Init() { ////////////////// Fill SceneNodeContainer //////////////////////////////// _parentNode = new SceneNode { Components = new List <SceneComponent>(), Children = new ChildList() }; Transform parentTrans = new Transform { Rotation = float3.Zero, Scale = float3.One, Translation = new float3(0, 0, 0) }; _parentNode.Components.Add(parentTrans); _scene = new SceneContainer { Children = new List <SceneNode> { _parentNode } }; _renderer = new SceneRendererForward(_scene); _scenePicker = new ScenePicker(_scene); ////////////////////////////////////////////////////////////////////////// RC.ClearColor = new float4(.7f, .7f, .7f, 1); _activeGeometrys = new Dictionary <int, Geometry>(); //Create Geometry //Geometry sphere = CreateGeometry.CreateSpehreGeometry(2,22,11); //sphere = SubdivisionSurface.CatmullClarkSubdivision(sphere); //AddGeometryToSceneNode(sphere, new float3(0,0,0)); //Geometry cuboid = CreateGeometry.CreateCuboidGeometry(5, 2, 5); //AddGeometryToSceneNode(cuboid, new float3(-5,0,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.8f, 0.9f, 0.7f, 1); _scene = AssetStorage.Get <SceneContainer>("panzer.fus"); _towerTransform = _scene.Children.FindNodes(node => node.Name == "Turm")?.FirstOrDefault()?.GetTransform(); _HRTransform = _scene.Children.FindNodes(node => node.Name == "Rad-hinten-rechts")?.FirstOrDefault()?.GetTransform(); _HLTransform = _scene.Children.FindNodes(node => node.Name == "Rad-hinten-links")?.FirstOrDefault()?.GetTransform(); _VRTransform = _scene.Children.FindNodes(node => node.Name == "Rad-vorne-rechts")?.FirstOrDefault()?.GetTransform(); _VLTransform = _scene.Children.FindNodes(node => node.Name == "Rad-vorne-Links")?.FirstOrDefault()?.GetTransform(); _RumpfTransform = _scene.Children.FindNodes(node => node.Name == "Rumpf")?.FirstOrDefault()?.GetTransform(); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); //picker _scenePicker = new ScenePicker(_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, 0.9f, 0.7f, 1); _scene = AssetStorage.Get <SceneContainer>("Bagger.fus"); _scenePicker = new ScenePicker(_scene); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); _haus = _scene.Children.FindNodes(node => node.Name == "Haus")?.FirstOrDefault()?.GetTransform(); _unterarm = _scene.Children.FindNodes(node => node.Name == "Unterarm")?.FirstOrDefault()?.GetTransform(); _schaufel = _scene.Children.FindNodes(node => node.Name == "Schaufel")?.FirstOrDefault()?.GetTransform(); _reifenLV = _scene.Children.FindNodes(node => node.Name == "ReifenLV")?.FirstOrDefault()?.GetTransform(); _reifenRV = _scene.Children.FindNodes(node => node.Name == "ReifenRV")?.FirstOrDefault()?.GetTransform(); _reifenLH = _scene.Children.FindNodes(node => node.Name == "ReifenLH")?.FirstOrDefault()?.GetTransform(); _reifenRH = _scene.Children.FindNodes(node => node.Name == "ReifenRH")?.FirstOrDefault()?.GetTransform(); }
// Init is called on startup. public override void Init() { RC.ClearColor = new float4(0.8f, 0.9f, 0.7f, 1); _scene = AssetStorage.Get <SceneContainer>("Gabelstabler.fus"); _carTransform = _scene.Children.FindNodes(node => node.Name == "Fahrzeug")?.FirstOrDefault()?.GetTransform(); _wheelBackR = _scene.Children.FindNodes(node => node.Name == "Rad_RH")?.FirstOrDefault()?.GetTransform(); _wheelBackL = _scene.Children.FindNodes(node => node.Name == "Rad_LH")?.FirstOrDefault()?.GetTransform(); _wheelFrontL = _scene.Children.FindNodes(node => node.Name == "Rad_LV")?.FirstOrDefault()?.GetTransform(); _wheelFrontR = _scene.Children.FindNodes(node => node.Name == "Rad_RV")?.FirstOrDefault()?.GetTransform(); _gabelHalterung = _scene.Children.FindNodes(node => node.Name == "Gabel")?.FirstOrDefault()?.GetTransform(); _gabelPlatte = _scene.Children.FindNodes(node => node.Name == "Gabel_Platte")?.FirstOrDefault()?.GetTransform(); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRendererForward(_scene); _scenePicker = new ScenePicker(_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, 0.9f, 0.7f, 1); _scene = AssetStorage.Get <SceneContainer>("Bagger.fus"); _WheelVLTransform = _scene.Children.FindNodes(node => node.Name == "WheelVL")?.FirstOrDefault()?.GetTransform(); _WheelVRTransform = _scene.Children.FindNodes(node => node.Name == "WheelVR")?.FirstOrDefault()?.GetTransform(); _WheelHLTransform = _scene.Children.FindNodes(node => node.Name == "WheelHL")?.FirstOrDefault()?.GetTransform(); _WheelHRTransform = _scene.Children.FindNodes(node => node.Name == "WheelHR")?.FirstOrDefault()?.GetTransform(); _ArmTransform = _scene.Children.FindNodes(node => node.Name == "Arm")?.FirstOrDefault()?.GetTransform(); _SchaufelTransform = _scene.Children.FindNodes(node => node.Name == "Schaufel")?.FirstOrDefault()?.GetTransform(); _BodyTransform = _scene.Children.FindNodes(node => node.Name == "Body")?.FirstOrDefault()?.GetTransform(); _WheelVLShader = _scene.Children.FindNodes(node => node.Name == "WheelVL")?.FirstOrDefault()?.GetComponent <ShaderEffectComponent>(); //_WheelVLShader.SetEffectParam("DiffuseColor", new float3(1, 0.4f, 0.4f)); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); _scenePicker = new ScenePicker(_scene); }
// Init is called on startup. public override void Init() { _initCanvasWidth = Width / 100f; _initCanvasHeight = Height / 100f; _canvasHeight = _initCanvasHeight; _canvasWidth = _initCanvasWidth; // 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 SceneRendererForward(_scene); _scenePicker = new ScenePicker(_scene); _gui = CreateGui(); // Create the interaction handler _sih = new SceneInteractionHandler(_gui); _guiRenderer = new SceneRendererForward(_gui); }
// 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>("Excavator.fus"); _scenePicker = new ScenePicker(_scene); _baseTransform = _scene.Children.FindNodes(node => node.Name == "ExcavatorBase")?.FirstOrDefault()?.GetTransform(); _cabinTransform = _scene.Children.FindNodes(node => node.Name == "ExcavatorCabin")?.FirstOrDefault()?.GetTransform(); _lowerArmTransform = _scene.Children.FindNodes(node => node.Name == "lowerArm")?.FirstOrDefault()?.GetTransform(); _middleArmTransform = _scene.Children.FindNodes(node => node.Name == "middleArm")?.FirstOrDefault()?.GetTransform(); _upperArmTransform = _scene.Children.FindNodes(node => node.Name == "upperArm")?.FirstOrDefault()?.GetTransform(); _shovelTransform = _scene.Children.FindNodes(node => node.Name == "Shovel")?.FirstOrDefault()?.GetTransform(); /*var scalehelper = new float3(0.5f,2,0.5f); * _lowerArmTransform.Scale = scalehelper; * _middleArmTransform.Scale = scalehelper; * _upperArmTransform.Scale = scalehelper;*/ // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); }
// 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>("radpanzer2.fus"); _radvl = _scene.Children.FindNodes(node => node.Name == "rad_vl")?.FirstOrDefault()?.GetTransform(); _radhl = _scene.Children.FindNodes(node => node.Name == "rad_hl")?.FirstOrDefault()?.GetTransform(); _radvr = _scene.Children.FindNodes(node => node.Name == "rad_vr")?.FirstOrDefault()?.GetTransform(); _radhr = _scene.Children.FindNodes(node => node.Name == "rad_hr")?.FirstOrDefault()?.GetTransform(); _turretTransform = _scene.Children.FindNodes(node => node.Name == "turm")?.FirstOrDefault()?.GetTransform(); _tankTransform = _scene.Children.FindNodes(node => node.Name == "hull")?.FirstOrDefault()?.GetTransform(); _gunTransform1 = _scene.Children.FindNodes(node => node.Name == "gun1")?.FirstOrDefault()?.GetTransform(); _gunTransform2 = _scene.Children.FindNodes(node => node.Name == "gun2")?.FirstOrDefault()?.GetTransform(); _gunTransform3 = _scene.Children.FindNodes(node => node.Name == "gun3")?.FirstOrDefault()?.GetTransform(); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); _scenePicker = new ScenePicker(_scene); }
private void Awake() { _scenePicker = GetComponent <ScenePicker>(); startBtn.onClick.AddListener(() => SceneManager.LoadScene(_scenePicker.scenePath)); exitBtn.onClick.AddListener(Application.Quit); }
// Init is called on startup. public override void Init() { if (_canvasRenderMode == CanvasRenderMode.Screen) { UserInterfaceHelper.CanvasWidthInit = Width / 100f; UserInterfaceHelper.CanvasHeightInit = Height / 100f; } else { UserInterfaceHelper.CanvasHeightInit = 16; UserInterfaceHelper.CanvasWidthInit = 9; } _canvasHeight = UserInterfaceHelper.CanvasHeightInit; _canvasWidth = UserInterfaceHelper.CanvasWidthInit; _uiInput = new List <UserInterfaceInput>(); _initWidth = Width; _initHeight = Height; //_scene = BuildScene(); _scene = AssetStorage.Get <SceneContainer>("Monkey.fus"); var monkey = _scene.Children[0].GetComponent <Mesh>(); // Check if rnd was injected (render tests inject a seeded random) if (rnd == null) { rnd = new Random(); } var numberOfTriangles = monkey.Triangles.Length / 3; //Create dummy positions on model for (int i = 0; i < NumberOfAnnotations; i++) { int triangleNumber = rnd.Next(1, numberOfTriangles); int triIndex = (triangleNumber - 1) * 3; float3 triVert0 = monkey.Vertices[monkey.Triangles[triIndex]]; float3 triVert1 = monkey.Vertices[monkey.Triangles[triIndex + 1]]; float3 triVert2 = monkey.Vertices[monkey.Triangles[triIndex + 2]]; float3 middle = (triVert0 + triVert1 + triVert2) / 3; float2 circleCanvasPos = new(middle.x, middle.y); float2 circleCanvasPosCache = new(0, 0); float prob = (float)rnd.NextDouble(); prob = (float)System.Math.Round(prob, 3); string dummyClass = UserInterfaceHelper.DummySegmentationClasses[rnd.Next(0, UserInterfaceHelper.DummySegmentationClasses.Count - 1)]; UserInterfaceHelper.AnnotationKind annotationKind = (UserInterfaceHelper.AnnotationKind)rnd.Next(0, Enum.GetNames(typeof(UserInterfaceHelper.AnnotationKind)).Length); UserInterfaceInput input = new(annotationKind, middle, new float2(0.65f, 0.65f), dummyClass, prob) { Identifier = i, CircleCanvasPos = circleCanvasPos, CircleCanvasPosCache = circleCanvasPosCache }; input.AffectedTriangles.Add(triIndex); _uiInput.Add(input); } _gui = CreateGui(); // Create the interaction handler _sih = new SceneInteractionHandler(_gui); //Create a scene picker for performing visibility tests _scenePicker = new ScenePicker(_scene); // Set the clear color for the back buffer to white (100% intensity in all color channels R, G, B, A). RC.ClearColor = new float4(0.1f, 0.1f, 0.1f, 1); // Wrap a SceneRenderer around the model. _sceneRenderer = new SceneRendererForward(_scene); _guiRenderer = new SceneRendererForward(_gui); }
private Units PickupTarget() { ScenePicker scenePicker = new ScenePicker(Input.mousePosition); return(scenePicker.PickBestUnit((Units x) => (x.tag == "Hero" || x.tag == "Player" || x.tag == "Monster" || x.tag == "Building" || x.tag == "Home") && x.unique_id != Singleton <PvpManager> .Instance.MyHeroUniqueId && (x.tag != "Monster" || (x.tag == "Monster" && x.teamType == 2)))); }
private void Start() { nextLevel = GetComponent <ScenePicker>(); Debug.Assert(nextLevel); }
// 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>("Fahrzeug8.fus"); _oberesGewTransform = _scene.Children.FindNodes(node => node.Name == "pfeiler_gewinde_arm_nicht_drehbar")?.FirstOrDefault()?.GetTransform(); _RadR01Transform = _scene.Children.FindNodes(node => node.Name == "Rad_R_01")?.FirstOrDefault()?.GetTransform(); _RadR02Transform = _scene.Children.FindNodes(node => node.Name == "Rad_L_01")?.FirstOrDefault()?.GetTransform(); _RadR03Transform = _scene.Children.FindNodes(node => node.Name == "Rad_02_R")?.FirstOrDefault()?.GetTransform(); _RadR04Transform = _scene.Children.FindNodes(node => node.Name == "Rad_02_L")?.FirstOrDefault()?.GetTransform(); _RadR05Transform = _scene.Children.FindNodes(node => node.Name == "Rad_03_L")?.FirstOrDefault()?.GetTransform(); _RadR06Transform = _scene.Children.FindNodes(node => node.Name == "Rad_03_R")?.FirstOrDefault()?.GetTransform(); _unterarmTransform = _scene.Children.FindNodes(node => node.Name == "unterer_arm")?.FirstOrDefault()?.GetTransform(); //Oberer_arm //_oberarmTransform = _scene.Children.FindNodes(node => node.Name == "Oberer_arm")?.FirstOrDefault()?.GetTransform(); _verbagTransform = _scene.Children.FindNodes(node => node.Name == "verbindung_arm_greifer")?.FirstOrDefault()?.GetTransform(); _carTransform = _scene.Children.FindNodes(node => node.Name == "cassis")?.FirstOrDefault()?.GetTransform(); //_Pallete = _scene.Children.FindNodes(node => node.Name == "Pallete")?.FirstOrDefault()?.GetTransform(); _Pallete = _verbagTransform.Translation.y; _trailerTransform = new TransformComponent { Rotation = new float3(-M.Pi / 5.7f, 0, 0), Scale = float3.One, Translation = new float3(0, 0, -10) }; _scene.Children.Add(new SceneNodeContainer { Components = new List <SceneComponentContainer> { _trailerTransform, new MaterialComponent { Diffuse = new MatChannelContainer { Color = new float3(0.7f, 0.7f, 0.7f) }, Specular = new SpecularChannelContainer { Color = new float3(1, 1, 1), Shininess = 5 } }, SimpleMeshes.CreateCuboid(new float3(2, 2, 2)) } }); _baseTransform = new TransformComponent { Rotation = new float3(0, 0, 0), Scale = float3.One, Translation = new float3(100, 100, 0) }; _scene.Children.Add(new SceneNodeContainer { Components = new List <SceneComponentContainer> { _baseTransform, new MaterialComponent { Diffuse = new MatChannelContainer { Color = new float3(1f, 0.7f, 0.7f) }, Specular = new SpecularChannelContainer { Color = new float3(1, 1, 1), Shininess = 5 } }, SimpleMeshes.CreateCuboid(new float3(2, 2, 2)) } }); //Scene Picker _scenePicker = new ScenePicker(_scene); // Create a scene renderer holding the scene above _sceneRenderer = new SceneRenderer(_scene); //_sceneRenderer1 = new SceneRenderer(_scene1); }
/// <summary> /// Initializes a new instance of the <see cref="SceneInteractionHandler"/> class. /// </summary> /// <param name="scene">The scene the interaction handler belongs to.</param> public SceneInteractionHandler(SceneContainer scene) { _scenePicker = new ScenePicker(scene); }
public void LoadScene(ScenePicker scene) { Debug.Log("Loading scene: " + scene.scenePath); SceneManager.LoadScene(scene.scenePath); }