Scott McMillan (scott++at++ht.com)
Fri, 25 Jul 1997 18:17:19 -0400 (EDT)
Lemme try and take a stab at this and then some:
line 132: allocate pfCycleBuffer data
Note: just enough space for a packed array of nSph color vectors.
cbuf = new(arena) pfCycleBuffer(nSph * sizeof(pfVec4));
line 137: Get a handle to the data buffer:
Note: I believe any time get data is called it gets a version
of the data appropriate to which process you are in (APP, CULL,
DRAW) and which pfMultiprocessing mode you are in (e.g.,
PFMP_APP_CULL_DRAW)
pfVec4 *colors = (pfVec4*) cbuf->getData();
Again in answer to one of your questions this returns a POINTER
to the buffer that was allocated in line 132. You still need to
set the data as below.
line 159-160: Set the colors and hence the cbuf data:
colors[i].set(0.0f, 0.0f, 0.0f, 1.0f);
colors[i][max] = 1.0f;
line 178:. Initialize all the other CycleBuffer copies of this buffer:
/* Set all pfCycleMemories to the same colors */
cbuf->init(cbuf->getData());
line 180: Associate this cycle buffer data with the color data of the
pfGeoSet:
gset->setAttr(PFGS_COLOR4, PFGS_PER_VERTEX,
(void*)cbuf, NULL);
Now you can change your color in the APP process as shown in the
breatheMorphe function:
colors = (pfVec4*) cbuf->getData();
for (int i=0; i<nSph; i++)
colors[i][0] = s;
cbuf->changed();
And these changes will get propagated down the pipeline AUTOMAGICALLY by
the pfCycleBuffer, and if I understand this correctly... when the draw
process comes along to render the pfGeoSet and accesses the color
information. The pfCycleBuffer will feed it a pointer to the "correct"
data.
Hope this is right,
scott
--
Scott McMillan | HT Medical, Inc. | Developing medical VE's
scott++at++ht.com | http://www.ht.com | surgical simulations
Ph: 301-984-3706 |6001 Montrose Rd., #902| and surgery simulation
Fax: 301-984-2104 | Rockville, MD 20852 | creation tools.
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:39 PDT