Esempio n. 1
0
        /* Puts the inverse of a modified aspect matrix of this
         *  critter into the modelveiw matrix of the pgraphics of the _pownerview.
         *  The "modification" has to do with the fact that we think of a critterviewer as looking
         *  along its plus x-axis, but for the view matrix we think of looking along
         *  its negatiave z axis. */

        public virtual void loadProjectionMatrix()
        { /* Set the perspective matrix of the pgraphics
           *            of the _pownerview so that something like _proportionofworldtoshow much of
           *            world shows (0.1 would be a tenth of the world, 1.0 would be all of it,
           *            2.0 would mean show space around the world so it takes up half the
           *            view).  Also use _znear and _zfar so that all of the visible world can
           *            fit	in between these bounds.  We regularly compute _znear and _zfar in
           *            the setZClipPlanes method, called by our cCritterViewer.update call. */
            pgraphics().MatrixModeProperty = cGraphics.PROJECTION;
            pgraphics().loadIdentity();
            if (!_perspective)
            //We don't have perspective implemented for cGraphicsMFC yet.
            { //use Ortho view. ortho call takes (left, right, bottom, top, nearzclip, farzclip).
                cRealBox2 orthoviewrect = OrthoViewRect;

                /* The call to ortho() becomes a _realpixelconverter.setRealWindow call
                 * in cGraphicsMFC, replacing our old call to
                 * _pgraphics->setRealBox(border()); */
                pgraphics().ortho(orthoviewrect.Lox, orthoviewrect.Hix,
                                  orthoviewrect.Loy, orthoviewrect.Hiy, _znear, _zfar);
            }
            else // _perspective is TRUE. perspective call takes (fieldofview, xtoyratio, nearzclip, farzclip).
            {
                pgraphics().perspective(FieldOfViewDegrees, _aspect, _znear, _zfar);
            }
            pgraphics().MatrixModeProperty = cGraphics.MODELVIEW;
        }
Esempio n. 2
0
        public cSpriteIconBackground( int resourceID, cRealBox2 borderrect, int xtilecount = 1 ) 		
        { 
			_xtilecount = xtilecount; 
			if ( _xtilecount > 1 ) 
				_tiled = true; 
			_transparent = false; 
			_presetaspect = true; 
			_resourceID = resourceID; 
			_radius = borderrect.Radius; 
			_sizex = borderrect.XSize; 
			_sizey = borderrect.YSize; 
			_aspect = ( float ) _sizex /( float ) _sizey; 
			_visualradius = 0.25f *( _sizex + _sizey ); //Avg of distances to sides.
		}