Jump to content

Another game physics related question

Featured Replies

I currently use Torque and Blender to design my game and I have a problem:

 

How do I import the scene or figure I constructed in Blender to the Torque Game Engine and the other way around, what I constructed in Torque to Blender?

Edited by Uri

Well first you have to convert it to the Torque Game Engine model format which is apparently .DTS! Then, check this out, John is kind of cute..:P

 

much easier than trying to do anything even remotely similar in C++................

 

Just for your personal comparison and for the amusement of others here is my simple code used just to index the .x(direct x file format) file in C++!

 

.cpp

#include "XFilez.h"

bool CMeshFile::LoadXFile(string file)
{
Index.mesh_file = file;
ifsMeshFile.open("C:/Projects/Naomies Moon/Roz_XSI/Roz.x");

while(!(ifsMeshFile.eof()))
{
	getline(ifsMeshFile,line);
	vMeshFile.push_back(line);
}

ifsMeshFile.close();

if (!ifsMeshFile.bad() && !ifsMeshFile.fail())
{

	//find templates_index_end index
	file_itterator=2;			
	while (!(vMeshFile.at(file_itterator).find("Frame") == 0))	
	{
		file_itterator++;
	}

	Index.scene_index_begin=file_itterator;

	//Index Hierarchy
	while (!(vMeshFile.at(file_itterator).find("}") == 0))	
	{

		if(vMeshFile.at(file_itterator).find("Frame") == 1)
		{

			Index.frame_index_begin.push_back(file_itterator);

			while(!(vMeshFile.at(file_itterator).find("}") == 1))
			{
				file_itterator++;
			}

		}

		else
			file_itterator++;

	}

}
else 
	return false;

return true;

}

 

.h

#ifndef X_FILEZ
#define X_FILEZ

#if _WIN32
#pragma once
#endif

#include <windows.h>

#include <fstream>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

class CMeshFileIndex
{
public:
string mesh_file;

static const int header = 0;

static const int templates_index_begin = 1;

int scene_index_begin;

vector<int> frame_index_begin;

};

class CMeshFile
{
public:
bool LoadXFile(string file);

private:
CMeshFileIndex Index;

ifstream ifsMeshFile;

string line;

vector <string> vMeshFile;

int file_itterator;

};

#endif

 

tabbing not so easily copied and pasted.........

Edited by buttacup

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.