particles sprite index
| Date : Tue, 20 Mar 2007 14:44:03 -0400 (EDT) |
| To : xsi(at)Softimage.COM |
| From : dominic bélanger <lowtunes1(at)yahoo.ca> |
| Subject : particles sprite index |
Hi ,
im trying to to assign randomly a start frame from a sequence to each particle in the cloud ,i've done two kinds of code , one in jscript with 2 particle event and particle attriubute, and one in c++ in both cases xsi crash in the render i think mental ray doesn't like this ,but if anyone has a solution thanks in advance!
here is a snipet of my code
//get the the sprite index for each particles
srand( (unsigned)time( NULL ) );
CLongArray in_SpriteIndexArray; // collect index each particle
CLongArray in_AgeArray; // collect age
of each particle
ParticleCloudPrimitive in_CloudPrim(in_Cloud.GetActivePrimitive());
in_CloudPrim.GetAgeArray(in_AgeArray);
in_CloudPrim.GetSpriteIndexArray(io_SpriteIndexArray);
for(LONG i=0 ;i < io_SpriteIndexArray.GetCount(); i++)
{
//get a random number to start de sprite sequence
//between o and in_FrameCount
LONG oRandIndex = (double)(rand() / (double)RAND_MAX)*in_FrameCount;
if(in_AgeArray[i] == 0)
{
io_SpriteIndexArray[i] = oRandIndex; // give a random start
}
else
{
io_SpriteIndexArray[i] = io_SpriteIndexArray[i]+ in_AgeArray[i]; //increment with particle age
}
}
// output the value to cloud
in_CloudPrim.PutSpriteIndexArray(io_SpriteIndexArray);
Besoin d'un bon plan d'appel ? Appelez gratuitement de PC à PC Téléchargez Yahoo! Messenger.
- Follow-Ups:
- Re: particles sprite index
- From: Francois Lord <francoislord(at)gmail.com>
- Re: particles sprite index
| DATE: | << | >> | THREAD: | << | >> | INDEX: | Main | Thread |
|---|
- Previous by Date: Re: Get>Primitive>Polygonal Mesh>Lie E8
- Next by Date: Re: Get>Primitive>Polygonal Mesh>Lie E8
- Previous by Thread: Re: Get>Primitive>Polygonal Mesh>Lie E8
- Next by Thread: Re: Get>Primitive>Polygonal Mesh>Lie E8
- Index(es):
| Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available. |