Exemplo n.º 1
0
void ProxyViz::updateViewFrustum(MObject & thisNode)
{
	MPlug matplg(thisNode, acameraspace);
	MObject matobj;
	matplg.getValue(matobj);
	MFnMatrixData matdata(matobj);
    MMatrix cameramat = matdata.matrix(); 
	AHelper::ConvertToMatrix44F(*cameraSpaceR(), cameramat);
	AHelper::ConvertToMatrix44F(*cameraInvSpaceR(), cameramat.inverse() );
	float peye[3];
	peye[0] = cameramat.matrix[3][0];
	peye[1] = cameramat.matrix[3][1];
	peye[2] = cameramat.matrix[3][2];
	setEyePosition(peye);
	
	MPlug hfaplg(thisNode, ahapeture);
	float hfa = hfaplg.asFloat();
	MPlug vfaplg(thisNode, avapeture);
	float vfa = vfaplg.asFloat();
	MPlug flplg(thisNode, afocallength);
	float fl = flplg.asFloat();
	
    float farClip = -20.f;
    if(numPlants() > 0) getFarClipDepth(farClip, gridBoundingBox() );
    
    setFrustum(hfa, vfa, fl, -10.f, farClip );
	
	MPlug overscanPlug(thisNode, ainoverscan);
	setOverscan(overscanPlug.asDouble() );
}
Exemplo n.º 2
0
void ProxyViz::updateViewFrustum(const MDagPath & cameraPath)
{
	MMatrix cameraMat = cameraPath.inclusiveMatrix();
	AHelper::ConvertToMatrix44F(*cameraSpaceR(), cameraMat);
	MMatrix cameraInvMat = cameraPath.inclusiveMatrixInverse();
	AHelper::ConvertToMatrix44F(*cameraInvSpaceR(), cameraInvMat);
	float peye[3];
	peye[0] = cameraMat.matrix[3][0];
	peye[1] = cameraMat.matrix[3][1];
	peye[2] = cameraMat.matrix[3][2];
	setEyePosition(peye);
	
    float farClip = -20.f;
    if(numPlants() > 0) getFarClipDepth(farClip, gridBoundingBox() );
    
	MFnCamera fcam(cameraPath.node() );
	if(fcam.isOrtho() ) {
		float orthoW = fcam.orthoWidth();
		float orthoH = orthoW * fcam.aspectRatio();
		setOrthoFrustum(orthoW, orthoH, -10.f, farClip );
		
	} else {
		float hfa = fcam.horizontalFilmAperture();
		float vfa = fcam.verticalFilmAperture();
		float fl = fcam.focalLength();
	
		setFrustum(hfa, vfa, fl, -10.f, farClip );
	}
	setOverscan(fcam.overscan() );
}
Exemplo n.º 3
0
void View::setDistanceFromOrigin(float d) {
    if (d > 0.5){ 
        distanceFromOrigin = d;
        fieldOfView = (10.94*distanceFromOrigin)+15.624;
        setEyePosition();
    }
}
Exemplo n.º 4
0
void Skulls::update()
{
	time = ofGetElapsedTimeMillis() - startTime;
	spawntime = ofGetElapsedTimeMillis() - spawnstartTime;
	skull.update(1.0f/60);
	setEyePosition();
	skullBehaviour();
	removeProjectiles();
	

	
}
Exemplo n.º 5
0
void BaseView::frameAll(const BoundingBox & b)
{
	Vector3F eye = b.center();
	eye.z = b.getMax(2) + b.distance(0) / hfov() * .55f + 120.f;
	setEyePosition(eye);
	
	Matrix44F m;
	m.setTranslation(eye);
	*cameraSpaceR() = m;
	m.inverse();
	*cameraInvSpaceR() = m;
	setFrustum(1.33f, 1.f, 26.2f, -1.f, -1000.f);
}
Exemplo n.º 6
0
View::View() {
    azimuthAngle=102;   //  Azimuth of view angle
    elevationAngle=45;  //  Elevation of view angle
    fieldOfView=35;     //  Field of view (for perspective)
    aspectRatio=1;      //  Aspect ratio
    dimension=40;     //  Size of world
    distanceFromOrigin = 1.0;

    setEyePosition();
    vx = 0;
    vy = 0;
    vz = 0;

}
Exemplo n.º 7
0
/* Panning */
void FreeCamera::pan(float panX, float panZ)
{
	float eyeX, eyeY, eyeZ;
	float centerX, centerY, centerZ;
	getEyePosition(eyeX, eyeY, eyeZ);
	getReferencePoint(centerX, centerY, centerZ);

	float deltaX = panX*cos(degreesToRadians(xzAngle)) + panZ*cos(degreesToRadians(xzAngle + 90.0f));
	float deltaZ = panX*sin(degreesToRadians(xzAngle)) + panZ*sin(degreesToRadians(xzAngle + 90.0f));
	eyeX += deltaX;
	centerX += deltaX;
	eyeZ += deltaZ;
	centerZ += deltaZ;

	setEyePosition(eyeX, eyeY, eyeZ);
	setReferencePoint(centerX, centerY, centerZ);
}
Exemplo n.º 8
0
void View::setAngles(int az, int el){
    azimuthAngle = az%360;
    elevationAngle = el%360;
    setEyePosition();
}
Exemplo n.º 9
0
void View::setElevation(int el) {
    elevationAngle = el%360;
    setEyePosition();
}
Exemplo n.º 10
0
void View::setAzimuth(int az) {
    azimuthAngle = az%360;
    setEyePosition();
}