32G3D::Vector3
TranslateLocation(G3D::Vector4
const* DBCPosition, G3D::Vector3
const* basePosition, G3D::Vector3
const* splineVector)
35 float x = basePosition->x + splineVector->x;
36 float y = basePosition->y + splineVector->y;
37 float z = basePosition->z + splineVector->z;
38 float const distance = sqrt((x * x) + (y * y));
39 float angle = std::atan2(x, y) - DBCPosition->w;
42 angle += 2 * float(
M_PI);
44 work.x = DBCPosition->x + (distance * sin(angle));
45 work.y = DBCPosition->y + (distance * cos(angle));
46 work.z = DBCPosition->z + z;
53 char const* buffer =
reinterpret_cast<char const*
>(header);
93 targetcam.push_back(thisCam);
128 if (targetcam.size() > 0)
135 lastTarget = targetcam[0];
136 nextTarget = targetcam[0];
137 for (
uint32 j = 0; j < targetcam.size(); ++j)
139 nextTarget = targetcam[j];
140 if (targetcam[j].timeStamp > posTimestamps[i])
143 lastTarget = targetcam[j];
150 if (lastTarget.
timeStamp != posTimestamps[i])
164 cameras.push_back(thisCam);
177 TC_LOG_INFO(
"server.loading",
">> Loading Cinematic Camera files");
182 std::string filenameWork = dataPath;
183 filenameWork.append(dbcentry->Model);
186 std::replace(filenameWork.begin(), filenameWork.end(),
'\\',
'/');
188 boost::filesystem::path filename = filenameWork;
191 filename.make_preferred();
194 filename.replace_extension(
"m2");
196 std::ifstream m2file(filename.string().c_str(), std::ios::in | std::ios::binary);
197 if (!m2file.is_open())
201 m2file.seekg(0, std::ios::end);
202 std::streamoff fileSize = m2file.tellg();
207 TC_LOG_ERROR(
"server.loading",
"Camera file {} is damaged. File is smaller than header size", filename.string());
213 m2file.seekg(0, std::ios::beg);
215 m2file.read(fileCheck, 4);
219 if (strcmp(fileCheck,
"MD20"))
221 TC_LOG_ERROR(
"server.loading",
"Camera file {} is damaged. File identifier not found", filename.string());
227 std::vector<char> buffer(fileSize);
228 m2file.seekg(0, std::ios::beg);
229 if (!m2file.read(buffer.data(), fileSize))
241 TC_LOG_ERROR(
"server.loading",
"Camera file {} is damaged. Camera references position beyond file end", filename.string());
247 if (!
readCamera(cam, fileSize, header, dbcentry))
248 TC_LOG_ERROR(
"server.loading",
"Camera file {} is damaged. Camera references position beyond file end", filename.string());