Skip to content
Permalink
Browse files

TITANIC: Cleanup of CCamera class methods

  • Loading branch information
dreammaster committed Jan 14, 2020
1 parent 2480630 commit 365674ca7725a87b3090449538b7b60295a1863d
@@ -167,7 +167,7 @@ void CBaseStars::draw1(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup

const double MAX_VAL = 1.0e9 * 1.0e9;
FPoint centroid = surfaceArea->_centroid + FPoint(0.5, 0.5);
double threshold = camera->getThreshold();
double threshold = camera->getFrontClip();
double minVal = threshold - 9216.0;
int width1 = surfaceArea->_width - 1;
int height1 = surfaceArea->_height - 1;
@@ -252,7 +252,7 @@ void CBaseStars::draw2(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup

const double MAX_VAL = 1.0e9 * 1.0e9;
FPoint centroid = surfaceArea->_centroid + FPoint(0.5, 0.5);
double threshold = camera->getThreshold();
double threshold = camera->getFrontClip();
double minVal = threshold - 9216.0;
int width1 = surfaceArea->_width - 1;
int height1 = surfaceArea->_height - 1;
@@ -338,7 +338,7 @@ void CBaseStars::draw3(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup

const double MAX_VAL = 1.0e9 * 1.0e9;
FPoint centroid = surfaceArea->_centroid + FPoint(0.5, 0.5);
double threshold = camera->getThreshold();
double threshold = camera->getFrontClip();
double minVal = threshold - 9216.0;
int width1 = surfaceArea->_width - 1;
int height1 = surfaceArea->_height - 1;
@@ -445,7 +445,7 @@ void CBaseStars::draw4(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup

const double MAX_VAL = 1.0e9 * 1.0e9;
FPoint centroid = surfaceArea->_centroid + FPoint(0.5, 0.5);
double threshold = camera->getThreshold();
double threshold = camera->getFrontClip();
double minVal = threshold - 9216.0;
int width1 = surfaceArea->_width - 1;
int height1 = surfaceArea->_height - 1;
@@ -72,11 +72,11 @@ CCamera::~CCamera() {
removeMover();
}

void CCamera::proc2(const CViewport *src) {
void CCamera::setViewport(const CViewport *src) {
_viewport.copyFrom(src);
}

void CCamera::proc3(const CNavigationInfo *src) {
void CCamera::setMotion(const CNavigationInfo *src) {
_mover->copyFrom(src);
}

@@ -93,21 +93,21 @@ void CCamera::setOrientation(const FVector &v) {
}

// This never gets called
void CCamera::proc6(int v) {
void CCamera::setRoleAngle(double angle) {
if (!isLocked())
_viewport.setC(v);
_viewport.SetRoleAngle(angle);
}

// This never gets called
void CCamera::proc7(int v) {
void CCamera::setFrontClip(double n) {
if (!isLocked())
_viewport.set10(v);
_viewport.setFrontClip(n);
}

// This never gets called
void CCamera::proc8(int v) {
void CCamera::SetBackClip(double f) {
if (!isLocked())
_viewport.set14(v);
_viewport.setBackClip(f);
}

// This never gets called
@@ -132,10 +132,6 @@ void CCamera::setFields(StarMode mode, double val) {
_viewport.changeStarColorPixel(mode, val);
}

void CCamera::proc13(CViewport *dest) {
*dest = _viewport;
}

void CCamera::setDestination(const FVector &v) {
FMatrix orientation = _viewport.getOrientation();
FVector oldPos = _viewport._position;
@@ -207,12 +203,12 @@ FPose CCamera::getRawPose() {
return _viewport.getRawPose();
}

double CCamera::getThreshold() const {
return _viewport._field10;
double CCamera::getFrontClip() const {
return _viewport._frontClip;
}

double CCamera::proc26() const {
return _viewport._field14;
double CCamera::getBackClip() const {
return _viewport._backClip;
}

StarColor CCamera::getStarColor() const {
@@ -481,7 +477,7 @@ bool CCamera::lockMarker1(FVector v1, FVector firstStarPosition, FVector v3) {
double val6, val7, val8, val9;

val1 = _viewport._centerVector._y * v1._x;
tempV._z = _viewport._field10;
tempV._z = _viewport._frontClip;
val2 = _viewport._centerVector._y * tempV._z * v3._x;
val3 = _viewport._centerVector._z * v1._y;
val4 = _viewport._centerVector._z * tempV._z;
@@ -76,8 +76,15 @@ class CCamera {
CCamera(CViewport *src);
virtual ~CCamera();

virtual void proc2(const CViewport *src);
virtual void proc3(const CNavigationInfo *src);
/**
* Copy the state from a specified viewport
*/
virtual void setViewport(const CViewport *src);

/**
* Set motion from the passed navigation info
*/
virtual void setMotion(const CNavigationInfo *src);

/**
* The mover/view is not currently homing in on a new star
@@ -96,14 +103,25 @@ class CCamera {
*/
virtual void setOrientation(const FVector &v);

virtual void proc6(int v);
virtual void proc7(int v);
virtual void proc8(int v);
/**
* Assigns a roll angle about the view direction
*/
virtual void setRoleAngle(double angle);

/**
* Assign a near clip plane distance
*/
virtual void setFrontClip(double n);

/**
* Assign a far clipping plane distance
*/
virtual void SetBackClip(double f);

virtual void setCenterYAngle(int v);
virtual void setCenterZAngle(int v);
virtual void randomizeOrientation();
virtual void setFields(StarMode mode, double val);
virtual void proc13(CViewport *dest);

/**
* Sets the destination to move the camera to
@@ -150,9 +168,18 @@ class CCamera {
virtual FPose getPose();

virtual FPose getRawPose();
virtual double getThreshold() const;

virtual double proc26() const;
/**
* Get the front clipping distance
*/
virtual double getFrontClip() const;

/**
* Get the back clipping distance
*/
virtual double getBackClip() const;


virtual StarColor getStarColor() const;

/**
@@ -74,7 +74,7 @@ void CConstBoundaries::draw(CSurfaceArea *surface, CCamera *camera) {

// get the current camera transform.
FPose pose = camera->getPose();
float threshold = camera->getThreshold();
float threshold = camera->getFrontClip();
float centerX = (float)surface->_width / 2.0f;
float centerY = (float)surface->_height / 2.0f;

@@ -75,7 +75,7 @@ void CConstellations::draw(CSurfaceArea *surface, CCamera *camera) {
return;

FPose pose = camera->getPose();
double threshold = camera->getThreshold();
double threshold = camera->getFrontClip();
double centerX = (double)surface->_width / 2.0F;
double centerY = (double)surface->_height / 2.0F;
FVector ec0, ec1;
@@ -194,7 +194,7 @@ bool CStarCloseup::setup2(int val1, int val2) {
void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector &vector2,
CSurfaceArea *surfaceArea, CCamera *camera) {
const int VALUES[] = { 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4 };
float val1 = camera->getThreshold();
float val1 = camera->getFrontClip();
StarColor starColor = camera->getStarColor();
if (!_flag)
return;
@@ -201,7 +201,7 @@ double CStarField::lockDistance(CSurfaceArea *surfaceArea, CCamera *camera,
worldCoord = dataP->_position;
FVector tv = camera->getRelativePosNoCentering(2, worldCoord);

if (camera->getThreshold() >= tv._z)
if (camera->getFrontClip() >= tv._z)
return -1.0;

tv = camera->getRelativePos(2, tv);
@@ -31,7 +31,7 @@ void CStarMarkers::draw(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup
return;

FPose pose = camera->getPose();
double threshold = camera->getThreshold();
double threshold = camera->getFrontClip();
FPoint center((double)surfaceArea->_width * 0.5,
surfaceArea->_height * 0.5);
FVector newV;
@@ -32,7 +32,7 @@ void CBaseStarRef::process(CSurfaceArea *surface, CCamera *camera) {

const double MAX_VAL = 1.0e9 * 1.0e9;
FPose pose = camera->getPose();
double threshold = camera->getThreshold();
double threshold = camera->getFrontClip();
double vWidth2 = (double)surface->_width * 0.5;
double vHeight2 = (double)surface->_height * 0.5;
FVector vTemp, vector1, vector2;
@@ -41,7 +41,7 @@ CStarView::CStarView() : _camera((const CNavigationInfo *)nullptr), _owner(nullp
_stereoPair(false), _showingPhoto(false) {
CNavigationInfo data = { 0, 0, 100000.0, 0, 20.0, 1.0, 1.0, 1.0 };

_camera.proc3(&data);
_camera.setMotion(&data);
}

CStarView::~CStarView() {
@@ -31,9 +31,9 @@
namespace Titanic {

CViewport::CViewport() {
_fieldC = 0; // doesn't get used
_field10 = 800.0; // doesn't get used
_field14 = 10000.0; // doesn't get used
_spin = 0.0;
_frontClip = 800.0;
_backClip = 10000.0;
_centerYAngleDegrees = 20.0;
_centerZAngleDegrees = 20.0;
_width = 600;
@@ -49,9 +49,9 @@ CViewport::CViewport() {
CViewport::CViewport(CViewport *src) :
_orientation(src->_orientation), _currentPose(src->_currentPose), _rawPose(src->_rawPose) {
_position = src->_position;
_fieldC = src->_fieldC;
_field10 = src->_field10;
_field14 = src->_field14;
_spin = src->_spin;
_frontClip = src->_frontClip;
_backClip = src->_backClip;
_centerYAngleDegrees = src->_centerYAngleDegrees;
_centerZAngleDegrees = src->_centerZAngleDegrees;
_width = src->_width;
@@ -76,9 +76,9 @@ void CViewport::load(SimpleFile *file, int param) {
_position._x = file->readFloat();
_position._y = file->readFloat();
_position._z = file->readFloat();
_fieldC = file->readFloat();
_field10 = file->readFloat();
_field14 = file->readFloat();
_spin = file->readFloat();
_frontClip = file->readFloat();
_backClip = file->readFloat();
_centerYAngleDegrees = file->readFloat();
_centerZAngleDegrees = file->readFloat();

@@ -103,9 +103,9 @@ void CViewport::save(SimpleFile *file, int indent) {
file->writeFloatLine(_position._x, indent);
file->writeFloatLine(_position._y, indent);
file->writeFloatLine(_position._z, indent);
file->writeFloatLine(_fieldC, indent);
file->writeFloatLine(_field10, indent);
file->writeFloatLine(_field14, indent);
file->writeFloatLine(_spin, indent);
file->writeFloatLine(_frontClip, indent);
file->writeFloatLine(_backClip, indent);
file->writeFloatLine(_centerYAngleDegrees, indent);
file->writeFloatLine(_centerZAngleDegrees, indent);
file->writeNumberLine(_width | (_height << 16), indent);
@@ -143,21 +143,18 @@ void CViewport::setOrientation(const FVector &v) {
_poseUpToDate = false;
}

// This never gets called
void CViewport::setC(double v) {
_fieldC = v;
void CViewport::SetRoleAngle(double angle) {
_spin = angle;
_poseUpToDate = false;
}

// This never gets called
void CViewport::set10(double v) {
_field10 = v;
void CViewport::setFrontClip(double dist) {
_frontClip = dist;
_poseUpToDate = false;
}

// This never gets called
void CViewport::set14(double v) {
_field10 = v;
void CViewport::setBackClip(double dist) {
_backClip = dist;
}

void CViewport::setCenterYAngle(double angleDegrees) {
@@ -44,7 +44,7 @@ enum StarColor { WHITE = 0, PINK = 2 };
*/
class CViewport {
private:
double _fieldC;
double _spin;
double _centerYAngleDegrees;
double _centerZAngleDegrees;
int _width;
@@ -58,8 +58,8 @@ class CViewport {
void reset();
public:
FVector _position;
double _field10;
double _field14;
double _frontClip;
double _backClip;
StarColor _starColor; // Used in CBaseStars::draw
double _valArray[2]; // has value 0.0 or 30.0
double _isZero;
@@ -141,9 +141,20 @@ class CViewport {
*/
const FMatrix &getOrientation() const;

void setC(double v);
void set10(double v);
void set14(double v);
/**
* Assigns a roll angle about the view direction
*/
void SetRoleAngle(double angle);

/**
* Assign a near clip plane distance
*/
void setFrontClip(double dist);

/**
* Assign a far clipping plane distance
*/
void setBackClip(double dist);

/**
* Sets the center vector y angle

0 comments on commit 365674c

Please sign in to comment.
You can’t perform that action at this time.