PDA

View Full Version : ClearMemory function?



glAntony
10-17-2004, 05:54 AM
Hi,

I'm got this code from here http://www.terathon.com/code/tangent.html The code is displayed on that page, no downloads needed.

Tagent mapping, I have it integrated into my code.(My first time doing tangent mapping, so not confident enough to rewrite it)

It all compiles fine, aside from one a missing function ClearMemory. The line in the code.


ClearMemory(tan1, vertexCount * sizeof(Vector3D) * 2);I'm using vc++. I did a find in files search and no includes I have include it, nor can I find it on the web.

Any ideas where or a similar function i can use instead? (tan1 is a class of vector3ds)

yooyo
10-17-2004, 06:16 AM
Common man... Use your brain!

memset(tan1, 0, vertexCount * sizeof(Vector3D) * 2);

yooyo

zeckensack
10-17-2004, 06:17 AM
Try
memset(tan1, 0, vertexCount * sizeof(Vector3D) * 2);
You may have to
#include <memory.h>

The function appears to fill all of the array. It isn't strictly necessary to "clear" it. IMO the whole thing would still work if you just omit the ClearMemory call, instead of replacing it with something more portable.

M/\dm/\n
10-17-2004, 07:08 AM
Try just writing ZeroMemory, that function should be included.

jwatte
10-17-2004, 07:33 AM
How about asking in an appropriate forum?