Esempio n. 1
0
 internal TransformLogEntry(XbimInstanceHandle handle, TransformAction result)
 {
     InstanceHandle  = handle;
     PerformedAction = result;
 }
Esempio n. 2
0
 internal TransformLogEntry(TransformAction result)
 {
     PerformedAction = result;
 }
Esempio n. 3
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            foreach (var item in Enum.GetNames(typeof(EnvironmentMappingNode.Ratio)))
            {
                this.cmbRatios.Items.Add(item);
            }

            var position = new vec3(8, 0, 4) * 3;
            var center   = new vec3(0, 0, 0);
            var up       = new vec3(0, 1, 0);
            var camera   = new Camera(position, center, up, CameraType.Perspecitive, this.winGLCanvas1.Width, this.winGLCanvas1.Height);

            string folder   = System.Windows.Forms.Application.StartupPath;
            var    totalBmp = new Bitmap(System.IO.Path.Combine(folder, @"cubemaps_skybox.png"));

            Bitmap[] bitmaps = GetBitmaps(totalBmp);
            this.skybox = SkyboxNode.Create(bitmaps); this.skybox.Scale *= 60;
            string       objFilename = System.IO.Path.Combine(folder + @"\..\..\..\..\Infrastructure\CSharpGL.Models", "vnfannulus.obj_");
            var          parser      = new ObjVNFParser(false);
            ObjVNFResult result      = parser.Parse(objFilename);

            if (result.Error != null)
            {
                MessageBox.Show(result.Error.ToString());
            }
            else
            {
                var model = new ObjVNF(result.Mesh);
                var node  = EnvironmentMappingNode.Create(
                    this.skybox.SkyboxTexture,
                    model, ObjVNF.strPosition, ObjVNF.strNormal);
                node.ModelSize = model.GetSize();
                float max = node.ModelSize.max();
                node.Scale        *= 20.0f / max;
                node.RotationAxis  = new vec3(0, 0, 1);
                node.RotationAngle = 90;
                node.Children.Add(new LegacyBoundingBoxNode(node.ModelSize));
                this.environmentMappingNode = node;

                var group = new GroupNode(this.environmentMappingNode, this.skybox);

                this.scene = new Scene(camera)
                {
                    RootNode = group,
                };

                var list            = new ActionList();
                var transformAction = new TransformAction(scene);
                list.Add(transformAction);
                var renderAction = new RenderAction(scene);
                list.Add(renderAction);
                this.actionList = list;

                var manipulater = new FirstPerspectiveManipulater();
                manipulater.Bind(camera, this.winGLCanvas1);

                this.pickingAction = new Picking(scene);

                this.triangleTip = new LegacyTriangleNode();
                this.quadTip     = new LegacyQuadNode();
            }
        }