コード例 #1
0
        public WindowedWall(Point3D from, Point3D to, double bottom, double height, Window window) : base(from, to, bottom, height)
        {
            this.ventana = window;
            Point3D dir = (to - from).Normalized;

            ventana.Angle = GlUtils.VectorAngle2D(dir);
            double  dist = (to - from).Norm;
            Point3D d    = dir.Scaled((dist - ventana.Width) / 2);

            izq         = new SolidWall(from, from + d, bottom, height);
            der         = new SolidWall(to - d, to, bottom, height);
            up          = new SolidWall(from + d.Scaled(.9), to - d.Scaled(.9), bottom, windowBase);
            down        = new SolidWall(from + d.Scaled(.9), to - d.Scaled(.9), windowBase + this.ventana.Height, (height - windowBase - ventana.Height));
            izq.after   = to;
            up.after    = to;
            down.after  = to;
            der.before  = from;
            up.before   = from;
            down.before = from;
            Point3D wstart = from + d;

            this.ventana.Location = new Point3D(wstart.X, windowBase, wstart.Z);
            izq.CloseTo(false);
            der.CloseFrom(false);
            up.CloseFrom(false);
            up.CloseTo(false);
            down.CloseFrom(false);
            down.CloseTo(false);
        }
コード例 #2
0
        public DoorWall(Point3D from, Point3D to, double bottom, double height, bool soloMarco, bool reversed, bool opened) : base(from, to, bottom, height)
        {
            Point3D dir = (to - from);

            puerta          = new Puerta();
            puerta.Angle    = GlUtils.VectorAngle2D(dir);
            puerta.reversed = reversed;
            if (opened)
            {
                puerta.Apertura = 85;
            }
            else
            {
                puerta.Apertura = 0;
            }

            //puerta.Width = dir.Norm;
            double dist = dir.Norm;

            if (dist <= puerta.Width)
            {
                puerta.Location = from;
                puerta.Width    = dist;
            }
            else
            {
                Point3D d = dir.Normalized.Scaled((dist - puerta.Width) / 2);
                left            = new SolidWall(from, from + d, bottom, bottom + puerta.Height * 1.1);
                right           = new SolidWall(to - d, to, bottom, bottom + puerta.Height * 1.1);
                left.after      = to;
                right.before    = from;
                puerta.Location = from + d;
            }
            up = new SolidWall(from, to, puerta.Height, height - puerta.Height);
            puerta.SoloMarco = soloMarco;
        }
コード例 #3
0
ファイル: GlassWall.cs プロジェクト: Grafkom/Proyek_Grafkom
        protected void pintaCristal()
        {
            Glu.GLUquadric q      = Glu.gluNewQuadric();
            Point3D        actual = new Point3D(from);
            Point3D        dir    = (to - from);
            double         len    = dir.Norm;

            dir = dir.Normalized;

            Gl.glBindTexture(Gl.GL_TEXTURE_2D, divTexture);
            Glu.gluQuadricTexture(q, Gl.GL_TRUE);
            Gl.glColor3d(1, 1, 1);
            #region Divisiones horizontales
            double angle = -GlUtils.VectorAngle2D(dir) + 90;
            for (double d = height; d >= baseHeight; d -= glassvStep)
            {
                Gl.glPushMatrix();
                Gl.glTranslated(from.X, bottom + d, from.Z);
                Gl.glRotated(angle, 0, 1, 0);
                Glu.gluCylinder(q, radius, radius, len, 10, 10);
                Gl.glPopMatrix();
            }
            #endregion
            #region Divisiones verticales
            for (double d = 0; d < len; d += glasshStep)
            {
                actual = from + dir.Scaled(d);
                Gl.glPushMatrix();
                Gl.glTranslated(actual.X, actual.Y + baseHeight, actual.Z);
                Gl.glRotated(-90, 1, 0, 0);
                Glu.gluCylinder(q, radius, radius, this.height - this.baseHeight, 10, 1);
                Gl.glPopMatrix();
            }
            actual = to;
            Gl.glPushMatrix();
            Gl.glTranslated(actual.X, actual.Y + baseHeight, actual.Z);
            Gl.glRotated(-90, 1, 0, 0);
            Glu.gluCylinder(q, radius, radius, this.height - baseHeight, 10, 1);
            Gl.glPopMatrix();

            Gl.glBindTexture(Gl.GL_TEXTURE_2D, 0);
            #endregion
            Glu.gluDeleteQuadric(q);

            int cullFace = 0;
            Gl.glGetBooleanv(Gl.GL_CULL_FACE, out cullFace);
            Gl.glDisable(Gl.GL_CULL_FACE);
            #region Cristal
            Gl.glEnable(Gl.GL_BLEND);
            Gl.glColor4d(.8, .8, 1, .4);
            Gl.glBegin(Gl.GL_QUADS);
            Point3D normal = this.planeRot(to - from, -90).Normalized;
            Gl.glNormal3dv(normal.Coords);
            Gl.glVertex3dv((from + new Point3D(0, baseHeight, 0)).Coords);
            Gl.glVertex3dv((to + new Point3D(0, baseHeight, 0)).Coords);
            Gl.glVertex3dv((to + new Point3D(0, height, 0)).Coords);
            Gl.glVertex3dv((from + new Point3D(0, height, 0)).Coords);
            Gl.glEnd();
            Gl.glDisable(Gl.GL_BLEND);
            Gl.glColor3d(1, 1, 1);
            #endregion
            if (cullFace != Gl.GL_FALSE)
            {
                Gl.glEnable(Gl.GL_CULL_FACE);
            }
        }