public void paint(bool shadow, I3dsTaken c)
    {
        obj_type aux = null;

        foreach (obj_type o in objects.Values)
        {
            if (o.name == "glass")
            {
                aux = o;
            }
            else if (c.Actions(o, shadow, Rot, Trans, Scl))
            {
            }

            else
            {
                o.paint(shadow, Rot, Trans, Scl);
            }
        }

        if (aux != null)
        {
            if (c.Actions(aux, shadow, Rot, Trans, Scl))
            {
            }
            else
            {
                aux.paint(shadow, Rot, Trans, Scl);
            }
        }
    }
示例#2
0
    public override bool Actions(obj_type o, bool _shadow, int[] rot, float[] trans, float[] scl)
    {
        if (actList.Contains("maletero") && o.name == "trunk")
        {
            Gl.glPushMatrix();
            Gl.glTranslated((trans[0] - 0.4), trans[1] - 1.5, trans[2]);
            Gl.glRotated(-45, 0, 0, 1);
            Gl.glTranslated(-(trans[0] + 0.4), -(trans[1] + 1.5), -trans[2]);
            o.paint(_shadow, rot, trans, scl);
            Gl.glPopMatrix();

            return(true);
        }


        else if (actList.Contains("capo") && o.name == "hood")
        {
            Gl.glPushMatrix();
            Gl.glTranslated((trans[0] + 0.2), trans[1] - 1.2, trans[2]);
            Gl.glRotated(45, 0, 0, 1);
            Gl.glTranslated(-(trans[0] - 0.2), -(trans[1] + 1.2), -trans[2]);
            o.paint(_shadow, rot, trans, scl);
            Gl.glPopMatrix();
            return(true);
        }
        else if (actList.Contains("descapotable") && o.name == "glass")
        {
            Gl.glPushMatrix();
            Gl.glClipPlane(Gl.GL_CLIP_PLANE0, new double[] { 1, 1, 0, -2 });
            Gl.glEnable(Gl.GL_CLIP_PLANE0);
            o.paint(_shadow, rot, trans, scl);
            Gl.glDisable(Gl.GL_CLIP_PLANE0);
            Gl.glPopMatrix();
            return(true);
        }

        else if (actList.Contains("descapotable") && o.name == "trim")
        {
            Gl.glPushMatrix();
            Gl.glClipPlane(Gl.GL_CLIP_PLANE1, new double[] { 0, -1, 0, 0.5 });
            Gl.glEnable(Gl.GL_CLIP_PLANE1);
            o.paint(_shadow, rot, trans, scl);
            Gl.glDisable(Gl.GL_CLIP_PLANE1);
            Gl.glPopMatrix();
            return(true);
        }

        else if (actList.Contains("descapotable") && o.name == "roof")
        {
            Gl.glPushMatrix();
            Gl.glClipPlane(Gl.GL_CLIP_PLANE0, new double[] { 1, 0, 0, 3.5 });
            Gl.glClipPlane(Gl.GL_CLIP_PLANE1, new double[] { -1, 0, 0, -2.0 });
            Gl.glEnable(Gl.GL_CLIP_PLANE0);
            Gl.glEnable(Gl.GL_CLIP_PLANE1);
            Gl.glTranslated(-1.0, -0.7, 0);
            o.paint(_shadow, rot, trans, scl);
            Gl.glDisable(Gl.GL_CLIP_PLANE1);
            Gl.glDisable(Gl.GL_CLIP_PLANE0);
            Gl.glPopMatrix();
            return(true);
        }

        return(false);
    }
示例#3
0
    public override bool Actions(obj_type o,bool _shadow, int[] rot, float[] trans, float[] scl)
    {
        if(actList.Contains("maletero") && o.name=="trunk")
            {
                Gl.glPushMatrix();
                Gl.glTranslated((trans[0]-0.4),trans[1]-1.5,trans[2]);
                Gl.glRotated(-45,0,0,1);
                Gl.glTranslated(-(trans[0]+0.4),- (trans[1]+1.5),-trans[2]);
                o.paint(_shadow, rot, trans, scl);
                Gl.glPopMatrix();

                return true;
            }

            else if(actList.Contains("capo") && o.name=="hood")
            {
                Gl.glPushMatrix();
                Gl.glTranslated((trans[0]+0.2),trans[1]-1.2,trans[2]);
                Gl.glRotated(45,0,0,1);
                Gl.glTranslated(-(trans[0]-0.2),- (trans[1]+1.2),-trans[2]);
                o.paint(_shadow, rot, trans, scl);
                Gl.glPopMatrix();
                return true;
            }
            else if(actList.Contains("descapotable") && o.name=="glass")
            {
                Gl.glPushMatrix();
                Gl.glClipPlane(Gl.GL_CLIP_PLANE0,new double[]{1,1,0,-2});
                Gl.glEnable(Gl.GL_CLIP_PLANE0);
                o.paint(_shadow, rot, trans, scl);
                Gl.glDisable(Gl.GL_CLIP_PLANE0);
                Gl.glPopMatrix();
            return true;
            }

            else if(actList.Contains("descapotable") && o.name=="trim")
            {
                Gl.glPushMatrix();
                Gl.glClipPlane(Gl.GL_CLIP_PLANE1,new double[]{0,-1,0,0.5});
                Gl.glEnable(Gl.GL_CLIP_PLANE1);
                o.paint(_shadow, rot, trans, scl);
                Gl.glDisable(Gl.GL_CLIP_PLANE1);
                Gl.glPopMatrix();
                return true;
            }

            else if(actList.Contains("descapotable") && o.name=="roof")
            {
                Gl.glPushMatrix();
                Gl.glClipPlane(Gl.GL_CLIP_PLANE0,new double[]{1,0,0,3.5});
                Gl.glClipPlane(Gl.GL_CLIP_PLANE1,new double[]{-1,0,0,-2.0});
                Gl.glEnable(Gl.GL_CLIP_PLANE0);
                Gl.glEnable(Gl.GL_CLIP_PLANE1);
                Gl.glTranslated(-1.0,-0.7,0);
                o.paint(_shadow, rot, trans, scl);
                Gl.glDisable(Gl.GL_CLIP_PLANE1);
                Gl.glDisable(Gl.GL_CLIP_PLANE0);
                Gl.glPopMatrix();
                return true;
            }

            return false;
    }