Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Jul 2011
Offline Last Active May 15 2016 05:32 AM

Posts I've Made

In Topic: Read one text line without limit correctly

05 February 2016 - 05:16 AM

data is of a type CString. While I'm not familiar with the type it is reasonable to assume it will do its own copy.

Yes, all is handled by the custom class.


This is a nonstandard function, but you didn't say what platform you're on, so...

Cross-Platform is needed, but I didn't think a platform test was needed for this specific case.

In Topic: Read one text line without limit correctly

04 February 2016 - 09:35 PM

I missed to mention it's to read from a FILE pointer and output into a custom string class variable, here the actual code :

bool CFile::ReadLine( CString& Data, const UInt32 MaxLineLength )
  // Allocate the buffer used to read the line.
  char* Buffer = new char[ MaxLineLength ];

  // Read the line into the buffer.
  if( fgets( Buffer, MaxLineLength, m_File ) != nullptr )
    Data = Buffer;
    delete[] Buffer;
    return true;
    delete[] Buffer;
    return false;

In Topic: Loosing materials when adding IK transformations to the bone?

31 January 2016 - 07:36 AM

frame->TransformationMatrix += matFinal;

You have to multiply matrices to combine them (in the good order).

In Topic: (UE4) Use button in inventory to show/hide items.

22 January 2016 - 04:57 PM

One option is to have a list of item with one parent which is the category, each category like that.

Then it's only needed to make one parent visible to have all these children visible (or if visible is not inherited, set visible on each child).

In Topic: Get forward vector of TransformComponent

18 January 2016 - 07:48 PM

You can extract the forward vector using the transpose of your model matrix and get the third row or column based on how you store the matrix.

If you store euler angles you can also compute the forward vector like that :

Forward.x = sin( Rotation.y );
Forward.y = -tan( Rotation.x );
Forward.z = cos( Rotation.y );

From a quaternion you can get it like that :

CVector3 CQuaternion::ComputeForwardVector() const
  const float x2 = 2.0f * x;
  const float y2 = 2.0f * y;
  const float z2 = 2.0f * z;
  const float x2w = x2 * w;
  const float y2w = y2 * w;
  const float x2x = x2 * x;
  const float z2x = z2 * x;
  const float y2y = y2 * y;
  const float z2y = z2 * y;
  return CVector3( z2x + y2w, z2y - x2w, 1.0f - ( x2x + y2y ) );