Moderators: Sascha Willems, walaber
void dgMeshEffect::ApplyTransform (const dgMatrix& matrix)
{
matrix.TransformTriplex(&m_points[0].m_x, sizeof (dgBigVector), &m_points[0].m_x, sizeof (dgBigVector), m_pointCount);
matrix.TransformTriplex(&m_attrib[0].m_vertex.m_x, sizeof (dgVertexAtribute), &m_attrib[0].m_vertex.m_x, sizeof (dgVertexAtribute), m_atribCount);
dgMatrix rotation ((matrix.Inverse4x4()).Transpose4X4());
for (dgInt32 i = 0; i < m_atribCount; i ++) {
dgVector n (dgFloat32 (m_attrib[i].m_normal_x), dgFloat32 (m_attrib[i].m_normal_y), dgFloat32 (m_attrib[i].m_normal_z), dgFloat32 (0.0f));
n = rotation.RotateVector(n);
dgAssert ((n % n) > dgFloat32 (0.0f));
n = n.Scale (dgRsqrt (n % n));
m_attrib[i].m_normal_x = n.m_x;
m_attrib[i].m_normal_y = n.m_y;
m_attrib[i].m_normal_z = n.m_z;
}
// Enclave look here !!!
// sanity check of m_atrrib
for (int i = 0; i < m_atribCount; i ++)
{
dgVector n (dgFloat32 (m_attrib[i].m_normal_x), dgFloat32 (m_attrib[i].m_normal_y), dgFloat32 (m_attrib[i].m_normal_z), 0.0f);
dgFloat32 mag2 = n % n;
dgAssert (mag2 > 0.99f);
dgAssert (mag2 < 1.01f);
}
void dgMeshEffect::BuildFromVertexListIndexList(
dgInt32 faceCount, const dgInt32* const faceIndexCount, const dgInt32* const faceMaterialIndex,
const dgFloat32* const vertex, dgInt32 vertexStrideInBytes, const dgInt32* const vertexIndex,
const dgFloat32* const normal, dgInt32 normalStrideInBytes, const dgInt32* const normalIndex,
const dgFloat32* const uv0, dgInt32 uv0StrideInBytes, const dgInt32* const uv0Index,
const dgFloat32* const uv1, dgInt32 uv1StrideInBytes, const dgInt32* const uv1Index)
void Friction (DemoEntityManager* const scene)
{
// load the skybox
scene->CreateSkyBox();
// load the scene from a ngd file format
char fileName[2048];
GetWorkingFileName ("frictionDemo.ngd", fileName);
// this returns: + fileName 0x0018f3ec "c:\\dev\\newton-dynamics-read-only\\applications/media/frictionDemo.ngd" char[2048]
//scene->LoadScene (fileName); // comenting this out and replacing with hardcoded path:
scene->LoadScene ("C:\\dev\\newton-dynamics-read-only\\applications\\media");
void GetWorkingFileName (const char* const name, char* const outPathName)
{
#if defined (_MSC_VER)
//GetAplicationDirectory (appPath);
char appPath [256];
GetModuleFileNameA(NULL, appPath, sizeof (appPath));
strlwr (appPath);
char* const ptr = strstr (appPath, "applications");
ptr [0] = 0;
sprintf (outPathName, "%sapplications/media/%s", appPath, name);
#elif defined(_MACOSX_VER)
char tmp[2048];
CFURLRef appURL (CFBundleCopyBundleURL(CFBundleGetMainBundle()));
CFStringRef filePath (CFURLCopyFileSystemPath (appURL, kCFURLPOSIXPathStyle));
CFStringGetCString (filePath, tmp, PATH_MAX, kCFStringEncodingUTF8);
char* const ptr = strstr (tmp, "applications");
ptr [0] = 0;
sprintf (outPathName, "%sapplications/media/%s", tmp, name);
// Clean up
CFRelease( appURL );
CFRelease( filePath );
#elif defined(_POSIX_VER)
char id[2048];
char path[2048];
char *end;
sprintf(id, "/proc/%d/exe", getpid());
memset (path, 0, sizeof (path));
readlink(id, path, 1024);
char* const end = strrchr (path, '//');
*end = 0;
sprintf (outPathName, "%s/bin/%s", path, name);
#else
#error "error: neet to implement \"GetWorkingFileName\" here for thsi platform"
#endif
}
I have win7 32 but the license does not let me use in more than one machine, therefore I can no test this on windows 7 32 bit.
Julio Jerez wrote:can you check is the file is open does no fail after that
Julio Jerez wrote:so are you saying that if I download VS 2012 express I will be able to reproduce this?
. I get the stack alert at another place where it makes no sense, like in quat slerp.
Users browsing this forum: No registered users and 3 guests