예제 #1
0
        /// <summary>
        /// Draws a sphere very quickly using an OpenGL display list. This method must not be called
        /// in between Gl.glNewList and Gl.glEndList.</summary>
        /// <param name="radius">Sphere radius</param>
        /// <param name="renderStyle">Render style: Wireframe or Solid</param>
        public static void DrawSphereDisplayList(float radius, RenderStyle renderStyle)
        {
            int drawStyle = (renderStyle == RenderStyle.Wireframe) ? Glu.GLU_LINE : Glu.GLU_FILL;

            Gl.glPushMatrix();
            Gl.glScalef(radius, radius, radius);

            int displayList;

            if (!s_sphereDisplayLists.TryGetValue(drawStyle, out displayList))
            {
                displayList = Gl.glGenLists(1);
                Gl.glNewList(displayList, Gl.GL_COMPILE);

                Glu.gluQuadricDrawStyle(s_quadric, drawStyle);
                Glu.gluQuadricNormals(s_quadric, Glu.GLU_SMOOTH);
                Glu.gluSphere(s_quadric, 1.0f, FAST_SPHERE_SLICES, FAST_SPHERE_STACKS);

                Gl.glEndList();
                s_sphereDisplayLists.Add(drawStyle, displayList);
            }

            Gl.glCallList(displayList);
            Gl.glPopMatrix();

            Util3D.RenderStats.PrimCount   += FAST_SPHERE_SLICES * FAST_SPHERE_STACKS;                 //2 stacks are triangles; rest are quads.
            Util3D.RenderStats.VertexCount +=                                                          //each stack is a separate tri fan / quad strip?
                                              (2 + FAST_SPHERE_SLICES) * 2 +                           //the two triangle fans at top and bottom of sphere.
                                              (2 + FAST_SPHERE_SLICES * 2) * (FAST_SPHERE_STACKS - 2); //the remaining stacks are quad strips.
        }
예제 #2
0
        /// <summary>
        /// Helper function to CompressToFit.  Considers compressing nodes from one level to another.
        /// </summary>
        /// <param name="rawUi">
        /// The PSHostRawUserInterface used to gauge string widths in the rendering.
        /// </param>
        /// <param name="maxHeight">
        /// The maximum height (in BufferCells) that the rendering may consume.
        /// </param>
        /// <param name="maxWidth">
        /// The maximum width (in BufferCells) that the rendering may consume.
        /// </param>
        /// <param name="nodesCompressed">
        /// Receives the number of nodes that were compressed. If the result of the method is false, then this will be the total
        /// number of nodes being tracked (i.e. all of them will have been compressed).
        /// </param>
        /// <param name="priorStyle">
        /// The rendering style (e.g. "compression level") that the nodes are expected to currently have.
        /// </param>
        /// <param name="newStyle">
        /// The new rendering style that a node will have when it is compressed. If the result of the method is false, then all
        /// nodes will have this rendering style.
        /// </param>
        /// <returns>
        /// true to indicate that the nodes are compressed to the point that their rendering will fit within the constraint, or
        /// false to indicate that all of the nodes are compressed to a given level, but that the rendering still can't fit
        /// within the constraint.
        /// </returns>
        private bool CompressToFitHelper(
            PSHostRawUserInterface rawUi,
            int maxHeight,
            int maxWidth,
            out int nodesCompressed,
            RenderStyle priorStyle,
            RenderStyle newStyle)
        {
            nodesCompressed = 0;

            int age = 0;

            do
            {
                ProgressNode node = FindOldestNodeOfGivenStyle(_topLevelNodes, age, priorStyle);
                if (node == null)
                {
                    // We've compressed every node of the prior style already.
                    break;
                }

                node.Style = newStyle;
                nodesCompressed++;
                if (TallyHeight(rawUi, maxHeight, maxWidth) <= maxHeight)
                {
                    return(true);
                }
            } while (true);

            // If we get all the way to here, then we've compressed all the nodes and we still don't fit.
            return(false);
        }
예제 #3
0
        /// <summary>
        /// Draws a cone very quickly using an OpenGL display list, with no bottom disk and
        /// 8 slices radiating from the tip. This method must not be called in between Gl.glNewList
        /// and Gl.glEndList.</summary>
        /// <param name="baseRadius">Radius at base of cone</param>
        /// <param name="height">Cone height</param>
        /// <param name="renderStyle">Render style: Wireframe or Solid</param>
        public static void DrawConeDisplayList(float baseRadius, float height, RenderStyle renderStyle)
        {
            int drawStyle = (renderStyle == RenderStyle.Wireframe) ? Glu.GLU_LINE : Glu.GLU_FILL;

            Gl.glPushMatrix();
            Gl.glScalef(baseRadius, baseRadius, height);

            int displayList;

            if (!s_coneDisplayLists.TryGetValue(drawStyle, out displayList))
            {
                displayList = Gl.glGenLists(1);
                Gl.glNewList(displayList, Gl.GL_COMPILE);

                Glu.gluQuadricDrawStyle(s_quadric, drawStyle);
                Glu.gluQuadricNormals(s_quadric, Glu.GLU_SMOOTH);
                Glu.gluCylinder(s_quadric, 1.0, 0.0, 1.0, FAST_CONE_SLICES, FAST_CONE_STACKS);

                Gl.glEndList();
                s_coneDisplayLists.Add(drawStyle, displayList);
            }

            Gl.glCallList(displayList);
            Gl.glPopMatrix();

            // Note that we are not rendering the bottom. That would require a separate call to gluDisk.
            // Assuming that each stack is a quad strip. This cone could be more efficiently rendered
            // as a triangle fan.
            Util3D.RenderStats.PrimCount   += FAST_CONE_SLICES * FAST_CONE_STACKS;
            Util3D.RenderStats.VertexCount += (2 + FAST_CONE_SLICES * 2) * FAST_CONE_STACKS;
        }
예제 #4
0
        /// <summary>
        /// Draws a cube, using an OpenGL display list for greatly improved performance. This method must
        /// not be called in between Gl.glNewList and Gl.glEndList.</summary>
        /// <param name="size">Dimension of side of cube</param>
        /// <param name="renderStyle">Render style: Wireframe or Solid</param>
        public static void DrawCubeDisplayList(float size, RenderStyle renderStyle)
        {
            int displayList;

            Gl.glPushMatrix();
            Gl.glScalef(size, size, size);

            int drawStyle = (renderStyle == RenderStyle.Wireframe) ? Glu.GLU_LINE : Glu.GLU_FILL;

            if (!s_cubeDisplayLists.TryGetValue(drawStyle, out displayList))
            {
                displayList = Gl.glGenLists(1);
                Gl.glNewList(displayList, Gl.GL_COMPILE);

                DrawUnitBox((renderStyle == RenderStyle.Wireframe) ? Gl.GL_LINE_LOOP : Gl.GL_QUADS);

                Gl.glEndList();
                s_cubeDisplayLists.Add(drawStyle, displayList);
            }
            Gl.glCallList(displayList);
            Gl.glPopMatrix();

            Util3D.RenderStats.VertexCount += 6 * 4;
            Util3D.RenderStats.PrimCount   += 6;
        }
예제 #5
0
        public DummyLightingSetup(RenderStyle renderStyle, string formTitle)
        {
            InitializeComponent();
            Icon = Common.Resources.Properties.Resources.Icon_Vixen3;

            RenderStyle = renderStyle;
            FormTitle = formTitle;
        }
        public DummyLightingSetup(RenderStyle renderStyle, string formTitle)
        {
            InitializeComponent();
            Icon = Common.Resources.Properties.Resources.Icon_Vixen3;

            RenderStyle = renderStyle;
            FormTitle   = formTitle;
        }
예제 #7
0
 private void radioButton_CheckedChanged(object sender, EventArgs e)
 {
     if (radioButtonMonochrome.Checked)
         RenderStyle = RenderStyle.Monochrome;
     if (radioButtonMultiRGB.Checked)
         RenderStyle = RenderStyle.RGBMultiChannel;
     if (radioButtonSingleRGB.Checked)
         RenderStyle = RenderStyle.RGBSingleChannel;
 }
예제 #8
0
        /// <summary>
        /// Draws a cube using OpenGL primitives. Consider using DrawCubeDisplayList.</summary>
        /// <param name="size">Dimension of side of cube</param>
        /// <param name="renderStyle">Render style: Wireframe or Solid</param>
        public static void DrawCube(double size, RenderStyle renderStyle)
        {
            Gl.glPushMatrix();
            Gl.glScalef((float)size, (float)size, (float)size);
            DrawUnitBox((renderStyle == RenderStyle.Wireframe) ? Gl.GL_LINE_LOOP : Gl.GL_QUADS);
            Gl.glPopMatrix();

            Util3D.RenderStats.VertexCount += 6 * 4;
            Util3D.RenderStats.PrimCount   += 6;
        }
예제 #9
0
        //public override Asset Clone()
        //{
        //    Model m = new Model
        //    {
        //        Bones = new ModelBoneCollection(bones),
        //        Meshes = Meshes.ConvertAll(mesh => new ModelMesh(mesh))
        //    };

        //    foreach (KeyValuePair<string, object> kvp in supportingDocuments)
        //    {
        //        m.SupportingDocuments[kvp.Key] = kvp.Value;
        //    }

        //    return m;
        //}

        public void SetRenderStyle(RenderStyle style)
        {
            foreach (ModelMesh mesh in Meshes)
            {
                foreach (ModelMeshPart part in mesh.MeshParts)
                {
                    part.RenderStyle = style;
                }
            }
        }
예제 #10
0
 public void SetRenderStyle(RenderStyle style)
 {
     foreach (var mesh in meshes)
     {
         foreach (var part in mesh.MeshParts)
         {
             part.RenderStyle = style;
         }
     }
 }
예제 #11
0
        public DummyLightingSetup(RenderStyle renderStyle, string formTitle)
        {
            InitializeComponent();
            ForeColor = ThemeColorTable.ForeColor;
            BackColor = ThemeColorTable.BackgroundColor;
            ThemeUpdateControls.UpdateControls(this);
            Icon = Resources.Icon_Vixen3;

            RenderStyle = renderStyle;
            FormTitle = formTitle;
        }
예제 #12
0
 public void SetRenderStyle(RenderStyle renderStyle)
 {
     if (renderStyle == RenderStyle.Normal)
     {
         spriteRenderer.material = materialNormal;
     }
     else if (renderStyle == RenderStyle.White)
     {
         spriteRenderer.material = materialWhite;
     }
 }
예제 #13
0
파일: Plain.cs 프로젝트: Coval1000/topo-cs
 public Plain()
 {
     COLOR_MODE_ = ColorMode.GreyScale;
     GridDensity = 1;
     PLOTTING    = DataMode.Extrapolator0;
     _offSetX    = 0;
     _offSetY    = 0;
     RENDERING   = RenderStyle.Solid;
     draw        = false;
     _SolidColor = new Color4(0.0f, 0.75f, 0.75f, 1.0f);
 }
예제 #14
0
        public string RenderHtml(BattleUnit battleUnit, RenderStyle renderStyle)
        {
            if (!battleUnit.IsAlive)
            {
                return(string.Empty);
            }
            string decorator      = (renderStyle == RenderStyle.Current ? "<b>" : renderStyle == RenderStyle.Target ? "<i>" : string.Empty);
            string decoratorClose = (renderStyle == RenderStyle.Current ? "</b>" : renderStyle == RenderStyle.Target ? "</i>" : string.Empty);

            return($"<td>{decorator}{battleUnit.Name}<br>HP: {battleUnit.HP}<br>Cooldown: {battleUnit.Cooldown}<br><br>Attack: {battleUnit.Attack}<br>Speed: {battleUnit.Speed}{decoratorClose}</td>");
        }
예제 #15
0
        public DummyLightingSetup(RenderStyle renderStyle, string formTitle)
        {
            InitializeComponent();
            ForeColor = ThemeColorTable.ForeColor;
            BackColor = ThemeColorTable.BackgroundColor;
            ThemeUpdateControls.UpdateControls(this);
            Icon = Resources.Icon_Vixen3;

            RenderStyle = renderStyle;
            FormTitle   = formTitle;
        }
 public Model()
 {
     textures_               = new string[] { "glowing_dot.png", "flare.png" };
     materials_              = new RenderMaterial[] { RenderMaterial.Normal };
     renderStyles_           = new RenderStyle[] { new RenderStyle(0, new uint[] { 0 }), new RenderStyle(0, new uint[] { 1 }) };
     frameTime_              = 0.0333333F;
     presimulateTime_        = 0F;
     maxNumRenderCalls_      = 202;
     maxNumParticles_        = 202;
     emitterModels_          = new EmitterModel[] { new Emitter_Sparks(), new Emitter_Splash() };
     activeEmitterModels_    = new uint[] { 1 };
     randomGeneratorCreator_ = () => { return(_math.rand_); };
 }
 public Model()
 {
     textures_               = new string[] { "glowing_dot.png" };
     materials_              = new RenderMaterial[] { RenderMaterial.Add };
     renderStyles_           = new RenderStyle[] { new RenderStyle(0, new uint[] { 0 }) };
     frameTime_              = 0.0333333F;
     presimulateTime_        = 0F;
     maxNumRenderCalls_      = 200;
     maxNumParticles_        = 200;
     emitterModels_          = new EmitterModel[] { new Emitter_DefaultEmitter() };
     activeEmitterModels_    = new uint[] { 0 };
     randomGeneratorCreator_ = () => { return(_math.rand_); };
 }
예제 #18
0
 public Model()
 {
     textures_               = new string[] { "fire5x1.png", "fire_spark.png" };
     materials_              = new RenderMaterial[] { RenderMaterial.Add };
     renderStyles_           = new RenderStyle[] { new RenderStyle(0, new uint[] { 0 }), new RenderStyle(0, new uint[] { 1 }) };
     frameTime_              = 0.0333333F;
     presimulateTime_        = 0F;
     maxNumRenderCalls_      = 200;
     maxNumParticles_        = 200;
     emitterModels_          = new EmitterModel[] { new Emitter_Fire(), new Emitter_Sparks() };
     activeEmitterModels_    = new uint[] { 0, 1 };
     randomGeneratorCreator_ = () => { return(_math.rand_); };
 }
예제 #19
0
 public Effect_noise_test()
 {
     textures_               = new string[] { "star_glow_white.png" };
     materials_              = new RenderMaterial[] { RenderMaterial.Normal };
     renderStyles_           = new RenderStyle[] { new RenderStyle(0, new uint[] { 0 }) };
     frameTime_              = 0.0333333F;
     presimulateTime_        = 0F;
     maxNumRenderCalls_      = 200;
     maxNumParticles_        = 200;
     emitterModels_          = new EmitterModel[] { new Emitter_DefaultEmitter() };
     activeEmitterModels_    = new uint[] { 0 };
     randomGeneratorCreator_ = () => { return(_math.rand_); };
 }
예제 #20
0
        /// <summary>
        /// Draws a sphere, slowly. Consider using DrawSphereDisplayList(), which has less
        /// flexibility but is much faster.</summary>
        /// <param name="radius">Sphere radius</param>
        /// <param name="slices">Number of longitudinal segments</param>
        /// <param name="stacks">Number of latitudinal segments</param>
        /// <param name="renderStyle">Render style: Wireframe or Solid</param>
        public static void DrawSphere(double radius, int slices, int stacks, RenderStyle renderStyle)
        {
            int drawStyle = (renderStyle == RenderStyle.Wireframe) ? Glu.GLU_LINE : Glu.GLU_FILL;

            Glu.gluQuadricDrawStyle(s_quadric, drawStyle);
            Glu.gluQuadricNormals(s_quadric, Glu.GLU_SMOOTH);
            Glu.gluSphere(s_quadric, radius, slices, stacks);

            Util3D.RenderStats.PrimCount   += slices * stacks;                 //2 stacks are triangles; rest are quads.
            Util3D.RenderStats.VertexCount +=                                  //each stack is a separate tri fan / quad strip?
                                              (2 + slices) * 2 +               //the two triangle fans at top and bottom of sphere.
                                              (2 + slices * 2) * (stacks - 2); //the remaining stacks are quad strips.
        }
예제 #21
0
        public virtual void Render(SpriteBatch batch)
        {
            if (!Options.IsVisible)
            {
                return;
            }

            RenderTemplate.ControlDrawable.Render(batch, this);
            RenderStyle.Render(this, batch);

            if (Text != null)
            {
                text.RenderStyle.Render(this, batch);
                RenderTemplate.TextDrawable.Render(batch, this.Text);
            }
        }
예제 #22
0
        private void DrawExample()
        {
            Graphics     g = painterControl1.Graphics;
            GraphicsPath p = new GraphicsPath();
            float        l, t;
            RenderStyle  rs = (RenderStyle)comboBox1.SelectedIndex;

            switch (rs)
            {
            case RenderStyle.Squares:
                p = _testBlock.GetSquareShape(_settingsPack.Coefficient);
                break;

            case RenderStyle.Stars:
                p = _testBlock.GetStarShape(_settingsPack.JagCount);
                break;
            }


            g.Clear(_settingsPack.BackCol);

            g.FillRectangle(new SolidBrush(_settingsPack.FieldCol), new Rectangle(50, 50, 120, 120));
            g.DrawLine(new Pen(_settingsPack.GridCol), 50, 50, 50, 170);
            g.DrawLine(new Pen(_settingsPack.GridCol), 150, 50, 150, 170);
            g.DrawLine(new Pen(_settingsPack.GridCol), 50, 50, 170, 50);
            g.DrawLine(new Pen(_settingsPack.GridCol), 50, 150, 170, 150);

            g.FillPath(new SolidBrush(_testBlock.Color), p);

            FontInfo fi = Fun.GetFontInfo(_testBlock.Text, _testBlock.Width, _settingsPack.FontName, g);
            Font     f  = new Font(_settingsPack.FontName, fi.Size);

            l = t = 50;
            if (fi.Width > fi.Height)
            {
                t += (_testBlock.Width - fi.Height) / 2;
            }
            else
            {
                l += (_testBlock.Width - fi.Width) / 2;
            }

            g.DrawString(_testBlock.Text, f, Brushes.Black, l, t);

            painterControl1.RazorPaint();
        }
예제 #23
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //// Use: Multi Solid Bodies
        ////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public void CreateMultiBodies()
        {
            PartDocument oPartDoc;

            oPartDoc = (PartDocument)_InvApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, _InvApplication.FileManager.GetTemplateFile(DocumentTypeEnum.kPartDocumentObject), true);

            PartComponentDefinition oPartDef;

            oPartDef = oPartDoc.ComponentDefinition;

            // Create a sketch.
            PlanarSketch oSketch;

            oSketch = oPartDef.Sketches.Add(oPartDef.WorkPlanes[3]);

            TransientGeometry oTG;

            oTG = _InvApplication.TransientGeometry;

            // Draw a rectangle and extrude it to create a new body.
            // *** The kNewBodyOperation type of operation is new in Inventor 2010.
            oSketch.SketchLines.AddAsTwoPointRectangle(oTG.CreatePoint2d(-3, -2), oTG.CreatePoint2d(3, 2));

            Profile oProfile;

            oProfile = oSketch.Profiles.AddForSolid();

            ExtrudeFeature oExtrude;

            oExtrude = oPartDef.Features.ExtrudeFeatures.AddByDistanceExtent(oProfile, 2, PartFeatureExtentDirectionEnum.kNegativeExtentDirection, PartFeatureOperationEnum.kNewBodyOperation);

            RenderStyle oRenderStyle = oPartDoc.RenderStyles["Glass (Limo Tint)"];

            oPartDef.SurfaceBodies[1].SetRenderStyle(StyleSourceTypeEnum.kOverrideRenderStyle, oRenderStyle);

            // Create a second sketch.
            oSketch = oPartDef.Sketches.Add(oPartDef.WorkPlanes[3]);

            // *** The kNewBodyOperation type of operation is new in Inventor 2010.
            // Draw a rectangle and extrude it to create a new body.
            oSketch.SketchLines.AddAsTwoPointRectangle(oTG.CreatePoint2d(-2.5, -1.5), oTG.CreatePoint2d(2.5, 1.5));

            oProfile = oSketch.Profiles.AddForSolid();
            oExtrude = oPartDef.Features.ExtrudeFeatures.AddByDistanceExtent(oProfile, 1.5, PartFeatureExtentDirectionEnum.kNegativeExtentDirection, PartFeatureOperationEnum.kNewBodyOperation, "-5 deg");
        }
 private static void replaceRuleSymbols <T1>(Rule rule, IDictionary <object, TextureRegion> regionMap, SymbolStyle.SymbolBuilder <T1> b)
 {
     for (int i = 0, n = rule.styles.length; i < n; i++)
     {
         RenderStyle style = rule.styles[i];
         if (style is SymbolStyle)
         {
             SymbolStyle   symbol = (SymbolStyle)style;
             TextureRegion region = regionMap[symbol.hash];
             if (region != null)
             {
                 rule.styles[i] = b.set(symbol).bitmap(null).texture(region).build();
             }
         }
     }
     foreach (Rule subRule in rule.subRules)
     {
         replaceRuleSymbols(subRule, regionMap, b);
     }
 }
예제 #25
0
        /// <summary>
        /// Draws a cylinder very quickly using an OpenGL display list, with 10 slices along
        /// the cylinder's axis. This method must not be called in between Gl.glNewList and
        /// Gl.glEndList.</summary>
        /// <param name="radius">Cylinder radius</param>
        /// <param name="height">Cylinder height</param>
        /// <param name="renderStyle">Render style: Wireframe or Solid</param>
        public static void DrawCylinderDisplayList(float radius, float height, RenderStyle renderStyle)
        {
            int drawStyle = (renderStyle == RenderStyle.Wireframe) ? Glu.GLU_LINE : Glu.GLU_FILL;

            Gl.glPushMatrix();
            Gl.glScalef(radius, radius, height);

            int displayList;

            if (!s_cylinderDisplayLists.TryGetValue(drawStyle, out displayList))
            {
                displayList = Gl.glGenLists(1);
                Gl.glNewList(displayList, Gl.GL_COMPILE);

                Glu.gluQuadricDrawStyle(s_quadric, drawStyle);
                Glu.gluQuadricNormals(s_quadric, Glu.GLU_SMOOTH);
                Glu.gluCylinder(s_quadric, 1.0f, 1.0f, 1.0f, FAST_CYLINDER_SLICES, FAST_CYLINDER_STACKS);

                Gl.glPushMatrix();
                Gl.glRotatef(180.0f, 1, 0, 0);
                Glu.gluDisk(s_quadric, 0, 1.0f, FAST_CYLINDER_SLICES, 1);
                Gl.glPopMatrix();

                Gl.glPushMatrix();
                Gl.glTranslatef(0, 0, 1.0f);
                Glu.gluDisk(s_quadric, 0, 1.0f, FAST_CYLINDER_SLICES, 1);
                Gl.glPopMatrix();

                Gl.glEndList();
                s_cylinderDisplayLists.Add(drawStyle, displayList);
            }

            Gl.glCallList(displayList);
            Gl.glPopMatrix();

            Util3D.RenderStats.PrimCount +=
                FAST_CYLINDER_SLICES * FAST_CYLINDER_STACKS + 2 * FAST_CYLINDER_SLICES;
            Util3D.RenderStats.VertexCount +=
                (2 + FAST_CYLINDER_SLICES * 2) * FAST_CYLINDER_STACKS + //quad strips for the sides
                (2 + FAST_CYLINDER_SLICES) * 2;                         //top and bottom triangle fans
        }
예제 #26
0
파일: Tube3D.cs 프로젝트: tirinox/Rays
        public void Render(RenderStyle Style)
        {
            Gl.glColor4d(Color.X, Color.Y, Color.Z, RayAlphaPower ? Power : 1);

            if (Style == RenderStyle.CenterDirectionOnly)
            {
                Gl.glVertex3dv((0.333 * (Rays[0].Begin + Rays[1].Begin + Rays[2].Begin)).Array);
                Gl.glVertex3dv((0.333 * (Rays[0].End + Rays[1].End + Rays[2].End)).Array);
            }
            else if (Style == RenderStyle.FullPolyhedron)
            {
                for (int i = 0; i < 3; ++i)
                {
                    int j = i == 2 ? 0 : i + 1;
                    Gl.glVertex3dv(Rays[i].Begin.Array);
                    Gl.glVertex3dv(Rays[j].Begin.Array);
                    Gl.glVertex3dv(Rays[i].End.Array);
                    Gl.glVertex3dv(Rays[j].End.Array);
                    Gl.glVertex3dv(Rays[i].Begin.Array);
                    Gl.glVertex3dv(Rays[i].End.Array);
                }
            }
        }
예제 #27
0
파일: Util3D.cs 프로젝트: Joxx0r/ATF
        /// <summary>
        /// Draws a cylinder, slowly. For better performance, consider using DrawCylinderDisplayList.</summary>
        /// <param name="radius">Cylinder radius</param>
        /// <param name="height">Cylinder height</param>
        /// <param name="slices">Number of longitudinal segments</param>
        /// <param name="stacks">Number of latitudinal segments</param>
        /// <param name="renderStyle">Render style: Wireframe or Solid</param>
        public static void DrawCylinder(double radius, double height, int slices, int stacks, RenderStyle renderStyle)
        {
            int drawStyle = (renderStyle == RenderStyle.Wireframe) ? Glu.GLU_LINE : Glu.GLU_FILL;
            Glu.gluQuadricDrawStyle(s_quadric, drawStyle);
            Glu.gluQuadricNormals(s_quadric, Glu.GLU_SMOOTH);
            Glu.gluCylinder(s_quadric, radius, radius, height, slices, stacks);

            Gl.glPushMatrix();
            Gl.glRotatef(180.0f, 1, 0, 0);
            Glu.gluDisk(s_quadric, 0, radius, slices, 1);
            Gl.glPopMatrix();

            Gl.glPushMatrix();
            Gl.glTranslatef(0, 0, (float)height);
            Glu.gluDisk(s_quadric, 0, radius, slices, 1);
            Gl.glPopMatrix();

            Util3D.RenderStats.PrimCount += slices * stacks + 2 * slices;
            Util3D.RenderStats.VertexCount +=
                (2 + slices * 2) * stacks + //quad strips for the sides of the cylinder
                (2 + slices) * 2;           //top and bottom triangle fans
        }
예제 #28
0
        private void AdjustViewMode()
        {
            // this should only apply to the currently selected window
            if (Wave != WaveManagerBusiness.WaveManager.GetActiveFile())
                return;

            // toggle the render mode
            RenderStrategy = (RenderStrategy == RenderStyle.Full)
                                ? RenderStyle.Standard
                                : RenderStyle.Full;
            RePaint();
        }
예제 #29
0
 public void SetRenderStyle(RenderStyle style)
 {
     foreach (var mesh in meshes)
     {
         foreach (var part in mesh.MeshParts)
         {
             part.RenderStyle = style;
         }
     }
 }
        //////////////////////////////////////////////////////////////////////////////////////////////
        // Description: Copies SurfaceBody 1 of current part and performs boolean operation
        //              to displays result as SurfaceGraphics.
        //////////////////////////////////////////////////////////////////////////////////////////////
        static public void SurfaceGraphicsDemo()
        {
            PartDocument doc =
                AdnInventorUtilities.InvApplication.ActiveDocument
                as PartDocument;

            string clientId = "{Add-in Guid}";

            ClientGraphics graphics = null;

            try
            {
                graphics = doc.ComponentDefinition.ClientGraphicsCollection[clientId];
            }
            catch
            {
                graphics = doc.ComponentDefinition.ClientGraphicsCollection.Add(clientId);
            }

            // Store utility objects
            TransientGeometry geom = AdnInventorUtilities.InvApplication.TransientGeometry;
            TransientBRep     brep = AdnInventorUtilities.InvApplication.TransientBRep;

            GraphicsNode node = graphics.AddNode(graphics.Count + 1);

            // We will work on the first surface body in our document
            SurfaceBody nativeBody = doc.ComponentDefinition.SurfaceBodies[1];

            // Create a transient copy of the native body to work on it
            SurfaceBody body = brep.Copy(nativeBody);

            // Compute bottom/top points based on body bounding box
            Point bottom = geom.CreatePoint(
                (nativeBody.RangeBox.MinPoint.X + nativeBody.RangeBox.MaxPoint.X) / 2,
                (nativeBody.RangeBox.MinPoint.Y + nativeBody.RangeBox.MaxPoint.Y) / 2,
                nativeBody.RangeBox.MinPoint.Z);

            Point top = geom.CreatePoint(
                (nativeBody.RangeBox.MinPoint.X + nativeBody.RangeBox.MaxPoint.X) / 2,
                (nativeBody.RangeBox.MinPoint.Y + nativeBody.RangeBox.MaxPoint.Y) / 2,
                nativeBody.RangeBox.MaxPoint.Z);

            // Create transient cylinder tool body
            double radius = bottom.DistanceTo(top);

            SurfaceBody tool = brep.CreateSolidCylinderCone(bottom, top, radius, radius, radius, null);

            // Do boolean operation between transient bodies to remove cylinder
            brep.DoBoolean(body, tool, BooleanTypeEnum.kBooleanTypeDifference);

            // Add SurfaceGraphics primitive
            SurfaceGraphics surfGraphPrimitive = node.AddSurfaceGraphics(body);

            // Copy render style of native body if any
            StyleSourceTypeEnum source;
            RenderStyle         style = nativeBody.GetRenderStyle(out source);

            node.RenderStyle = style;

            // Hide native body
            nativeBody.Visible = false;

            doc.Views[1].Update();
        }
예제 #31
0
 public Picture(string i, RenderStyle style, UpgradeHelpers.Helpers.Color transparencyColor, int transparencyTolerance, HorizontalAlignment alignHorz, VerticalAlignment alignVert)
 {
 }
예제 #32
0
        protected bool InitConsts(TaskList tasks, string destFilePath, bool silent, Preferences prefs, string sKey)
        {
            if (!silent)
            {
                // Display a dialog to get the report parameters
                using (var dialog = new HTMLReportExporterForm(m_TypeId, m_Trans))
                {
                    if (dialog.ShowDialog() != DialogResult.OK)
                    {
                        return(false);
                    }

                    // TODO
                }
            }

            //tasks.GetAttributeList(Attribs);

            String font     = prefs.GetProfileString("Preferences", "HTMLFont", "Verdana");
            int    fontSize = prefs.GetProfileInt(sKey, "HtmlFontSize", 2);

            DefaultFont = String.Format("<font face='{0}' size='{1}'>", font, fontSize);

            HtmlNotes = "";

            if (prefs.GetProfileBool(sKey, "ExportSpaceForNotes", false))
            {
                int nLine = prefs.GetProfileInt(sKey, "LineSpaces", 8);

                if (nLine > 0)
                {
                    HtmlNotes = "<pre>";

                    while (nLine-- > 0)
                    {
                        HtmlNotes = (HtmlNotes + Endl);
                    }

                    HtmlNotes = (HtmlNotes + "</pre>");
                }
            }

            StrikeThruDone = prefs.GetProfileBool(sKey, "StrikethroughDone", true);

            var style = tasks.GetMetaData("EXPORTSTYLE");

            if (!String.IsNullOrWhiteSpace(style))
            {
                switch (UInt32.Parse(style))
                {
                case 0:
                default:
                    Style = RenderStyle.Wrap;
                    break;

                case 1:
                    Style = RenderStyle.Table;
                    break;

                case 2:
                    Style = RenderStyle.Paragraph;
                    break;
                }
            }

            Indent = "";

            if (prefs.GetProfileBool(sKey, "UseSpaceIndents", true))
            {
                int nSpace = prefs.GetProfileInt(sKey, "TextIndent", 2);

                while (nSpace-- > 0)
                {
                    Indent = (Indent + Space);
                }
            }
            else
            {
                Indent = Tab;
            }

            /*
             *              if (WantAttribute(TDCA_COMMENTS))
             *              {
             *                      COMMENTSPERCENTWIDTH = 30; // minimum
             *
             *                      switch (ARRATTRIBUTES.GetSize())
             *                      {
             *                      case 2: // title & comments
             *                              COMMENTSPERCENTWIDTH = 60;
             *                              break;
             *
             *                      case 3:
             *                      case 4:
             *                      case 5:
             *                      case 6:
             *                              COMMENTSPERCENTWIDTH = 50;
             *                              break;
             *
             *                      case 7:
             *                      case 8:
             *                      case 9:
             *                      case 10:
             *                              COMMENTSPERCENTWIDTH = 40;
             *                              break;
             *                      }
             *              }
             */


            return(true);
        }
예제 #33
0
        /// <summary>
        /// Finds the oldest node with a given rendering style that is at least as old as a given age.
        /// </summary>
        /// <param name="nodes">
        /// List of nodes to search. Child lists of each node in this list will also be searched.
        /// </param>
        /// <param name="oldestSoFar"></param>
        /// The minimum age of the node to be located.  To find the oldest node, pass 0.
        /// <param name="style">
        /// The rendering style of the node to be located.
        /// </param>
        /// <returns>
        /// The found node, or null if no suitable node was located.
        /// </returns>
        private ProgressNode FindOldestNodeOfGivenStyle(List <ProgressNode> nodes, int oldestSoFar, RenderStyle style)
        {
            if (nodes == null)
            {
                return(null);
            }

            ProgressNode found = null;

            for (int i = 0; i < nodes.Count; ++i)
            {
                ProgressNode node = (ProgressNode)nodes[i];
                Debug.Assert(node != null, "nodes should not contain null elements");

                if (node.Age >= oldestSoFar && node.Style == style)
                {
                    found       = node;
                    oldestSoFar = found.Age;
                }

                if (node.Children != null)
                {
                    ProgressNode child = FindOldestNodeOfGivenStyle(node.Children, oldestSoFar, style);

                    if (child != null)
                    {
                        // In this universe, parents can be younger than their children. We found a child older than us.

                        found       = child;
                        oldestSoFar = found.Age;
                    }
                }
            }

            return(found);
        }
예제 #34
0
 public DummyLightingSetup(RenderStyle renderStyle, string formTitle)
 {
     InitializeComponent();
     RenderStyle = renderStyle;
     FormTitle = formTitle;
 }
예제 #35
0
        private static int DrawOutlineables(OutlineParameters parameters, CompareFunction function, bool edgeShiftOnly, float shift, Func <Outlinable, bool> shouldRender, Func <Outlinable, Color> colorProvider, Func <Outlinable, Material> materialProvider, RenderStyle styleMask, OutlinableDrawingMode modeMask = OutlinableDrawingMode.Normal)
        {
            var drawnCount = 0;

            parameters.Buffer.SetGlobalInt(ZTestHash, (int)function);

            foreach (var targetGroup in targets)
            {
                var outlinable = targetGroup.Outlinable;
                if ((int)(outlinable.RenderStyle & styleMask) == 0)
                {
                    continue;
                }

                if ((int)(outlinable.DrawingMode & modeMask) == 0)
                {
                    continue;
                }

                parameters.Buffer.DisableShaderKeyword(KeywordsUtility.GetBackKeyword(ComplexMaskingMode.MaskingMode));
                parameters.Buffer.DisableShaderKeyword(KeywordsUtility.GetBackKeyword(ComplexMaskingMode.ObstaclesMode));
                if (function == CompareFunction.NotEqual && outlinable.ComplexMaskingEnabled)
                {
                    parameters.Buffer.EnableShaderKeyword(KeywordsUtility.GetBackKeyword(outlinable.ComplexMaskingMode));
                }

                var color = shouldRender(outlinable) ? colorProvider(outlinable) : Color.clear;

                parameters.Buffer.SetGlobalColor(ColorHash, color);
                var target = targetGroup.Target;

                var postProcessing = !target.CanUseEdgeDilateShift || target.DilateRenderingMode == DilateRenderMode.PostProcessing;
                if (edgeShiftOnly && postProcessing)
                {
                    continue;
                }

                if (!postProcessing)
                {
                    var dilateShift = 0.0f;
                    switch (function)
                    {
                    case CompareFunction.Always:
                        dilateShift = target.EdgeDilateAmount;
                        break;

                    case CompareFunction.NotEqual:
                        dilateShift = target.BackEdgeDilateAmount;
                        break;

                    case CompareFunction.LessEqual:
                        dilateShift = target.FrontEdgeDilateAmount;
                        break;
                    }

                    parameters.Buffer.SetGlobalFloat(DilateShiftHash, shift < 0.0f ? dilateShift : shift);
                }

                parameters.Buffer.SetGlobalInt(ColorMaskHash, postProcessing ? 255 : 0);

                SetupCutout(parameters, target);
                SetupCull(parameters, target);

                if (postProcessing || edgeShiftOnly)
                {
                    drawnCount++;
                }

                var materialToUse = materialProvider(outlinable);
                parameters.Buffer.DrawRenderer(target.Renderer, materialToUse, target.ShiftedSubmeshIndex);
            }

            return(drawnCount);
        }
예제 #36
0
파일: Util3D.cs 프로젝트: Joxx0r/ATF
        /// <summary>
        /// Draws a cone very quickly using an OpenGL display list, with no bottom disk and
        /// 8 slices radiating from the tip. This method must not be called in between Gl.glNewList
        /// and Gl.glEndList.</summary>
        /// <param name="baseRadius">Radius at base of cone</param>
        /// <param name="height">Cone height</param>
        /// <param name="renderStyle">Render style: Wireframe or Solid</param>
        public static void DrawConeDisplayList(float baseRadius, float height, RenderStyle renderStyle)
        {
            int drawStyle = (renderStyle == RenderStyle.Wireframe) ? Glu.GLU_LINE : Glu.GLU_FILL;

            Gl.glPushMatrix();
            Gl.glScalef(baseRadius, baseRadius, height);

            int displayList;
            if (!s_coneDisplayLists.TryGetValue(drawStyle, out displayList))
            {
                displayList = Gl.glGenLists(1);
                Gl.glNewList(displayList, Gl.GL_COMPILE);

                Glu.gluQuadricDrawStyle(s_quadric, drawStyle);
                Glu.gluQuadricNormals(s_quadric, Glu.GLU_SMOOTH);
                Glu.gluCylinder(s_quadric, 1.0, 0.0, 1.0, FAST_CONE_SLICES, FAST_CONE_STACKS);

                Gl.glEndList();
                s_coneDisplayLists.Add(drawStyle, displayList);
            }

            Gl.glCallList(displayList);
            Gl.glPopMatrix();

            // Note that we are not rendering the bottom. That would require a separate call to gluDisk.
            // Assuming that each stack is a quad strip. This cone could be more efficiently rendered
            // as a triangle fan.
            Util3D.RenderStats.PrimCount += FAST_CONE_SLICES * FAST_CONE_STACKS;
            Util3D.RenderStats.VertexCount += (2 + FAST_CONE_SLICES * 2) * FAST_CONE_STACKS;
        }
예제 #37
0
파일: Util3D.cs 프로젝트: Joxx0r/ATF
        /// <summary>
        /// Draws a cone, without a bottom disk. For much better performance, use DrawConeDisplayList().</summary>
        /// <param name="baseRadius">Radius at base of cone</param>
        /// <param name="height">Cone height</param>
        /// <param name="slices">Number of longitudinal segments</param>
        /// <param name="stacks">Number of latitudinal segments</param>
        /// <param name="renderStyle">Render style: Wireframe or Solid</param>
        public static void DrawCone(double baseRadius, double height, int slices, int stacks, RenderStyle renderStyle)
        {
            int drawStyle = (renderStyle == RenderStyle.Wireframe) ? Glu.GLU_LINE : Glu.GLU_FILL;
            Glu.gluQuadricDrawStyle(s_quadric, drawStyle);
            Glu.gluQuadricNormals(s_quadric, Glu.GLU_SMOOTH);
            Glu.gluCylinder(s_quadric, baseRadius, 0.0, height, slices, stacks);

            // Note that we are not rendering the bottom. That would require a separate call to gluDisk.
            // Assuming that each stack is a quad strip. This cone could be more efficiently rendered
            // as a triangle fan.
            Util3D.RenderStats.PrimCount += slices * stacks;
            Util3D.RenderStats.VertexCount += (2 + slices * 2) * stacks;
        }
예제 #38
0
파일: Util3D.cs 프로젝트: Joxx0r/ATF
        /// <summary>
        /// Draws a sphere very quickly using an OpenGL display list. This method must not be called
        /// in between Gl.glNewList and Gl.glEndList.</summary>
        /// <param name="radius">Sphere radius</param>
        /// <param name="renderStyle">Render style: Wireframe or Solid</param>
        public static void DrawSphereDisplayList(float radius, RenderStyle renderStyle)
        {
            int drawStyle = (renderStyle == RenderStyle.Wireframe) ? Glu.GLU_LINE : Glu.GLU_FILL;

            Gl.glPushMatrix();
            Gl.glScalef(radius, radius, radius);

            int displayList;
            if (!s_sphereDisplayLists.TryGetValue(drawStyle, out displayList))
            {
                displayList = Gl.glGenLists(1);
                Gl.glNewList(displayList, Gl.GL_COMPILE);

                Glu.gluQuadricDrawStyle(s_quadric, drawStyle);
                Glu.gluQuadricNormals(s_quadric, Glu.GLU_SMOOTH);
                Glu.gluSphere(s_quadric, 1.0f, FAST_SPHERE_SLICES, FAST_SPHERE_STACKS);

                Gl.glEndList();
                s_sphereDisplayLists.Add(drawStyle, displayList);
            }

            Gl.glCallList(displayList);
            Gl.glPopMatrix();

            Util3D.RenderStats.PrimCount += FAST_SPHERE_SLICES * FAST_SPHERE_STACKS; //2 stacks are triangles; rest are quads.
            Util3D.RenderStats.VertexCount +=       //each stack is a separate tri fan / quad strip?
                (2 + FAST_SPHERE_SLICES) * 2 +                  //the two triangle fans at top and bottom of sphere.
                (2 + FAST_SPHERE_SLICES * 2) * (FAST_SPHERE_STACKS - 2);    //the remaining stacks are quad strips.
        }
예제 #39
0
파일: Util3D.cs 프로젝트: Joxx0r/ATF
        /// <summary>
        /// Draws a cube using OpenGL primitives. Consider using DrawCubeDisplayList.</summary>
        /// <param name="size">Dimension of side of cube</param>
        /// <param name="renderStyle">Render style: Wireframe or Solid</param>
        public static void DrawCube(double size, RenderStyle renderStyle)
        {
            Gl.glPushMatrix();
            Gl.glScalef((float)size, (float)size, (float)size);
            DrawUnitBox((renderStyle == RenderStyle.Wireframe) ? Gl.GL_LINE_LOOP : Gl.GL_QUADS);
            Gl.glPopMatrix();

            Util3D.RenderStats.VertexCount += 6 * 4;
            Util3D.RenderStats.PrimCount += 6;
        }
예제 #40
0
파일: Util3D.cs 프로젝트: Joxx0r/ATF
        /// <summary>
        /// Draws a cylinder very quickly using an OpenGL display list, with 10 slices along
        /// the cylinder's axis. This method must not be called in between Gl.glNewList and
        /// Gl.glEndList.</summary>
        /// <param name="radius">Cylinder radius</param>
        /// <param name="height">Cylinder height</param>
        /// <param name="renderStyle">Render style: Wireframe or Solid</param>
        public static void DrawCylinderDisplayList(float radius, float height, RenderStyle renderStyle)
        {
            int drawStyle = (renderStyle == RenderStyle.Wireframe) ? Glu.GLU_LINE : Glu.GLU_FILL;

            Gl.glPushMatrix();
            Gl.glScalef(radius, radius, height);

            int displayList;
            if (!s_cylinderDisplayLists.TryGetValue(drawStyle, out displayList))
            {
                displayList = Gl.glGenLists(1);
                Gl.glNewList(displayList, Gl.GL_COMPILE);

                Glu.gluQuadricDrawStyle(s_quadric, drawStyle);
                Glu.gluQuadricNormals(s_quadric, Glu.GLU_SMOOTH);
                Glu.gluCylinder(s_quadric, 1.0f, 1.0f, 1.0f, FAST_CYLINDER_SLICES, FAST_CYLINDER_STACKS);

                Gl.glPushMatrix();
                Gl.glRotatef(180.0f, 1, 0, 0);
                Glu.gluDisk(s_quadric, 0, 1.0f, FAST_CYLINDER_SLICES, 1);
                Gl.glPopMatrix();

                Gl.glPushMatrix();
                Gl.glTranslatef(0, 0, 1.0f);
                Glu.gluDisk(s_quadric, 0, 1.0f, FAST_CYLINDER_SLICES, 1);
                Gl.glPopMatrix();

                Gl.glEndList();
                s_cylinderDisplayLists.Add(drawStyle, displayList);
            }

            Gl.glCallList(displayList);
            Gl.glPopMatrix();

            Util3D.RenderStats.PrimCount +=
                FAST_CYLINDER_SLICES * FAST_CYLINDER_STACKS + 2 * FAST_CYLINDER_SLICES;
            Util3D.RenderStats.VertexCount +=
                (2 + FAST_CYLINDER_SLICES * 2) * FAST_CYLINDER_STACKS + //quad strips for the sides
                (2 + FAST_CYLINDER_SLICES) * 2;           //top and bottom triangle fans
        }
예제 #41
0
        public async Task <IActionResult> List(string name, [FromQuery] SearchMethod method = SearchMethod.Simple, [FromQuery] string query = null, [FromQuery] bool desc = true, [FromQuery] string skipToken = null, [FromQuery] int limit = 20, [FromQuery] RenderStyle style = RenderStyle.Default)
        {
            var collection = await _settings.FindCollectionAsync(name);

            var items = method == SearchMethod.Simple
                        ? await _data.SearchAsync(name, query, skipToken, limit, desc)
                        : await _data.QueryAsync(name, query, skipToken, limit, desc);

            if (!desc)
            {
                items = items.Reverse();
            }

            var model = new CollectionViewModel
            {
                SearchMethod   = method,
                SeachQuery     = query,
                TitlePath      = collection.TitlePath,
                Items          = items,
                CollectionName = name,
                DisplayName    = collection.DisplayName,
                Procedures     = collection.Procedures ?? new ProcedureInfo[0],
                Limit          = limit
            };

            if (style == RenderStyle.NoBlade)
            {
                return(View("ListNoBlade", model));
            }

            return(View(model));
        }
예제 #42
0
파일: Util3D.cs 프로젝트: Joxx0r/ATF
        /// <summary>
        /// Draws a cube, using an OpenGL display list for greatly improved performance. This method must
        /// not be called in between Gl.glNewList and Gl.glEndList.</summary>
        /// <param name="size">Dimension of side of cube</param>
        /// <param name="renderStyle">Render style: Wireframe or Solid</param>
        public static void DrawCubeDisplayList(float size, RenderStyle renderStyle)
        {
            int displayList;
            Gl.glPushMatrix();
            Gl.glScalef(size, size, size);

            int drawStyle = (renderStyle == RenderStyle.Wireframe) ? Glu.GLU_LINE : Glu.GLU_FILL;
            if (!s_cubeDisplayLists.TryGetValue(drawStyle, out displayList))
            {
                displayList = Gl.glGenLists(1);
                Gl.glNewList(displayList, Gl.GL_COMPILE);

                DrawUnitBox((renderStyle == RenderStyle.Wireframe) ? Gl.GL_LINE_LOOP : Gl.GL_QUADS);

                Gl.glEndList();
                s_cubeDisplayLists.Add(drawStyle, displayList);
            }
            Gl.glCallList(displayList);
            Gl.glPopMatrix();

            Util3D.RenderStats.VertexCount += 6 * 4;
            Util3D.RenderStats.PrimCount += 6;
        }
예제 #43
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //
        //
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public void SetRenderStyle(AssemblyDocument asmDoc,
                                   PartFeature AssemblyFeature,
                                   string styleName)
        {
            string stylename = "";

            try
            {
                if (styleName == "As Assembly Feature")
                {
                    StyleSourceTypeEnum srcType;
                    RenderStyle         asmStyle = AssemblyFeature.GetRenderStyle(out srcType);

                    RenderStyle style = null;

                    if (asmStyle != null)
                    {
                        stylename = asmStyle.Name;
                        style     = _Document.RenderStyles[stylename];
                    }

                    _PartFeature.SetRenderStyle(srcType, style);
                }
                else if (styleName == "As Part")
                {
                    _PartFeature.SetRenderStyle(StyleSourceTypeEnum.kPartRenderStyle, null);
                }
                else
                {
                    stylename = styleName;

                    RenderStyle style = _Document.RenderStyles[stylename];

                    _PartFeature.SetRenderStyle(StyleSourceTypeEnum.kOverrideRenderStyle, style);
                }
            }
            catch
            {
                try
                {
                    //copy render style from assembly
                    RenderStyle asmStyle = asmDoc.RenderStyles[stylename];

                    RenderStyle newStyle = _Document.RenderStyles.Add(stylename);

                    byte red, green, blue;

                    asmStyle.GetAmbientColor(out red, out green, out blue);
                    newStyle.SetAmbientColor(red, green, blue);

                    asmStyle.GetDiffuseColor(out red, out green, out blue);
                    newStyle.SetDiffuseColor(red, green, blue);

                    asmStyle.GetEmissiveColor(out red, out green, out blue);
                    newStyle.SetEmissiveColor(red, green, blue);

                    asmStyle.GetSpecularColor(out red, out green, out blue);
                    newStyle.SetSpecularColor(red, green, blue);

                    newStyle.DisplayInteriorFaces = asmStyle.DisplayInteriorFaces;
                    newStyle.Opacity = asmStyle.Opacity;

                    newStyle.TextureFilename = asmStyle.TextureFilename;
                    newStyle.TextureRotation = asmStyle.TextureRotation;
                    newStyle.TextureScale    = asmStyle.TextureScale;

                    newStyle.Reflectivity            = asmStyle.Reflectivity;
                    newStyle.ReflectionImageFilename = asmStyle.ReflectionImageFilename;
                    newStyle.Refraction = asmStyle.Refraction;

                    if (styleName == "As Assembly Feature")
                    {
                        StyleSourceTypeEnum srcType;
                        AssemblyFeature.GetRenderStyle(out srcType);

                        _PartFeature.SetRenderStyle(srcType, newStyle);
                    }
                    else
                    {
                        _PartFeature.SetRenderStyle(StyleSourceTypeEnum.kOverrideRenderStyle, newStyle);
                    }
                }
                catch
                {
                    //giving up
                }
            }
        }
예제 #44
0
파일: Util3D.cs 프로젝트: Joxx0r/ATF
        /// <summary>
        /// Draws a sphere, slowly. Consider using DrawSphereDisplayList(), which has less
        /// flexibility but is much faster.</summary>
        /// <param name="radius">Sphere radius</param>
        /// <param name="slices">Number of longitudinal segments</param>
        /// <param name="stacks">Number of latitudinal segments</param>
        /// <param name="renderStyle">Render style: Wireframe or Solid</param>
        public static void DrawSphere(double radius, int slices, int stacks, RenderStyle renderStyle)
        {
            int drawStyle = (renderStyle == RenderStyle.Wireframe) ? Glu.GLU_LINE : Glu.GLU_FILL;
            Glu.gluQuadricDrawStyle(s_quadric, drawStyle);
            Glu.gluQuadricNormals(s_quadric, Glu.GLU_SMOOTH);
            Glu.gluSphere(s_quadric, radius, slices, stacks);

            Util3D.RenderStats.PrimCount += slices * stacks; //2 stacks are triangles; rest are quads.
            Util3D.RenderStats.VertexCount +=       //each stack is a separate tri fan / quad strip?
                (2 + slices) * 2 +                  //the two triangle fans at top and bottom of sphere.
                (2 + slices * 2) * (stacks - 2);    //the remaining stacks are quad strips.
        }