Пример #1
0
		void						Camera::applyPreset(eCameraPresetType preset) {
			float					fov = 0.0f;

			setAspect(g_f3dCameraPresets[preset].sensor_width / g_f3dCameraPresets[preset].sensor_height);
			fov = 2.0f * (atanf(g_f3dCameraPresets[preset].sensor_width / (2.0f * g_f3dCameraPresets[preset].focal_len)));
			setFOV(fov);
		}
Пример #2
0
/**************************************
Here are the constructors.
***************************************/
Camera::Camera(){
    setEyeX(0.0);
    setEyeY(0.0);
    setEyeZ(0.0);
    setCenterX(0.0);
    setCenterY(0.0);
    setCenterZ(0.0);
    setUpX(0.0);
    setUpY(0.0);
    setUpZ(0.0);
    setFovy(0.0);
    setAspect(0.0);
    setZNear(0.0);
    setZFar(0.0);

    mouseDirection[0] = 0;
    mouseDirection[1] = 1;
    mouseDirection[2] = 0;

    glMatrixMode(GL_MODELVIEW);

    move[0] = false;
    move[1] = false;
    move[2] = false;
    move[3] = false;
}
Пример #3
0
Camera::Camera(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX,double upY,double upZ, double fovy, double aspect, double zNear, double  zFar){
    setEyeX(eyeX);
    setEyeY(eyeY);
    setEyeZ(eyeZ);
    setCenterX(centerX);
    setCenterY(centerY);
    setCenterZ(centerZ);
    setUpX(upX);
    setUpY(upY);
    setUpZ(upZ);
    setFovy(fovy);
    setAspect(aspect);
    setZNear(zNear);
    setZFar(zFar);

    mouseDirection[0] = 0;
    mouseDirection[1] = 90;
    mouseDirection[2] = 0;

    glMatrixMode(GL_MODELVIEW);

    move[0] = false;
    move[1] = false;
    move[2] = false;
    move[3] = false;
}
Пример #4
0
void Camera::reset(int canvasWidth, int canvasHeight)
{
    currentViewingVolume = defaultViewingVolume;

    roll = 0.0;
    pitch = 0.0;
    yaw = 0.0;
    setAspect(((double) canvasWidth) / canvasHeight);
}
Пример #5
0
SDL_Surface *TText::render()
{
    if (strlen(str) == 0) {
        setAspect(0, 0);
        return NULL;
    }

    SDL_Surface *t = TTF_RenderUTF8_Shaded(font, str, forecolor, backcolor);

    if ( t == NULL ) {
        fprintf(stderr, "Couldn't render text: %s\n", SDL_GetError());
        TTF_CloseFont(font);
    }

    setAspect(t->w, t->h);

    return t;
}
Пример #6
0
void Camera::setOptionalsToDefaults()
{
	GeometricalTransformation::setOptionalsToDefaults();
	ProjectionTransformation::setOptionalsToDefaults();
	setScissor( vgm::Rectangle2i(0, 0, 1600, 1200) );
	setAspect( (1) );
	setZNear( (0.01f) );
	setZFar( (3996.f) );
}
Пример #7
0
void Camera::setPerspective(double fovy,double aspect,double zNear,double zFar){
    glLoadIdentity();

    glEnable(GL_DEPTH_TEST);
    glMatrixMode(GL_PROJECTION);

    glMatrixMode(GL_MODELVIEW);

    setFovy(fovy);
    setAspect(aspect);
    setZNear(zNear);
    setZFar(zFar);
}
Пример #8
0
Camera::Camera(vec3 position,vec3 center,vec3 upVector,int ImgSizeX, int ImgSizeY, float FOV)
{
	//setFov(ImgSizeX, ImgSizeY);
	up = upVector;
	cent = center;
	pos = position;
	imgResX = ImgSizeX;
	imgResY = ImgSizeY;
	fov = FOV;

	setAspect(ImgSizeX,ImgSizeY);
	setFov(fov);
	recalc();

}
Пример #9
0
void dot_layout_intl(Agraph_t * g, struct _DotStats* stats) {
    aspect_t aspect;
    aspect_t* asp;

    setEdgeType (g, ET_SPLINE);
    asp = setAspect (g, &aspect);

    dot_init_node_edge(g);
    do {
		dot_rank(g, asp, stats);
		resetNodeCountOnRanks(g);
    	if(stats->stopFunc && stats->stopFunc(PROGRESS_AFTER_RANK)) {
    		return;
    	}

	if (aspect.badGraph) {
		agerr(AGWARN, "dot does not support the aspect attribute for disconnected graphs or graphs with clusters\n");
		asp = NULL;
		aspect.nextIter = 0;
	}

        dot_mincross(g,  (asp != NULL), stats);
    	if(stats->stopFunc && stats->stopFunc(PROGRESS_AFTER_MX)) {
    		return;
    	}

        dot_position(g, asp, stats);
    	if(stats->stopFunc && stats->stopFunc(PROGRESS_AFTER_POSITION)) {
    		return;
    	}
	aspect.nPasses--;
    } while (aspect.nextIter && aspect.nPasses);

    dot_sameports(g);
    dot_splines(g);
    if (mapbool(agget(g, "compound")))
	dot_compoundEdges(g);
    dotneato_postprocess(g);

	if(stats->stopFunc) {
		stats->stopFunc(PROGRESS_LAYOUT_FINISH);
	}
}
Пример #10
0
static void dotLayout(Agraph_t * g)
{
    aspect_t aspect;
    aspect_t* asp;
    int maxphase = late_int(g, agfindgraphattr(g,"phase"), -1, 1);

    setEdgeType (g, ET_SPLINE);
    asp = setAspect (g, &aspect);

    dot_init_subg(g,g);
    dot_init_node_edge(g);

    do {
        dot_rank(g, asp);
	if (maxphase == 1) {
	    attach_phase_attrs (g, 1);
	    return;
	}
	if (aspect.badGraph) {
	    agerr(AGWARN, "dot does not support the aspect attribute for disconnected graphs or graphs with clusters\n");
	    asp = NULL;
	    aspect.nextIter = 0;
	}
        dot_mincross(g, (asp != NULL));
	if (maxphase == 2) {
	    attach_phase_attrs (g, 2);
	    return;
	}
        dot_position(g, asp);
	if (maxphase == 3) {
	    attach_phase_attrs (g, 2);  /* positions will be attached on output */
	    return;
	}
	aspect.nPasses--;
    } while (aspect.nextIter && aspect.nPasses);
    if (GD_flags(g) & NEW_RANK)
	removeFill (g);
    dot_sameports(g);
    dot_splines(g);
    if (mapbool(agget(g, "compound")))
	dot_compoundEdges(g);
}