mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
commit
5a1dba6a09
6 changed files with 81 additions and 54 deletions
|
@ -874,7 +874,6 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini, co
|
||||||
{
|
{
|
||||||
std::vector<std::pair<std::time_t, boost::filesystem::path>> contentFiles;
|
std::vector<std::pair<std::time_t, boost::filesystem::path>> contentFiles;
|
||||||
std::string baseGameFile("Game Files:GameFile");
|
std::string baseGameFile("Game Files:GameFile");
|
||||||
std::string gameFile("");
|
|
||||||
std::time_t defaultTime = 0;
|
std::time_t defaultTime = 0;
|
||||||
ToUTF8::Utf8Encoder encoder(mEncoding);
|
ToUTF8::Utf8Encoder encoder(mEncoding);
|
||||||
|
|
||||||
|
@ -890,7 +889,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini, co
|
||||||
multistrmap::const_iterator it = ini.begin();
|
multistrmap::const_iterator it = ini.begin();
|
||||||
for (int i=0; it != ini.end(); i++)
|
for (int i=0; it != ini.end(); i++)
|
||||||
{
|
{
|
||||||
gameFile = baseGameFile;
|
std::string gameFile = baseGameFile;
|
||||||
gameFile.append(std::to_string(i));
|
gameFile.append(std::to_string(i));
|
||||||
|
|
||||||
it = ini.find(gameFile);
|
it = ini.find(gameFile);
|
||||||
|
|
|
@ -372,10 +372,10 @@ osg::ref_ptr<osg::Node> CSVRender::Object::makeRotateMarker (int axis)
|
||||||
indices[j] -= VertexCount;
|
indices[j] -= VertexCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t offset = i * IndicesPerSegment;
|
size_t elementOffset = i * IndicesPerSegment;
|
||||||
for (size_t j = 0; j < IndicesPerSegment; ++j)
|
for (size_t j = 0; j < IndicesPerSegment; ++j)
|
||||||
{
|
{
|
||||||
primitives->setElement(offset++, indices[IndexPattern[j]]);
|
primitives->setElement(elementOffset++, indices[IndexPattern[j]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -651,7 +651,6 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event)
|
||||||
|
|
||||||
if (mDragMode == InteractionType_PrimaryEdit)
|
if (mDragMode == InteractionType_PrimaryEdit)
|
||||||
{
|
{
|
||||||
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
|
||||||
editMode.drag (event->pos(), mDragX, mDragY, mDragFactor); // note: terraintexturemode only uses pos
|
editMode.drag (event->pos(), mDragX, mDragY, mDragFactor); // note: terraintexturemode only uses pos
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,9 @@
|
||||||
#if USE_CRASH_CATCHER
|
#if USE_CRASH_CATCHER
|
||||||
extern void crashCatcherInstall(int argc, char **argv, const std::string &crashLogPath);
|
extern void crashCatcherInstall(int argc, char **argv, const std::string &crashLogPath);
|
||||||
#else
|
#else
|
||||||
inline void crashCatcherInstall(int, char **, const std::string &crashLogPath) { return 0; }
|
inline void crashCatcherInstall(int, char **, const std::string &crashLogPath)
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,10 +4,24 @@
|
||||||
|
|
||||||
namespace Nif
|
namespace Nif
|
||||||
{
|
{
|
||||||
|
osg::Quat NIFStream::getQuaternion()
|
||||||
//Private functions
|
{
|
||||||
|
float f[4];
|
||||||
|
readLittleEndianBufferOfType<4, float,uint32_t>(inp, (float*)&f);
|
||||||
//Public functions
|
osg::Quat quat;
|
||||||
|
quat.w() = f[0];
|
||||||
|
quat.x() = f[1];
|
||||||
|
quat.y() = f[2];
|
||||||
|
quat.z() = f[3];
|
||||||
|
return quat;
|
||||||
|
}
|
||||||
|
|
||||||
|
Transformation NIFStream::getTrafo()
|
||||||
|
{
|
||||||
|
Transformation t;
|
||||||
|
t.pos = getVector3();
|
||||||
|
t.rotation = getMatrix3();
|
||||||
|
t.scale = getFloat();
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,8 +80,8 @@ template<typename type, typename IntegerT> type inline readLittleEndianType(File
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
class NIFStream {
|
class NIFStream
|
||||||
|
{
|
||||||
/// Input stream
|
/// Input stream
|
||||||
Files::IStreamPtr inp;
|
Files::IStreamPtr inp;
|
||||||
|
|
||||||
|
@ -97,67 +97,67 @@ public:
|
||||||
{
|
{
|
||||||
return readLittleEndianType<char,char>(inp);
|
return readLittleEndianType<char,char>(inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
short getShort()
|
short getShort()
|
||||||
{
|
{
|
||||||
return readLittleEndianType<short,short>(inp);
|
return readLittleEndianType<short,short>(inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short getUShort()
|
unsigned short getUShort()
|
||||||
{
|
{
|
||||||
return readLittleEndianType<unsigned short,unsigned short>(inp);
|
return readLittleEndianType<unsigned short,unsigned short>(inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getInt()
|
int getInt()
|
||||||
{
|
{
|
||||||
return readLittleEndianType<int,int>(inp);
|
return readLittleEndianType<int,int>(inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int getUInt()
|
unsigned int getUInt()
|
||||||
{
|
{
|
||||||
return readLittleEndianType<unsigned int,unsigned int>(inp);
|
return readLittleEndianType<unsigned int,unsigned int>(inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
float getFloat()
|
float getFloat()
|
||||||
{
|
{
|
||||||
return readLittleEndianType<float,uint32_t>(inp);
|
return readLittleEndianType<float,uint32_t>(inp);
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Vec2f getVector2() {
|
osg::Vec2f getVector2()
|
||||||
|
{
|
||||||
osg::Vec2f vec;
|
osg::Vec2f vec;
|
||||||
readLittleEndianBufferOfType<2,float,uint32_t>(inp, (float*)&vec._v[0]);
|
readLittleEndianBufferOfType<2,float,uint32_t>(inp, (float*)&vec._v[0]);
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
osg::Vec3f getVector3() {
|
|
||||||
|
osg::Vec3f getVector3()
|
||||||
|
{
|
||||||
osg::Vec3f vec;
|
osg::Vec3f vec;
|
||||||
readLittleEndianBufferOfType<3, float,uint32_t>(inp, (float*)&vec._v[0]);
|
readLittleEndianBufferOfType<3, float,uint32_t>(inp, (float*)&vec._v[0]);
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
osg::Vec4f getVector4() {
|
|
||||||
|
osg::Vec4f getVector4()
|
||||||
|
{
|
||||||
osg::Vec4f vec;
|
osg::Vec4f vec;
|
||||||
readLittleEndianBufferOfType<4, float,uint32_t>(inp, (float*)&vec._v[0]);
|
readLittleEndianBufferOfType<4, float,uint32_t>(inp, (float*)&vec._v[0]);
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
Matrix3 getMatrix3() {
|
|
||||||
|
Matrix3 getMatrix3()
|
||||||
|
{
|
||||||
Matrix3 mat;
|
Matrix3 mat;
|
||||||
readLittleEndianBufferOfType<9, float,uint32_t>(inp, (float*)&mat.mValues);
|
readLittleEndianBufferOfType<9, float,uint32_t>(inp, (float*)&mat.mValues);
|
||||||
return mat;
|
return mat;
|
||||||
}
|
}
|
||||||
osg::Quat getQuaternion() {
|
|
||||||
float f[4];
|
osg::Quat getQuaternion();
|
||||||
readLittleEndianBufferOfType<4, float,uint32_t>(inp, (float*)&f);
|
|
||||||
osg::Quat quat;
|
Transformation getTrafo();
|
||||||
quat.w() = f[0];
|
|
||||||
quat.x() = f[1];
|
|
||||||
quat.y() = f[2];
|
|
||||||
quat.z() = f[3];
|
|
||||||
return quat;
|
|
||||||
}
|
|
||||||
Transformation getTrafo() {
|
|
||||||
Transformation t;
|
|
||||||
t.pos = getVector3();
|
|
||||||
t.rotation = getMatrix3();
|
|
||||||
t.scale = getFloat();
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Read in a string of the given length
|
///Read in a string of the given length
|
||||||
std::string getString(size_t length) {
|
std::string getString(size_t length)
|
||||||
|
{
|
||||||
std::vector<char> str(length + 1, 0);
|
std::vector<char> str(length + 1, 0);
|
||||||
|
|
||||||
inp->read(&str[0], length);
|
inp->read(&str[0], length);
|
||||||
|
@ -165,41 +165,54 @@ public:
|
||||||
return &str[0];
|
return &str[0];
|
||||||
}
|
}
|
||||||
///Read in a string of the length specified in the file
|
///Read in a string of the length specified in the file
|
||||||
std::string getString() {
|
std::string getString()
|
||||||
|
{
|
||||||
size_t size = readLittleEndianType<uint32_t,uint32_t>(inp);
|
size_t size = readLittleEndianType<uint32_t,uint32_t>(inp);
|
||||||
return getString(size);
|
return getString(size);
|
||||||
}
|
}
|
||||||
///This is special since the version string doesn't start with a number, and ends with "\n"
|
///This is special since the version string doesn't start with a number, and ends with "\n"
|
||||||
std::string getVersionString() {
|
std::string getVersionString()
|
||||||
|
{
|
||||||
std::string result;
|
std::string result;
|
||||||
std::getline(*inp, result);
|
std::getline(*inp, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getUShorts(std::vector<unsigned short> &vec, size_t size) {
|
void getUShorts(std::vector<unsigned short> &vec, size_t size)
|
||||||
|
{
|
||||||
vec.resize(size);
|
vec.resize(size);
|
||||||
readLittleEndianDynamicBufferOfType<unsigned short,unsigned short>(inp, &vec.front(), size);
|
readLittleEndianDynamicBufferOfType<unsigned short,unsigned short>(inp, &vec.front(), size);
|
||||||
}
|
}
|
||||||
void getFloats(std::vector<float> &vec, size_t size) {
|
|
||||||
|
void getFloats(std::vector<float> &vec, size_t size)
|
||||||
|
{
|
||||||
vec.resize(size);
|
vec.resize(size);
|
||||||
readLittleEndianDynamicBufferOfType<float,uint32_t>(inp, &vec.front(), size);
|
readLittleEndianDynamicBufferOfType<float,uint32_t>(inp, &vec.front(), size);
|
||||||
}
|
}
|
||||||
void getVector2s(std::vector<osg::Vec2f> &vec, size_t size) {
|
|
||||||
|
void getVector2s(std::vector<osg::Vec2f> &vec, size_t size)
|
||||||
|
{
|
||||||
vec.resize(size);
|
vec.resize(size);
|
||||||
/* The packed storage of each Vec2f is 2 floats exactly */
|
/* The packed storage of each Vec2f is 2 floats exactly */
|
||||||
readLittleEndianDynamicBufferOfType<float,uint32_t>(inp,(float*) &vec.front(), size*2);
|
readLittleEndianDynamicBufferOfType<float,uint32_t>(inp,(float*) &vec.front(), size*2);
|
||||||
}
|
}
|
||||||
void getVector3s(std::vector<osg::Vec3f> &vec, size_t size) {
|
|
||||||
|
void getVector3s(std::vector<osg::Vec3f> &vec, size_t size)
|
||||||
|
{
|
||||||
vec.resize(size);
|
vec.resize(size);
|
||||||
/* The packed storage of each Vec3f is 3 floats exactly */
|
/* The packed storage of each Vec3f is 3 floats exactly */
|
||||||
readLittleEndianDynamicBufferOfType<float,uint32_t>(inp, (float*) &vec.front(), size*3);
|
readLittleEndianDynamicBufferOfType<float,uint32_t>(inp, (float*) &vec.front(), size*3);
|
||||||
}
|
}
|
||||||
void getVector4s(std::vector<osg::Vec4f> &vec, size_t size) {
|
|
||||||
|
void getVector4s(std::vector<osg::Vec4f> &vec, size_t size)
|
||||||
|
{
|
||||||
vec.resize(size);
|
vec.resize(size);
|
||||||
/* The packed storage of each Vec4f is 4 floats exactly */
|
/* The packed storage of each Vec4f is 4 floats exactly */
|
||||||
readLittleEndianDynamicBufferOfType<float,uint32_t>(inp, (float*) &vec.front(), size*4);
|
readLittleEndianDynamicBufferOfType<float,uint32_t>(inp, (float*) &vec.front(), size*4);
|
||||||
}
|
}
|
||||||
void getQuaternions(std::vector<osg::Quat> &quat, size_t size) {
|
|
||||||
|
void getQuaternions(std::vector<osg::Quat> &quat, size_t size)
|
||||||
|
{
|
||||||
quat.resize(size);
|
quat.resize(size);
|
||||||
for (size_t i = 0;i < quat.size();i++)
|
for (size_t i = 0;i < quat.size();i++)
|
||||||
quat[i] = getQuaternion();
|
quat[i] = getQuaternion();
|
||||||
|
|
Loading…
Reference in a new issue