bool FTransform::InitFromString( const FString& Source ) { TArray<FString> ComponentStrings; Source.ParseIntoArray(&ComponentStrings, TEXT("|"), true); const int32 NumComponents = ComponentStrings.Num(); if(3 != NumComponents) { return false; } // Translation FVector ParsedTranslation = FVector::ZeroVector; if( !FDefaultValueHelper::ParseVector(ComponentStrings[0], ParsedTranslation) ) { return false; } // Rotation FRotator ParsedRotation = FRotator::ZeroRotator; if( !FDefaultValueHelper::ParseRotator(ComponentStrings[1], ParsedRotation) ) { return false; } // Scale FVector Scale = FVector(1.f); if( !FDefaultValueHelper::ParseVector(ComponentStrings[2], Scale) ) { return false; } SetComponents(FQuat(ParsedRotation), ParsedTranslation, Scale); return true; }
//------------------------------------------------------------- // Task : Set path's filename and extension //------------------------------------------------------------- void CPath::SetNameExtension(const char * lpszNameExtension) { std::string Drive; std::string Directory; GetComponents(&Drive,&Directory); SetComponents(Drive.c_str(),Directory.c_str(),lpszNameExtension,NULL); }
//------------------------------------------------------------- // Task : Set path's filename //------------------------------------------------------------- void CPath::SetName(const char * lpszName) { std::string Drive; std::string Directory; std::string Extension; GetComponents(&Drive,&Directory,NULL,&Extension); SetComponents(Drive.c_str(),Directory.c_str(),lpszName,Extension.c_str()); }
//------------------------------------------------------------- // Task : Set path's file extension //------------------------------------------------------------- void CPath::SetExtension(const char * lpszExtension) { std::string Drive; std::string Directory; std::string Name; GetComponents(&Drive,&Directory,&Name); SetComponents(Drive.c_str(),Directory.c_str(),Name.c_str(),lpszExtension); }
//------------------------------------------------------------- // Task : Set path's drive //------------------------------------------------------------- void CPath::SetDrive(TCHAR chDrive) { stdstr_f Drive("%c",chDrive); std::string Directory; std::string Name; std::string Extension; GetComponents(NULL,&Directory,&Name,&Extension); SetComponents(Drive.c_str(),Directory.c_str(),Name.c_str(),Extension.c_str()); }
//------------------------------------------------------------- // Task : Set path's drive and directory //------------------------------------------------------------- void CPath::SetDriveDirectory(const char * lpszDriveDirectory) { std::string DriveDirectory =lpszDriveDirectory; std::string Name; std::string Extension; EnsureTrailingBackslash(DriveDirectory); cleanPathString(DriveDirectory); GetComponents(NULL,NULL,&Name,&Extension); SetComponents(NULL,DriveDirectory.c_str(),Name.c_str(),Extension.c_str()); }
//------------------------------------------------------------- // Task : Set path's file extension //------------------------------------------------------------- void CPath::SetExtension(int iExtension) { std::string Drive; std::string Directory; std::string Name; TCHAR sExtension[20]; memset(sExtension, 0, sizeof(sExtension)); _itoa(iExtension, sExtension, 10); GetComponents(&Drive,&Directory,&Name); SetComponents(Drive.c_str(),Directory.c_str(),Name.c_str(),sExtension); }
//------------------------------------------------------------- // Task : Set path's filename //------------------------------------------------------------- void CPath::SetName(int iName) { std::string Drive; std::string Directory; std::string Extension; TCHAR sName[33]; memset(sName, 0, sizeof(sName)); _itoa(iName, sName, 10); GetComponents(&Drive,&Directory,NULL,&Extension); SetComponents(Drive.c_str(),Directory.c_str(),sName,Extension.c_str()); }
//------------------------------------------------------------- // Task : Set path's directory //------------------------------------------------------------- void CPath::SetDirectory(const char * lpszDirectory, bool bEnsureAbsolute /*= FALSE*/) { std::string Drive; std::string Directory =lpszDirectory; std::string Name; std::string Extension; if(bEnsureAbsolute) EnsureLeadingBackslash(Directory); EnsureTrailingBackslash(Directory); GetComponents(&Drive,NULL,&Name,&Extension); SetComponents(Drive.c_str(),Directory.c_str(),Name.c_str(),Extension.c_str()); }
/** Initialises the Vertexpool * * @param nv The number of Vertices this object has access to * @param ni The number of indices this object will reference * @param nc_p The number of components in each position * @param nc_t The number of components in each texture coordinate * * @returns boolean true or false, depending on nothing at this time, you'll get true regardless * * NOTE: Texcoords are the only part of any geometry which is not assigned by default * since you cannot assume every geometry chunk will have need for texture coordinates * perhaps they only want flat shaded? assigning the memory for a chunk of texture * coordinates would be a waste of memory in that situation, in any case, it's not * as if assigning a chunk of memory once every time you create a geometry chunk * is time consuming * (wouldnt happen mid-game anyway, would happen whilst initialising a level or something) * * Operations: * -# Release all previously allocated data * -# Store the number of position and indices * -# Allocate a buffer to store the index dat * -# Set the number of components for each position and texture coordinate * -# Set the vertexpool's initial state to IVertexBuffer::STATERESET */ bool OGLDynamicVB::Initialise(unsigned int nv, unsigned int ni, unsigned int nc_p, unsigned int nc_t) { ReleaseAll(); m_num_vertex = nv; m_num_index = ni; m_index = new unsigned int[ni]; memset(m_index,0,ni*sizeof(unsigned int)); SetComponents(nc_p, nc_t); m_state = STATERESET; return true; }
//------------------------------------------------------------- // Task : Append a subdirectory 2 path's directory //------------------------------------------------------------- void CPath::AppendDirectory(const char * lpszSubDirectory) { std::string Drive; std::string Directory; std::string SubDirectory =lpszSubDirectory; std::string Name; std::string Extension; if(SubDirectory.empty()) return; // Strip out any preceeding backslash StripLeadingBackslash(SubDirectory); EnsureTrailingBackslash(SubDirectory); GetComponents(&Drive,&Directory,&Name,&Extension); EnsureTrailingBackslash(Directory); Directory +=SubDirectory; SetComponents(Drive.c_str(),Directory.c_str(),Name.c_str(),Extension.c_str()); }