Removed animation code.

This commit is contained in:
leo 2014-01-30 03:13:34 +00:00
parent f7334f682e
commit 213c53813c
20 changed files with 459 additions and 872 deletions

View file

@ -104,14 +104,11 @@ Camera::Camera(bool Simple)
mOrthoTarget = mTargetPosition;
mUpVector = lcVector3(-0.2357f, -0.2357f, 0.94281f);
ChangeKey(1, false, true, mPosition, LC_CK_EYE);
ChangeKey(1, false, true, mTargetPosition, LC_CK_TARGET);
ChangeKey(1, false, true, mUpVector, LC_CK_UP);
ChangeKey(1, true, true, mPosition, LC_CK_EYE);
ChangeKey(1, true, true, mTargetPosition, LC_CK_TARGET);
ChangeKey(1, true, true, mUpVector, LC_CK_UP);
ChangeKey(1, true, mPosition, LC_CK_EYE);
ChangeKey(1, true, mTargetPosition, LC_CK_TARGET);
ChangeKey(1, true, mUpVector, LC_CK_UP);
UpdatePosition(1, false);
UpdatePosition(1);
}
}
@ -132,14 +129,11 @@ Camera::Camera(float ex, float ey, float ez, float tx, float ty, float tz)
float eye[3] = { ex, ey, ez }, target[3] = { tx, ty, tz };
ChangeKey(1, false, true, eye, LC_CK_EYE);
ChangeKey(1, false, true, target, LC_CK_TARGET);
ChangeKey(1, false, true, UpVector, LC_CK_UP);
ChangeKey(1, true, true, eye, LC_CK_EYE);
ChangeKey(1, true, true, target, LC_CK_TARGET);
ChangeKey(1, true, true, UpVector, LC_CK_UP);
ChangeKey(1, true, eye, LC_CK_EYE);
ChangeKey(1, true, target, LC_CK_TARGET);
ChangeKey(1, true, UpVector, LC_CK_UP);
UpdatePosition(1, false);
UpdatePosition(1);
}
Camera::~Camera()
@ -218,22 +212,19 @@ bool Camera::FileLoad(lcFile& file)
f[0] = (float)d[0];
f[1] = (float)d[1];
f[2] = (float)d[2];
ChangeKey(1, false, true, f, LC_CK_EYE);
ChangeKey(1, true, true, f, LC_CK_EYE);
ChangeKey(1, true, f, LC_CK_EYE);
file.ReadDoubles(d, 3);
f[0] = (float)d[0];
f[1] = (float)d[1];
f[2] = (float)d[2];
ChangeKey(1, false, true, f, LC_CK_TARGET);
ChangeKey(1, true, true, f, LC_CK_TARGET);
ChangeKey(1, true, f, LC_CK_TARGET);
file.ReadDoubles(d, 3);
f[0] = (float)d[0];
f[1] = (float)d[1];
f[2] = (float)d[2];
ChangeKey(1, false, true, f, LC_CK_UP);
ChangeKey(1, true, true, f, LC_CK_UP);
ChangeKey(1, true, f, LC_CK_UP);
}
if (version == 3)
@ -257,20 +248,17 @@ bool Camera::FileLoad(lcFile& file)
f[0] = (float)eye[0];
f[1] = (float)eye[1];
f[2] = (float)eye[2];
ChangeKey(step, false, true, f, LC_CK_EYE);
ChangeKey(step, true, true, f, LC_CK_EYE);
ChangeKey(step, true, f, LC_CK_EYE);
f[0] = (float)target[0];
f[1] = (float)target[1];
f[2] = (float)target[2];
ChangeKey(step, false, true, f, LC_CK_TARGET);
ChangeKey(step, true, true, f, LC_CK_TARGET);
ChangeKey(step, true, f, LC_CK_TARGET);
f[0] = (float)up[0];
f[1] = (float)up[1];
f[2] = (float)up[2];
ChangeKey(step, false, true, f, LC_CK_UP);
ChangeKey(step, true, true, f, LC_CK_UP);
ChangeKey(step, true, f, LC_CK_UP);
file.ReadS32(); // snapshot
file.ReadS32(); // cam
@ -300,7 +288,7 @@ bool Camera::FileLoad(lcFile& file)
file.ReadFloats(param, 3);
file.ReadU8(&type, 1);
ChangeKey(time, false, true, param, type);
ChangeKey(time, true, param, type);
}
n = file.ReadS32();
@ -309,8 +297,6 @@ bool Camera::FileLoad(lcFile& file)
file.ReadU16(&time, 1);
file.ReadFloats(param, 3);
file.ReadU8(&type, 1);
ChangeKey(time, true, true, param, type);
}
}
@ -367,7 +353,7 @@ void Camera::FileSave(lcFile& file) const
/////////////////////////////////////////////////////////////////////////////
// Camera operations
void Camera::Move(unsigned short nTime, bool bAnimation, bool bAddKey, float dx, float dy, float dz)
void Camera::Move(unsigned short nTime, bool bAddKey, float dx, float dy, float dz)
{
lcVector3 MoveVec(dx, dy, dz);
@ -377,7 +363,7 @@ void Camera::Move(unsigned short nTime, bool bAnimation, bool bAddKey, float dx,
lcAlign(mOrthoTarget, mPosition, mTargetPosition);
if (!IsSimple())
ChangeKey(nTime, bAnimation, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
}
if (IsTargetSelected())
@ -385,7 +371,7 @@ void Camera::Move(unsigned short nTime, bool bAnimation, bool bAddKey, float dx,
mTargetPosition += MoveVec;
if (!IsSimple())
ChangeKey(nTime, bAnimation, bAddKey, mTargetPosition, LC_CK_TARGET);
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
}
// Fix the up vector
@ -394,7 +380,7 @@ void Camera::Move(unsigned short nTime, bool bAnimation, bool bAddKey, float dx,
mUpVector = lcNormalize(lcCross(SideVector, FrontVector));
if (!IsSimple())
ChangeKey(nTime, bAnimation, bAddKey, mUpVector, LC_CK_UP);
ChangeKey(nTime, bAddKey, mUpVector, LC_CK_UP);
}
void Camera::Select(bool bSelecting, bool bFocus, bool bMultiple)
@ -449,10 +435,10 @@ void Camera::SelectTarget(bool bSelecting, bool bFocus, bool bMultiple)
}
}
void Camera::UpdatePosition(unsigned short nTime, bool bAnimation)
void Camera::UpdatePosition(unsigned short nTime)
{
if (!IsSimple())
CalculateKeys(nTime, bAnimation);
CalculateKeys(nTime);
lcVector3 FrontVector(mPosition - mTargetPosition);
lcVector3 SideVector = lcCross(FrontVector, mUpVector);
@ -671,7 +657,7 @@ void Camera::LoadProjection(const lcProjection& projection)
glLoadMatrixf(mWorldView);
}
void Camera::ZoomExtents(View* view, const lcVector3& Center, const lcVector3* Points, int NumPoints, unsigned short nTime, bool bAnimation, bool bAddKey)
void Camera::ZoomExtents(View* view, const lcVector3& Center, const lcVector3* Points, int NumPoints, unsigned short nTime, bool bAddKey)
{
int Viewport[4] = { 0, 0, view->mWidth, view->mHeight };
@ -687,14 +673,14 @@ void Camera::ZoomExtents(View* view, const lcVector3& Center, const lcVector3* P
if (!IsSimple())
{
ChangeKey(nTime, bAnimation, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAnimation, bAddKey, mTargetPosition, LC_CK_TARGET);
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
}
UpdatePosition(nTime, bAnimation);
UpdatePosition(nTime);
}
void Camera::ZoomRegion(View* view, float Left, float Right, float Bottom, float Top, unsigned short nTime, bool bAnimation, bool bAddKey)
void Camera::ZoomRegion(View* view, float Left, float Right, float Bottom, float Top, unsigned short nTime, bool bAddKey)
{
int Viewport[4] = { 0, 0, view->mWidth, view->mHeight };
float Aspect = (float)Viewport[2]/(float)Viewport[3];
@ -731,14 +717,14 @@ void Camera::ZoomRegion(View* view, float Left, float Right, float Bottom, float
// Change the camera and redraw.
if (!IsSimple())
{
ChangeKey(nTime, bAnimation, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAnimation, bAddKey, mTargetPosition, LC_CK_TARGET);
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
}
UpdatePosition(nTime, bAnimation);
UpdatePosition(nTime);
}
void Camera::DoZoom(int dy, int mouse, unsigned short nTime, bool bAnimation, bool bAddKey)
void Camera::DoZoom(int dy, int mouse, unsigned short nTime, bool bAddKey)
{
lcVector3 FrontVector(mPosition - mTargetPosition);
FrontVector.Normalize();
@ -756,14 +742,14 @@ void Camera::DoZoom(int dy, int mouse, unsigned short nTime, bool bAnimation, bo
if (!IsSimple())
{
ChangeKey(nTime, bAnimation, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAnimation, bAddKey, mTargetPosition, LC_CK_TARGET);
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
}
UpdatePosition(nTime, bAnimation);
UpdatePosition(nTime);
}
void Camera::DoPan(int dx, int dy, int mouse, unsigned short nTime, bool bAnimation, bool bAddKey)
void Camera::DoPan(int dx, int dy, int mouse, unsigned short nTime, bool bAddKey)
{
lcVector3 FrontVector(mPosition - mTargetPosition);
lcVector3 SideVector = lcNormalize(lcCross(FrontVector, mUpVector));
@ -775,14 +761,14 @@ void Camera::DoPan(int dx, int dy, int mouse, unsigned short nTime, bool bAnimat
if (!IsSimple())
{
ChangeKey(nTime, bAnimation, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAnimation, bAddKey, mTargetPosition, LC_CK_TARGET);
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
}
UpdatePosition(nTime, bAnimation);
UpdatePosition(nTime);
}
void Camera::DoRotate(int dx, int dy, int mouse, unsigned short nTime, bool bAnimation, bool bAddKey, float* center)
void Camera::DoRotate(int dx, int dy, int mouse, unsigned short nTime, bool bAddKey, float* center)
{
lcVector3 FrontVector(mPosition - mTargetPosition);
lcVector3 CenterPosition(center[0], center[1], center[2]);
@ -809,14 +795,14 @@ void Camera::DoRotate(int dx, int dy, int mouse, unsigned short nTime, bool bAni
if (!IsSimple())
{
ChangeKey(nTime, bAnimation, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAnimation, bAddKey, mUpVector, LC_CK_UP);
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAddKey, mUpVector, LC_CK_UP);
}
UpdatePosition(nTime, bAnimation);
UpdatePosition(nTime);
}
void Camera::DoRoll(int dx, int mouse, unsigned short nTime, bool bAnimation, bool bAddKey)
void Camera::DoRoll(int dx, int mouse, unsigned short nTime, bool bAddKey)
{
lcVector3 FrontVector(mPosition - mTargetPosition);
lcMatrix44 Rotation = lcMatrix44FromAxisAngle(FrontVector, 2.0f * dx / (21 - mouse) * LC_DTOR);
@ -824,25 +810,25 @@ void Camera::DoRoll(int dx, int mouse, unsigned short nTime, bool bAnimation, bo
mUpVector = lcMul30(mUpVector, Rotation);
if (!IsSimple())
ChangeKey(nTime, bAnimation, bAddKey, mUpVector, LC_CK_UP);
ChangeKey(nTime, bAddKey, mUpVector, LC_CK_UP);
UpdatePosition(nTime, bAnimation);
UpdatePosition(nTime);
}
void Camera::DoCenter(lcVector3& point, unsigned short nTime, bool bAnimation, bool bAddKey)
void Camera::DoCenter(lcVector3& point, unsigned short nTime, bool bAddKey)
{
lcAlign(mTargetPosition, mPosition, point);
if (!IsSimple())
{
ChangeKey(nTime, bAnimation, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAnimation, bAddKey, mTargetPosition, LC_CK_TARGET);
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
}
UpdatePosition(nTime, bAnimation);
UpdatePosition(nTime);
}
void Camera::SetViewpoint(LC_VIEWPOINT Viewpoint, unsigned short nTime, bool bAnimation, bool bAddKey)
void Camera::SetViewpoint(LC_VIEWPOINT Viewpoint, unsigned short nTime, bool bAddKey)
{
lcVector3 Positions[] =
{
@ -873,12 +859,12 @@ void Camera::SetViewpoint(LC_VIEWPOINT Viewpoint, unsigned short nTime, bool bAn
if (!IsSimple())
{
ChangeKey(nTime, bAnimation, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAnimation, bAddKey, mTargetPosition, LC_CK_TARGET);
ChangeKey(nTime, bAnimation, bAddKey, mUpVector, LC_CK_UP);
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
ChangeKey(nTime, bAddKey, mUpVector, LC_CK_UP);
}
UpdatePosition(nTime, bAnimation);
UpdatePosition(nTime);
}
void Camera::StartTiledRendering(int tw, int th, int iw, int ih, float fAspect)
@ -914,7 +900,7 @@ bool Camera::EndTile()
return false;
}
void Camera::SetFocalPoint(const lcVector3& focus, unsigned short nTime, bool bAnimation, bool bAddKey)
void Camera::SetFocalPoint(const lcVector3& focus, unsigned short nTime, bool bAddKey)
{
if (mProjection.GetType() == lcProjection::Ortho)
{
@ -933,9 +919,9 @@ void Camera::SetFocalPoint(const lcVector3& focus, unsigned short nTime, bool bA
if (!IsSimple())
{
ChangeKey(nTime, bAnimation, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAnimation, bAddKey, mTargetPosition, LC_CK_TARGET);
ChangeKey(nTime, bAddKey, mPosition, LC_CK_EYE);
ChangeKey(nTime, bAddKey, mTargetPosition, LC_CK_TARGET);
}
UpdatePosition(nTime, bAnimation);
UpdatePosition(nTime);
}

View file

@ -55,7 +55,7 @@ public:
virtual void MinIntersectDist(lcClickLine* ClickLine);
virtual bool IntersectsVolume(const lcVector4 Planes[6]) const;
void Select(bool bSelecting, bool bFocus, bool bMultiple);
void Move(unsigned short nTime, bool bAnimation, bool bAddKey, float x, float y, float z)
void Move(unsigned short nTime, bool bAddKey, float x, float y, float z)
{
// FIXME: move the position handling to the camera target
}
@ -141,21 +141,21 @@ public:
void Select(bool bSelecting, bool bFocus, bool bMultiple);
void UpdatePosition(unsigned short nTime, bool bAnimation);
void UpdatePosition(unsigned short nTime);
void CopyPosition(const Camera* camera);
void Render(float fLineWidth);
void LoadProjection(const lcProjection& projection);
void ZoomExtents(View* view, const lcVector3& Center, const lcVector3* Points, int NumPoints, unsigned short nTime, bool bAnimation, bool bAddKey);
void ZoomRegion(View* view, float Left, float Right, float Bottom, float Top, unsigned short nTime, bool bAnimation, bool bAddKey);
void DoZoom(int dy, int mouse, unsigned short nTime, bool bAnimation, bool bAddKey);
void DoPan(int dx, int dy, int mouse, unsigned short nTime, bool bAnimation, bool bAddKey);
void DoRotate(int dx, int dy, int mouse, unsigned short nTime, bool bAnimation, bool bAddKey, float* center);
void DoRoll(int dx, int mouse, unsigned short nTime, bool bAnimation, bool bAddKey);
void DoCenter(lcVector3& point, unsigned short nTime, bool bAnimation, bool bAddKey);
void Move(unsigned short nTime, bool bAnimation, bool bAddKey, float x, float y, float z);
void SetViewpoint(LC_VIEWPOINT Viewpoint, unsigned short nTime, bool bAnimation, bool bAddKey);
void SetFocalPoint(const lcVector3& focus, unsigned short nTime, bool bAnimation, bool bAddKey);
void ZoomExtents(View* view, const lcVector3& Center, const lcVector3* Points, int NumPoints, unsigned short nTime, bool bAddKey);
void ZoomRegion(View* view, float Left, float Right, float Bottom, float Top, unsigned short nTime, bool bAddKey);
void DoZoom(int dy, int mouse, unsigned short nTime, bool bAddKey);
void DoPan(int dx, int dy, int mouse, unsigned short nTime, bool bAddKey);
void DoRotate(int dx, int dy, int mouse, unsigned short nTime, bool bAddKey, float* center);
void DoRoll(int dx, int mouse, unsigned short nTime, bool bAddKey);
void DoCenter(lcVector3& point, unsigned short nTime, bool bAddKey);
void Move(unsigned short nTime, bool bAddKey, float x, float y, float z);
void SetViewpoint(LC_VIEWPOINT Viewpoint, unsigned short nTime, bool bAddKey);
void SetFocalPoint(const lcVector3& focus, unsigned short nTime, bool bAddKey);
void StartTiledRendering(int tw, int th, int iw, int ih, float fAspect);
void GetTileInfo(int* row, int* col, int* width, int* height);

View file

@ -124,8 +124,6 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
// Image output options.
bool SaveImage = false;
bool ImageAnimation = false;
bool ImageInstructions = false;
bool ImageHighlight = false;
int ImageWidth = lcGetProfileInt(LC_PROFILE_IMAGE_WIDTH);
int ImageHeight = lcGetProfileInt(LC_PROFILE_IMAGE_HEIGHT);
@ -173,10 +171,6 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
{
ParseIntegerArgument(&i, argc, argv, &ImageEnd);
}
else if (strcmp(Param, "--animation") == 0)
ImageAnimation = true;
else if (strcmp(Param, "--instructions") == 0)
ImageInstructions = true;
else if (strcmp(Param, "--highlight") == 0)
ImageHighlight = true;
else if ((strcmp(Param, "-v") == 0) || (strcmp(Param, "--version") == 0))
@ -196,8 +190,6 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
printf(" -h, --height <height>: Sets the picture height.\n");
printf(" -f, --from <time>: Sets the first frame or step to save pictures.\n");
printf(" -t, --to <time>: Sets the last frame or step to save pictures.\n");
printf(" --animation: Saves animations frames.\n");
printf(" --instructions: Saves instructions steps.\n");
printf(" --highlight: Highlight pieces in the steps they appear.\n");
printf(" \n");
@ -293,11 +285,6 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
}
}
if (ImageInstructions)
mProject->SetAnimation(false);
else if (ImageAnimation)
mProject->SetAnimation(true);
if (ImageEnd < ImageStart)
ImageEnd = ImageStart;
else if (ImageStart > ImageEnd)
@ -316,22 +303,11 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
ImageEnd = ImageStart;
}
if (mProject->IsAnimation())
{
if (ImageStart > mProject->GetTotalFrames())
ImageStart = mProject->GetTotalFrames();
if (ImageStart > 255)
ImageStart = 255;
if (ImageEnd > mProject->GetTotalFrames())
ImageEnd = mProject->GetTotalFrames();
}
else
{
if (ImageStart > 255)
ImageStart = 255;
if (ImageEnd > 255)
ImageEnd = 255;
}
if (ImageEnd > 255)
ImageEnd = 255;
Image* images = new Image[ImageEnd - ImageStart + 1];
mProject->CreateImages(images, ImageWidth, ImageHeight, ImageStart, ImageEnd, ImageHighlight);

View file

@ -914,20 +914,6 @@ lcCommand gCommands[LC_NUM_COMMANDS] =
"Go to the last step of the model",
"Alt+Down"
},
// LC_VIEW_TIME_STOP
{
"View.Time.Stop",
"Stop",
"Stop playing animation",
""
},
// LC_VIEW_TIME_PLAY
{
"View.Time.Play",
"Play",
"Play animation",
""
},
// LC_VIEW_TIME_INSERT
{
"View.Time.Insert",
@ -942,13 +928,6 @@ lcCommand gCommands[LC_NUM_COMMANDS] =
"Delete current step",
""
},
// LC_VIEW_TIME_ANIMATION
{
"View.Time.Animation",
"Animation",
"Toggle between animation and instruction mode",
""
},
// LC_VIEW_TIME_ADD_KEYS
{
"View.Time.AddKeys",

View file

@ -139,11 +139,8 @@ enum LC_COMMANDS
LC_VIEW_TIME_PREVIOUS,
LC_VIEW_TIME_NEXT,
LC_VIEW_TIME_LAST,
LC_VIEW_TIME_STOP,
LC_VIEW_TIME_PLAY,
LC_VIEW_TIME_INSERT,
LC_VIEW_TIME_DELETE,
LC_VIEW_TIME_ANIMATION,
LC_VIEW_TIME_ADD_KEYS,
LC_VIEW_SPLIT_HORIZONTAL,
LC_VIEW_SPLIT_VERTICAL,

View file

@ -34,8 +34,8 @@ class lcMainWindow : public lcBaseWindow
void UpdateSelectedObjects(int Flags, int SelectedCount, Object* Focus);
void UpdateAction(int NewAction);
void UpdatePaste(bool Enabled);
void UpdateTime(bool Animation, int CurrentTime, int TotalTime);
void UpdateAnimation(bool Animation, bool AddKeys);
void UpdateTime(int CurrentTime, int TotalTime);
void UpdateAnimation(bool AddKeys);
void UpdateLockSnap(lcuint32 Snap);
void UpdateSnap();
void UpdateUndoRedo(const char* UndoText, const char* RedoText);

View file

@ -79,12 +79,10 @@ Light::Light(float px, float py, float pz)
float pos[] = { px, py, pz }, target[] = { 0, 0, 0 };
ChangeKey(1, false, true, pos, LC_LK_POSITION);
ChangeKey(1, false, true, target, LC_LK_TARGET);
ChangeKey(1, true, true, pos, LC_LK_POSITION);
ChangeKey(1, true, true, target, LC_LK_TARGET);
ChangeKey(1, true, pos, LC_LK_POSITION);
ChangeKey(1, true, target, LC_LK_TARGET);
UpdatePosition(1, false);
UpdatePosition(1);
}
// New directional or spot light.
@ -95,14 +93,12 @@ Light::Light(float px, float py, float pz, float tx, float ty, float tz)
float pos[] = { px, py, pz }, target[] = { tx, ty, tz };
ChangeKey(1, false, true, pos, LC_LK_POSITION);
ChangeKey(1, false, true, target, LC_LK_TARGET);
ChangeKey(1, true, true, pos, LC_LK_POSITION);
ChangeKey(1, true, true, target, LC_LK_TARGET);
ChangeKey(1, true, pos, LC_LK_POSITION);
ChangeKey(1, true, target, LC_LK_TARGET);
m_pTarget = new LightTarget(this);
UpdatePosition(1, false);
UpdatePosition(1);
}
void Light::Initialize()
@ -125,22 +121,14 @@ void Light::Initialize()
float ambient[] = { 0, 0, 0 }, diffuse[] = { 0.8f, 0.8f, 0.8f }, specular[] = { 1, 1, 1 };
float constant = 1, linear = 0, quadratic = 0, cutoff = 30, exponent = 0;
ChangeKey(1, false, true, ambient, LC_LK_AMBIENT_COLOR);
ChangeKey(1, false, true, diffuse, LC_LK_DIFFUSE_COLOR);
ChangeKey(1, false, true, specular, LC_LK_SPECULAR_COLOR);
ChangeKey(1, false, true, &constant, LC_LK_CONSTANT_ATTENUATION);
ChangeKey(1, false, true, &linear, LC_LK_LINEAR_ATTENUATION);
ChangeKey(1, false, true, &quadratic, LC_LK_QUADRATIC_ATTENUATION);
ChangeKey(1, false, true, &cutoff, LC_LK_SPOT_CUTOFF);
ChangeKey(1, false, true, &exponent, LC_LK_SPOT_EXPONENT);
ChangeKey(1, true, true, ambient, LC_LK_AMBIENT_COLOR);
ChangeKey(1, true, true, diffuse, LC_LK_DIFFUSE_COLOR);
ChangeKey(1, true, true, specular, LC_LK_SPECULAR_COLOR);
ChangeKey(1, true, true, &constant, LC_LK_CONSTANT_ATTENUATION);
ChangeKey(1, true, true, &linear, LC_LK_LINEAR_ATTENUATION);
ChangeKey(1, true, true, &quadratic, LC_LK_QUADRATIC_ATTENUATION);
ChangeKey(1, true, true, &cutoff, LC_LK_SPOT_CUTOFF);
ChangeKey(1, true, true, &exponent, LC_LK_SPOT_EXPONENT);
ChangeKey(1, true, ambient, LC_LK_AMBIENT_COLOR);
ChangeKey(1, true, diffuse, LC_LK_DIFFUSE_COLOR);
ChangeKey(1, true, specular, LC_LK_SPECULAR_COLOR);
ChangeKey(1, true, &constant, LC_LK_CONSTANT_ATTENUATION);
ChangeKey(1, true, &linear, LC_LK_LINEAR_ATTENUATION);
ChangeKey(1, true, &quadratic, LC_LK_QUADRATIC_ATTENUATION);
ChangeKey(1, true, &cutoff, LC_LK_SPOT_CUTOFF);
ChangeKey(1, true, &exponent, LC_LK_SPOT_EXPONENT);
}
Light::~Light()
@ -251,7 +239,7 @@ void Light::MinIntersectDist(lcClickLine* ClickLine)
}
}
void Light::Move(unsigned short nTime, bool bAnimation, bool bAddKey, float dx, float dy, float dz)
void Light::Move(unsigned short nTime, bool bAddKey, float dx, float dy, float dz)
{
lcVector3 MoveVec(dx, dy, dz);
@ -259,20 +247,20 @@ void Light::Move(unsigned short nTime, bool bAnimation, bool bAddKey, float dx,
{
mPosition += MoveVec;
ChangeKey(nTime, bAnimation, bAddKey, mPosition, LC_LK_POSITION);
ChangeKey(nTime, bAddKey, mPosition, LC_LK_POSITION);
}
if (IsTargetSelected())
{
mTargetPosition += MoveVec;
ChangeKey(nTime, bAnimation, bAddKey, mTargetPosition, LC_LK_TARGET);
ChangeKey(nTime, bAddKey, mTargetPosition, LC_LK_TARGET);
}
}
void Light::UpdatePosition(unsigned short nTime, bool bAnimation)
void Light::UpdatePosition(unsigned short nTime)
{
CalculateKeys(nTime, bAnimation);
CalculateKeys(nTime);
if (m_pTarget != NULL)
{

View file

@ -40,7 +40,7 @@ public:
virtual bool IntersectsVolume(const lcVector4 Planes[6]) const
{ return false; }
void Select (bool bSelecting, bool bFocus, bool bMultiple);
void Move (unsigned short nTime, bool bAnimation, bool bAddKey, float x, float y, float z)
void Move (unsigned short nTime, bool bAddKey, float x, float y, float z)
{
// FIXME: move the position handling to the light target
}
@ -96,7 +96,7 @@ public:
{ return m_pTarget; }
const char* GetName() const
{ return m_strName; };
{ return m_strName; }
void Render(float fLineWidth);
void RenderCone();
@ -106,8 +106,8 @@ public:
virtual void MinIntersectDist(lcClickLine* ClickLine);
virtual bool IntersectsVolume(const lcVector4 Planes[6]) const
{ return false; }
void UpdatePosition(unsigned short nTime, bool bAnimation);
void Move(unsigned short nTime, bool bAnimation, bool bAddKey, float dx, float dy, float dz);
void UpdatePosition(unsigned short nTime);
void Move(unsigned short nTime, bool bAddKey, float dx, float dy, float dz);
void Setup(int index);
void CreateName(const Light* pLight);

View file

@ -18,7 +18,6 @@ Object::Object(LC_OBJECT_TYPE nType)
// m_nState = 0;
// m_strName[0] = '\0';
m_pAnimationKeys = NULL;
m_pInstructionKeys = NULL;
m_nObjectType = nType;
@ -54,7 +53,7 @@ bool Object::FileLoad(lcFile& file)
file.ReadFloats(param, 4);
file.ReadU8(&type, 1);
ChangeKey(time, false, true, param, type);
ChangeKey(time, true, param, type);
}
file.ReadU32(&n, 1);
@ -63,8 +62,6 @@ bool Object::FileLoad(lcFile& file)
file.ReadU16(&time, 1);
file.ReadFloats(param, 4);
file.ReadU8(&type, 1);
ChangeKey(time, true, true, param, type);
}
return true;
@ -88,16 +85,7 @@ void Object::FileSave(lcFile& file) const
file.WriteU8(node->type);
}
for (n = 0, node = m_pAnimationKeys; node; node = node->next)
n++;
file.WriteU32(n);
for (node = m_pAnimationKeys; node; node = node->next)
{
file.WriteU16(node->time);
file.WriteFloats(node->param, 4);
file.WriteU8(node->type);
}
file.WriteU32(0);
}
// =============================================================================
@ -131,14 +119,10 @@ void Object::RegisterKeys(float *values[], LC_OBJECT_KEY_INFO* info, int count)
for (i = 0; i < count; i++)
m_pKeyValues[i] = values[i];
m_pAnimationKeys = AddNode(NULL, 1, 0);
m_pInstructionKeys = AddNode(NULL, 1, 0);
for (i = count-1; i > 0; i--)
{
AddNode(m_pAnimationKeys, 1, i);
AddNode(m_pInstructionKeys, 1, i);
}
AddNode(m_pInstructionKeys, 1, i);
m_pKeyInfo = info;
m_nKeyInfoCount = count;
@ -154,22 +138,12 @@ void Object::RemoveKeys()
node = node->next;
free(prev);
}
for (node = m_pAnimationKeys; node;)
{
prev = node;
node = node->next;
free(prev);
}
}
void Object::ChangeKey(unsigned short nTime, bool bAnimation, bool bAddKey, const float *param, unsigned char nKeyType)
void Object::ChangeKey(unsigned short nTime, bool bAddKey, const float *param, unsigned char nKeyType)
{
LC_OBJECT_KEY *node, *poskey = NULL, *newpos = NULL;
if (bAnimation)
node = m_pAnimationKeys;
else
node = m_pInstructionKeys;
node = m_pInstructionKeys;
while (node)
{
@ -198,7 +172,7 @@ void Object::ChangeKey(unsigned short nTime, bool bAnimation, bool bAddKey, cons
newpos->param[i] = param[i];
}
void Object::CalculateKeys(unsigned short nTime, bool bAnimation)
void Object::CalculateKeys(unsigned short nTime)
{
// LC_OBJECT_KEY *next[m_nKeyInfoCount], *prev[m_nKeyInfoCount], *node;
LC_OBJECT_KEY *next[32], *prev[32], *node;
@ -207,10 +181,7 @@ void Object::CalculateKeys(unsigned short nTime, bool bAnimation)
for (i = 0; i < m_nKeyInfoCount; i++)
next[i] = NULL;
if (bAnimation)
node = m_pAnimationKeys;
else
node = m_pInstructionKeys;
node = m_pInstructionKeys;
// Get the previous and next keys for each variable
while (node && empty)
@ -234,29 +205,18 @@ void Object::CalculateKeys(unsigned short nTime, bool bAnimation)
// TODO: USE KEY IN/OUT WEIGHTS
for (i = 0; i < m_nKeyInfoCount; i++)
{
LC_OBJECT_KEY *n = next[i], *p = prev[i];
LC_OBJECT_KEY *p = prev[i];
if (bAnimation && (n != NULL) && (p->time != nTime))
{
float t = (float)(nTime - p->time)/(n->time - p->time);
for (int j = 0; j < m_pKeyInfo[i].size; j++)
m_pKeyValues[i][j] = p->param[j] + (n->param[j] - p->param[j])*t;
}
else
for (int j = 0; j < m_pKeyInfo[i].size; j++)
m_pKeyValues[i][j] = p->param[j];
for (int j = 0; j < m_pKeyInfo[i].size; j++)
m_pKeyValues[i][j] = p->param[j];
}
}
void Object::CalculateSingleKey(unsigned short nTime, bool bAnimation, int keytype, float *value) const
void Object::CalculateSingleKey(unsigned short nTime, int keytype, float *value) const
{
LC_OBJECT_KEY *next = NULL, *prev = NULL, *node;
LC_OBJECT_KEY *prev = NULL, *node;
if (bAnimation)
node = m_pAnimationKeys;
else
node = m_pInstructionKeys;
node = m_pInstructionKeys;
while (node)
{
@ -265,32 +225,17 @@ void Object::CalculateSingleKey(unsigned short nTime, bool bAnimation, int keyty
if (node->time <= nTime)
prev = node;
else
{
if (next == NULL)
{
next = node;
break;
}
}
break;
}
node = node->next;
}
// TODO: USE KEY IN/OUT WEIGHTS
if (bAnimation && (next != NULL) && (prev->time != nTime))
{
float t = (float)(nTime - prev->time)/(next->time - prev->time);
for (int j = 0; j < m_pKeyInfo[keytype].size; j++)
value[j] = prev->param[j] + (next->param[j] - prev->param[j])*t;
}
else
for (int j = 0; j < m_pKeyInfo[keytype].size; j++)
value[j] = prev->param[j];
for (int j = 0; j < m_pKeyInfo[keytype].size; j++)
value[j] = prev->param[j];
}
void Object::InsertTime(unsigned short start, bool animation, unsigned short time)
void Object::InsertTime(unsigned short start, unsigned short time)
{
LC_OBJECT_KEY *node, *prev = NULL;
unsigned short last;
@ -300,16 +245,8 @@ void Object::InsertTime(unsigned short start, bool animation, unsigned short tim
for (i = 0; i < m_nKeyInfoCount; i++)
end[i] = false;
if (animation)
{
node = m_pAnimationKeys;
last = lcGetActiveProject()->GetTotalFrames();
}
else
{
node = m_pInstructionKeys;
last = 255;
}
node = m_pInstructionKeys;
last = 255;
for (; node != NULL; prev = node, node = node->next)
{
@ -336,14 +273,11 @@ void Object::InsertTime(unsigned short start, bool animation, unsigned short tim
}
}
void Object::RemoveTime(unsigned short start, bool animation, unsigned short time)
void Object::RemoveTime(unsigned short start, unsigned short time)
{
LC_OBJECT_KEY *node, *prev = NULL;
if (animation)
node = m_pAnimationKeys;
else
node = m_pInstructionKeys;
node = m_pInstructionKeys;
for (; node != NULL; prev = node, node = node->next)
{

View file

@ -56,7 +56,7 @@ public:
public:
// Move the object.
virtual void Move(unsigned short nTime, bool bAnimation, bool bAddKey, float dx, float dy, float dz) = 0;
virtual void Move(unsigned short nTime, bool bAddKey, float dx, float dy, float dz) = 0;
// Check if the object intersects the ray.
virtual void MinIntersectDist(lcClickLine* ClickLine) = 0;
@ -148,26 +148,25 @@ public:
// Key handling stuff
public:
void CalculateSingleKey(unsigned short nTime, bool bAnimation, int keytype, float *value) const;
void ChangeKey(unsigned short time, bool animation, bool addkey, const float *param, unsigned char keytype);
virtual void InsertTime(unsigned short start, bool animation, unsigned short time);
virtual void RemoveTime(unsigned short start, bool animation, unsigned short time);
void CalculateSingleKey(unsigned short nTime, int keytype, float *value) const;
void ChangeKey(unsigned short time, bool addkey, const float *param, unsigned char keytype);
virtual void InsertTime(unsigned short start, unsigned short time);
virtual void RemoveTime(unsigned short start, unsigned short time);
int GetKeyTypeCount() const
{ return m_nKeyInfoCount; }
const LC_OBJECT_KEY_INFO* GetKeyTypeInfo(int index) const
{ return &m_pKeyInfo[index]; };
{ return &m_pKeyInfo[index]; }
const float* GetKeyTypeValue(int index) const
{ return m_pKeyValues[index]; };
{ return m_pKeyValues[index]; }
protected:
void RegisterKeys(float *values[], LC_OBJECT_KEY_INFO* info, int count);
void CalculateKeys(unsigned short nTime, bool bAnimation);
void CalculateKeys(unsigned short nTime);
private:
void RemoveKeys();
LC_OBJECT_KEY* m_pAnimationKeys;
LC_OBJECT_KEY* m_pInstructionKeys;
float **m_pKeyValues;

View file

@ -37,7 +37,6 @@ Piece::Piece(PieceInfo* pPieceInfo)
mColorCode = 0;
m_nStepShow = 1;
m_nStepHide = 255;
m_nFrameHide = 65535;
memset(m_strName, 0, sizeof(m_strName));
m_pGroup = NULL;
@ -48,10 +47,8 @@ Piece::Piece(PieceInfo* pPieceInfo)
RegisterKeys (values, piece_key_info, LC_PK_COUNT);
float pos[3] = { 0, 0, 0 }, rot[4] = { 0, 0, 1, 0 };
ChangeKey (1, false, true, pos, LC_PK_POSITION);
ChangeKey (1, false, true, rot, LC_PK_ROTATION);
ChangeKey (1, true, true, pos, LC_PK_POSITION);
ChangeKey (1, true, true, rot, LC_PK_ROTATION);
ChangeKey(1, true, pos, LC_PK_POSITION);
ChangeKey(1, true, rot, LC_PK_ROTATION);
}
Piece::~Piece()
@ -100,7 +97,7 @@ bool Piece::FileLoad(lcFile& file)
file.ReadU16(&time, 1);
file.ReadU8(&type, 1);
ChangeKey (time, false, true, param, type);
ChangeKey(time, true, param, type);
}
file.ReadU32(&keys, 1);
@ -109,8 +106,6 @@ bool Piece::FileLoad(lcFile& file)
file.ReadFloats(param, 4);
file.ReadU16(&time, 1);
file.ReadU8(&type, 1);
ChangeKey (time, true, true, param, type);
}
}
else
@ -141,14 +136,12 @@ bool Piece::FileLoad(lcFile& file)
file.ReadU8(&b, 1);
time = b;
ChangeKey(1, false, true, ModelWorld.r[3], LC_PK_POSITION);
ChangeKey(1, true, true, ModelWorld.r[3], LC_PK_POSITION);
ChangeKey(1, true, ModelWorld.r[3], LC_PK_POSITION);
lcVector4 AxisAngle = lcMatrix44ToAxisAngle(ModelWorld);
AxisAngle[3] *= LC_RTOD;
ChangeKey(time, false, true, AxisAngle, LC_PK_ROTATION);
ChangeKey(time, true, true, AxisAngle, LC_PK_ROTATION);
ChangeKey(time, true, AxisAngle, LC_PK_ROTATION);
lcint32 bl;
file.ReadS32(&bl, 1);
@ -163,14 +156,12 @@ bool Piece::FileLoad(lcFile& file)
lcMatrix44 ModelWorld = lcMatrix44Translation(Translation);
ModelWorld = lcMul(lcMatrix44RotationZ(Rotation[2] * LC_DTOR), lcMul(lcMatrix44RotationY(Rotation[1] * LC_DTOR), lcMul(lcMatrix44RotationX(Rotation[0] * LC_DTOR), ModelWorld)));
ChangeKey(1, false, true, ModelWorld.r[3], LC_PK_POSITION);
ChangeKey(1, true, true, ModelWorld.r[3], LC_PK_POSITION);
ChangeKey(1, true, ModelWorld.r[3], LC_PK_POSITION);
lcVector4 AxisAngle = lcMatrix44ToAxisAngle(ModelWorld);
AxisAngle[3] *= LC_RTOD;
ChangeKey(1, false, true, AxisAngle, LC_PK_ROTATION);
ChangeKey(1, true, true, AxisAngle, LC_PK_ROTATION);
}
ChangeKey(1, true, AxisAngle, LC_PK_ROTATION);
}
}
}
@ -211,8 +202,8 @@ bool Piece::FileLoad(lcFile& file)
if (version > 5)
{
file.ReadU16(&m_nFrameShow, 1);
file.ReadU16(&m_nFrameHide, 1);
file.ReadU16(); // m_nFrameShow
file.ReadU16(); // m_nFrameHide
if (version > 7)
{
@ -238,9 +229,6 @@ bool Piece::FileLoad(lcFile& file)
}
else
{
m_nFrameShow = 1;
m_nFrameHide = 65535;
file.ReadU8(&ch, 1);
if (ch == 0)
m_pGroup = (Group*)-1;
@ -265,8 +253,8 @@ void Piece::FileSave(lcFile& file) const
file.WriteU32(mColorCode);
file.WriteU8(m_nStepShow);
file.WriteU8(m_nStepHide);
file.WriteU16(m_nFrameShow);
file.WriteU16(m_nFrameHide);
file.WriteU16(1); // m_nFrameShow
file.WriteU16(100); // m_nFrameHide
// version 8
file.WriteU8(m_nState);
@ -294,18 +282,15 @@ void Piece::FileSave(lcFile& file) const
file.WriteS32(i);
}
void Piece::Initialize(float x, float y, float z, unsigned char nStep, unsigned short nFrame)
void Piece::Initialize(float x, float y, float z, unsigned char nStep)
{
m_nFrameShow = nFrame;
m_nStepShow = nStep;
float pos[3] = { x, y, z }, rot[4] = { 0, 0, 1, 0 };
ChangeKey (1, false, true, pos, LC_PK_POSITION);
ChangeKey (1, false, true, rot, LC_PK_ROTATION);
ChangeKey (1, true, true, pos, LC_PK_POSITION);
ChangeKey (1, true, true, rot, LC_PK_ROTATION);
ChangeKey(1, true, pos, LC_PK_POSITION);
ChangeKey(1, true, rot, LC_PK_ROTATION);
UpdatePosition (1, false);
UpdatePosition(1);
}
void Piece::CreateName(Piece* pPiece)
@ -339,62 +324,32 @@ void Piece::Select (bool bSelecting, bool bFocus, bool bMultiple)
}
}
void Piece::InsertTime (unsigned short start, bool animation, unsigned short time)
void Piece::InsertTime(unsigned short start, unsigned short time)
{
if (animation)
{
if (m_nFrameShow >= start)
m_nFrameShow = lcMin(m_nFrameShow + time, lcGetActiveProject()->GetTotalFrames());
if (m_nStepShow >= start)
m_nStepShow = lcMin(m_nStepShow + time, 255);
if (m_nFrameHide >= start)
m_nFrameHide = lcMin(m_nFrameHide + time, lcGetActiveProject()->GetTotalFrames());
if (m_nStepHide >= start)
m_nStepHide = lcMin(m_nStepHide + time, 255);
if (m_nFrameShow > lcGetActiveProject()->GetCurrentTime())
Select (false, false, false);
}
else
{
if (m_nStepShow >= start)
m_nStepShow = lcMin(m_nStepShow + time, 255);
if (m_nStepShow > lcGetActiveProject()->GetCurrentTime())
Select (false, false, false);
if (m_nStepHide >= start)
m_nStepHide = lcMin(m_nStepHide + time, 255);
if (m_nStepShow > lcGetActiveProject()->GetCurrentTime ())
Select (false, false, false);
}
Object::InsertTime (start, animation, time);
Object::InsertTime(start, time);
}
void Piece::RemoveTime (unsigned short start, bool animation, unsigned short time)
void Piece::RemoveTime (unsigned short start, unsigned short time)
{
if (animation)
{
if (m_nFrameShow >= start)
m_nFrameShow = lcMax(m_nFrameShow - time, 1);
if (m_nStepShow >= start)
m_nStepShow = lcMax(m_nStepShow - time, 1);
if (m_nFrameHide == lcGetActiveProject()->GetTotalFrames())
m_nFrameHide = lcGetActiveProject()->GetTotalFrames();
else
m_nFrameHide = lcMax(m_nFrameHide - time, 1);
if (m_nStepHide != 255)
m_nStepHide = lcMax(m_nStepHide - time, 1);
if (m_nFrameHide < lcGetActiveProject()->GetCurrentTime())
Select (false, false, false);
}
else
{
if (m_nStepShow >= start)
m_nStepShow = lcMax(m_nStepShow - time, 1);
if (m_nStepHide < lcGetActiveProject()->GetCurrentTime())
Select (false, false, false);
if (m_nStepHide != 255)
m_nStepHide = lcMax(m_nStepHide - time, 1);
if (m_nStepHide < lcGetActiveProject()->GetCurrentTime())
Select (false, false, false);
}
Object::RemoveTime (start, animation, time);
Object::RemoveTime(start, time);
}
void Piece::MinIntersectDist(lcClickLine* ClickLine)
@ -482,35 +437,28 @@ bool Piece::IntersectsVolume(const lcVector4 Planes[6]) const
return Hit;
}
void Piece::Move(unsigned short nTime, bool bAnimation, bool bAddKey, float dx, float dy, float dz)
void Piece::Move(unsigned short nTime, bool bAddKey, float dx, float dy, float dz)
{
mPosition[0] += dx;
mPosition[1] += dy;
mPosition[2] += dz;
ChangeKey(nTime, bAnimation, bAddKey, mPosition, LC_PK_POSITION);
ChangeKey(nTime, bAddKey, mPosition, LC_PK_POSITION);
mModelWorld.SetTranslation(mPosition);
}
bool Piece::IsVisible(unsigned short nTime, bool bAnimation)
bool Piece::IsVisible(unsigned short nTime)
{
if (m_nState & LC_PIECE_HIDDEN)
return false;
if (bAnimation)
{
if (m_nFrameShow > nTime) return false;
if (m_nFrameHide < nTime) return false;
return true;
}
else
{
if (m_nStepShow > nTime) return false;
if ((m_nStepHide == 255) || (m_nStepHide > nTime))
return true;
if (m_nStepShow > nTime)
return false;
}
if ((m_nStepHide == 255) || (m_nStepHide > nTime))
return true;
return false;
}
void Piece::CompareBoundingBox(float box[6])
@ -563,12 +511,12 @@ void Piece::UnGroup(Group* pGroup)
}
// Recalculates current position and connections
void Piece::UpdatePosition(unsigned short nTime, bool bAnimation)
void Piece::UpdatePosition(unsigned short nTime)
{
if (!IsVisible(nTime, bAnimation))
if (!IsVisible(nTime))
m_nState &= ~(LC_PIECE_SELECTED|LC_PIECE_FOCUSED);
CalculateKeys (nTime, bAnimation);
CalculateKeys(nTime);
mModelWorld = lcMatrix44FromAxisAngle(lcVector3(mRotation[0], mRotation[1], mRotation[2]), mRotation[3] * LC_DTOR);
mModelWorld.SetTranslation(mPosition);

View file

@ -26,9 +26,9 @@ public:
Piece (PieceInfo* pPieceInfo);
~Piece ();
void Select (bool bSelecting, bool bFocus, bool bMultiple);
virtual void InsertTime (unsigned short start, bool animation, unsigned short time);
virtual void RemoveTime (unsigned short start, bool animation, unsigned short time);
void Select(bool bSelecting, bool bFocus, bool bMultiple);
virtual void InsertTime(unsigned short start, unsigned short time);
virtual void RemoveTime(unsigned short start, unsigned short time);
virtual bool IntersectsVolume(const lcVector4 Planes[6]) const;
@ -52,16 +52,16 @@ public:
{ return m_strName; }
virtual void MinIntersectDist(lcClickLine* ClickLine);
bool IsVisible(unsigned short nTime, bool bAnimation);
void Initialize(float x, float y, float z, unsigned char nStep, unsigned short nFrame);
bool IsVisible(unsigned short nTime);
void Initialize(float x, float y, float z, unsigned char nStep);
void CreateName(Piece* pPiece);
void CompareBoundingBox(float box[6]);
void SetPieceInfo(PieceInfo* pPieceInfo);
bool FileLoad(lcFile& file);
void FileSave(lcFile& file) const;
void UpdatePosition(unsigned short nTime, bool bAnimation);
void Move(unsigned short nTime, bool bAnimation, bool bAddKey, float dx, float dy, float dz);
void UpdatePosition(unsigned short nTime);
void Move(unsigned short nTime, bool bAddKey, float dx, float dy, float dz);
void DoGroup(Group* pGroup);
void UnGroup(Group* pGroup);
@ -82,14 +82,6 @@ public:
{ m_nStepHide = step; }
unsigned char GetStepHide()
{ return (unsigned char)m_nStepHide; }
void SetFrameShow(unsigned short frame)
{ m_nFrameShow = frame; }
unsigned short GetFrameShow()
{ return m_nFrameShow; }
void SetFrameHide(unsigned short frame)
{ m_nFrameHide = frame; }
unsigned short GetFrameHide()
{ return m_nFrameHide; }
void Render(bool bLighting, bool bEdges);
void RenderBox(bool bHilite, float fLineWidth);
@ -120,8 +112,6 @@ protected:
// Atributes
Group* m_pGroup;
lcuint16 m_nFrameShow;
lcuint16 m_nFrameHide;
lcuint8 m_nStepShow;
lcuint8 m_nStepHide;

File diff suppressed because it is too large Load diff

View file

@ -215,18 +215,11 @@ public:
// Access to protected members
unsigned char GetLastStep();
bool IsAnimation()
{ return m_bAnimation; }
void SetAnimation(bool Anim)
{ m_bAnimation = Anim; } // only to be called from lcApplication::Initialize()
unsigned short GetCurrentTime ()
{ return m_bAnimation ? m_nCurFrame : m_nCurStep; }
{ return m_nCurStep; }
void SetCurrentTime(unsigned short Time)
{
if (m_bAnimation)
m_nCurFrame = Time;
else
m_nCurStep = (unsigned char)Time;
m_nCurStep = (unsigned char)Time;
CalculateStep();
}
void SetCurrentPiece(PieceInfo* pInfo)
@ -242,11 +235,9 @@ public:
void GetSnapDistance(float* SnapXY, float* SnapZ) const;
void GetTimeRange(int* from, int* to)
{
*from = m_bAnimation ? m_nCurFrame : m_nCurStep;
*to = m_bAnimation ? m_nTotalFrames : 255;
*from = m_nCurStep;
*to = 255;
}
unsigned short GetTotalFrames () const
{ return m_nTotalFrames; }
void ConvertToUserUnits(lcVector3& Value) const;
void ConvertFromUserUnits(lcVector3& Value) const;
@ -353,7 +344,6 @@ protected:
void ExportPOVRay(lcFile& File);
void ZoomExtents(int FirstView, int LastView);
bool m_bStopRender;
lcFile* m_pTrackFile;
bool m_bTrackCancel;
int m_nTracking;
@ -405,12 +395,8 @@ protected:
int m_nCurAction;
PieceInfo* m_pCurPiece;
PieceInfo* mDropPiece;
bool m_bAnimation;
bool m_bAddKeys;
unsigned char m_nFPS;
unsigned char m_nCurStep;
lcuint16 m_nCurFrame;
lcuint16 m_nTotalFrames;
bool mGridStuds;
lcuint32 mGridStudColor;

View file

@ -49,7 +49,7 @@ void View::SetDefaultCamera()
if (!mCamera || !mCamera->IsSimple())
mCamera = new Camera(true);
mCamera->SetViewpoint(LC_VIEWPOINT_HOME, 1, false, false);
mCamera->SetViewpoint(LC_VIEWPOINT_HOME, 1, false);
}
LC_CURSOR_TYPE View::GetCursor() const

View file

@ -813,8 +813,6 @@ void lcQMainWindow::print(QPrinter *printer)
glPixelStorei(GL_PACK_ALIGNMENT, 1);
unsigned short previousTime = project->GetCurrentTime();
bool wasAnimation = project->IsAnimation();
project->SetAnimation(false);
QPainter painter(printer);
lcuint8 *buffer = (lcuint8*)malloc(tileWidth * tileHeight * 4);
@ -996,8 +994,6 @@ void lcQMainWindow::print(QPrinter *printer)
free(buffer);
if (wasAnimation)
project->SetAnimation(true);
project->SetCurrentTime(previousTime);
GL_EndRenderToTexture();
@ -1132,26 +1128,20 @@ void lcQMainWindow::updatePaste(bool enabled)
action->setEnabled(enabled);
}
void lcQMainWindow::updateTime(bool animation, int currentTime, int totalTime)
void lcQMainWindow::updateTime(int currentTime, int totalTime)
{
actions[LC_VIEW_TIME_FIRST]->setEnabled(currentTime != 1);
actions[LC_VIEW_TIME_PREVIOUS]->setEnabled(currentTime > 1);
actions[LC_VIEW_TIME_NEXT]->setEnabled(currentTime < totalTime);
actions[LC_VIEW_TIME_LAST]->setEnabled(currentTime != totalTime);
if (animation)
statusTimeLabel->setText(QString(tr(" %1 / %2 ")).arg(QString::number(currentTime), QString::number(totalTime)));
else
statusTimeLabel->setText(QString(tr(" Step %1 ")).arg(QString::number(currentTime)));
statusTimeLabel->setText(QString(tr(" Step %1 ")).arg(QString::number(currentTime)));
}
void lcQMainWindow::updateAnimation(bool animation, bool addKeys)
void lcQMainWindow::updateAnimation(bool addKeys)
{
// TODO: update animation
/*
gtk_widget_set_sensitive (anim_toolbar.play, bAnimation);
gtk_widget_set_sensitive (anim_toolbar.stop, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(anim_toolbar.anim), bAnimation);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(anim_toolbar.keys), bAddKeys);
*/
}

View file

@ -36,8 +36,8 @@ public:
void updateSelectedObjects(int flags, int selectedCount, Object* focus);
void updateAction(int newAction);
void updatePaste(bool enabled);
void updateTime(bool animation, int currentTime, int totalTime);
void updateAnimation(bool animation, bool addKeys);
void updateTime(int currentTime, int totalTime);
void updateAnimation(bool addKeys);
void updateLockSnap(lcuint32 snap);
void updateSnap();
void updateUndoRedo(const char* undoText, const char* redoText);

View file

@ -783,17 +783,8 @@ void lcQPropertiesTree::setPart(Object *newFocusObject)
partRotationZ->setText(1, QString::number(rotation[2]));
partRotationZ->setData(0, PropertyValueRole, rotation[2]);
lcuint32 show, hide;
if (lcGetActiveProject()->IsAnimation())
{
show = part->GetFrameShow();
hide = part->GetFrameHide();
}
else
{
show = part->GetStepShow();
hide = part->GetStepHide();
}
lcuint32 show = part->GetStepShow();
lcuint32 hide = part->GetStepHide();
partShow->setText(1, QString::number(show));
partShow->setData(0, PropertyValueRole, show);

View file

@ -167,7 +167,7 @@ void lcQSelectDialog::addChildren(QTreeWidgetItem *parentItem, Group *parentGrou
if (piece->GetGroup() != parentGroup)
continue;
if (!piece->IsVisible(project->GetCurrentTime(), project->IsAnimation()))
if (!piece->IsVisible(project->GetCurrentTime()))
continue;
QTreeWidgetItem *pieceItem = new QTreeWidgetItem(parentItem, QStringList(piece->GetName()));

View file

@ -499,20 +499,20 @@ void lcMainWindow::UpdatePaste(bool Enabled)
window->updatePaste(Enabled);
}
void lcMainWindow::UpdateTime(bool Animation, int CurrentTime, int TotalTime)
void lcMainWindow::UpdateTime(int CurrentTime, int TotalTime)
{
lcQMainWindow* window = (lcQMainWindow*)mHandle;
if (window)
window->updateTime(Animation, CurrentTime, TotalTime);
window->updateTime(CurrentTime, TotalTime);
}
void lcMainWindow::UpdateAnimation(bool Animation, bool AddKeys)
void lcMainWindow::UpdateAnimation(bool AddKeys)
{
lcQMainWindow* window = (lcQMainWindow*)mHandle;
if (window)
window->updateAnimation(Animation, AddKeys);
window->updateAnimation(AddKeys);
}
void lcMainWindow::UpdateLockSnap(lcuint32 Snap)