コード例 #1
0
ファイル: ProxyVizNode.cpp プロジェクト: spinos/aphid
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() );
}
コード例 #2
0
ファイル: ProxyVizNode.cpp プロジェクト: spinos/aphid
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() );
}
コード例 #3
0
void View::setDistanceFromOrigin(float d) {
    if (d > 0.5){ 
        distanceFromOrigin = d;
        fieldOfView = (10.94*distanceFromOrigin)+15.624;
        setEyePosition();
    }
}
コード例 #4
0
ファイル: Skulls.cpp プロジェクト: cboctor/SpeechHero
void Skulls::update()
{
	time = ofGetElapsedTimeMillis() - startTime;
	spawntime = ofGetElapsedTimeMillis() - spawnstartTime;
	skull.update(1.0f/60);
	setEyePosition();
	skullBehaviour();
	removeProjectiles();
	

	
}
コード例 #5
0
ファイル: ViewCull.cpp プロジェクト: spinos/aphid
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);
}
コード例 #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;

}
コード例 #7
0
ファイル: FreeCamera.cpp プロジェクト: xv500i/Exercici3D
/* 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);
}
コード例 #8
0
void View::setAngles(int az, int el){
    azimuthAngle = az%360;
    elevationAngle = el%360;
    setEyePosition();
}
コード例 #9
0
void View::setElevation(int el) {
    elevationAngle = el%360;
    setEyePosition();
}
コード例 #10
0
void View::setAzimuth(int az) {
    azimuthAngle = az%360;
    setEyePosition();
}