本文整理汇总了C++中trpgWriteBuffer::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ trpgWriteBuffer::Add方法的具体用法?C++ trpgWriteBuffer::Add怎么用?C++ trpgWriteBuffer::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trpgWriteBuffer
的用法示例。
在下文中一共展示了trpgWriteBuffer::Add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Write
// Write function
bool trpgTextureEnv::Write(trpgWriteBuffer &buf)
{
if (!isValid())
return false;
buf.Begin(TRPGMAT_TEXENV);
buf.Begin(TRPGMAT_TXENV_MODE);
buf.Add(envMode);
buf.End();
buf.Begin(TRPGMAT_TXENV_FILTER);
buf.Add(minFilter);
buf.Add(magFilter);
buf.End();
buf.Begin(TRPGMAT_TXENV_WRAP);
buf.Add(wrapS);
buf.Add(wrapT);
buf.End();
buf.Begin(TRPGMAT_TXENV_BORDER);
buf.Add(borderCol);
buf.End();
buf.End();
return true;
}
示例2: Write
// Write tile table
bool trpgTileTable::Write(trpgWriteBuffer &buf)
{
if (!isValid())
return false;
buf.Begin(TRPGTILETABLE2);
// Write the mode
buf.Add(mode);
// Depending on the mode we'll have a lot or a little data
if (mode == Local || mode == ExternalSaved) {
// The lod sizing is redundant, but it's convenient here
int numLod = lodInfo.size();
buf.Add(numLod);
// Write each terrain LOD set
for (int i=0;i<numLod;i++) {
LodInfo &li = lodInfo[i];
if(localBlock) {
// only one x and one y in a local archive
buf.Add(1);
buf.Add(1);
// local blocks always use index 0
trpgwAppAddress &ref = li.addr[0];
buf.Add((int32)ref.file);
buf.Add((int32)ref.offset);
buf.Add(li.elev_min[0]);
buf.Add(li.elev_max[0]);
}
else {
buf.Add(li.numX);
buf.Add(li.numY);
// Now for the interesting stuff
unsigned int j;
for (j=0;j<li.addr.size();j++) {
trpgwAppAddress &ref = li.addr[j];
buf.Add((int32)ref.file);
buf.Add((int32)ref.offset);
}
for (j=0;j<li.elev_min.size();j++) {
buf.Add(li.elev_min[j]);
buf.Add(li.elev_max[j]);
}
}
}
}
buf.End();
return true;
}
示例3: Write
// Write method
bool trpgSupportStyle::Write(trpgWriteBuffer &buf)
{
buf.Begin(TRPG_SUPPORT_STYLE);
buf.Begin(TRPG_SUPPORT_STYLE_BASIC);
buf.Add(type);
buf.Add(matId);
buf.End();
buf.End();
return true;
}
示例4: Write
// Write model reference
bool trpgModelRef::Write(trpgWriteBuffer &buf)
{
if (!isValid())
return false;
buf.Begin(TRPG_MODELREF);
buf.Add(modelRef);
for (int i=0;i<4;i++)
for (int j=0;j<4;j++)
buf.Add(m[i][j]);
buf.End();
return true;
}
示例5: Write
// Writes this class to a write buffer
bool trpgLight::Write(trpgWriteBuffer &buf)
{
int numVertices = lightPoints.size();
if (!isValid())
return false;
buf.Begin(TRPGLIGHT);
buf.Add(index);
buf.Add(numVertices);
for (unsigned int i=0;i<lightPoints.size();i++)
buf.Add(lightPoints[i]);
buf.End();
return true;
}
示例6: Write
// Write out the model table
bool trpgModelTable::Write(trpgWriteBuffer &buf)
{
if (!isValid())
return false;
buf.Begin(TRPGMODELTABLE);
buf.Add((int32)modelsMap.size());
ModelMapType::iterator itr = modelsMap.begin();
for ( ; itr != modelsMap.end( ); itr++) {
itr->second.Write(buf);
}
buf.End();
return true;
}
示例7: Write
bool trpgRangeTable::Write(trpgWriteBuffer &buf)
{
if (!isValid())
return false;
buf.Begin(TRPGRANGETABLE);
buf.Add((int32)rangeMap.size());
RangeMapType::iterator itr = rangeMap.begin();
for ( ; itr != rangeMap.end( ); itr++) {
trpgRange &range = itr->second;
range.Write(buf);
}
buf.End();
return true;
}
示例8: Write
// Write geometry fields.
// Order doesn't matter very much for this
bool trpgGeometry::Write(trpgWriteBuffer &buf)
{
unsigned int i,j;
if (!isValid())
return false;
buf.Begin(TRPG_GEOMETRY);
/* Primitive info
Primitive Type
Number of primitives
Primitive array lengths
*/
buf.Begin(TRPG_GEOM_PRIM);
buf.Add(primType);
buf.Add(numPrim);
if (primLength.size() != 0) {
buf.Add((uint8)1);
for (i=0;i<(unsigned int)numPrim;i++)
buf.Add(primLength[i]);
} else
buf.Add((uint8)0);
buf.End();
/* Material info
Num materials
Material indicies
*/
if (materials.size() > 0) {
buf.Begin(TRPG_GEOM_MATERIAL);
buf.Add((int32)materials.size());
for (i=0;i<materials.size();i++)
buf.Add(materials[i]);
buf.End();
}
/* Vertices
Float and Double should never both be here
Num vertex
Vertex data
*/
if (vertDataFloat.size() > 0) {
buf.Begin(TRPG_GEOM_VERT32);
int32 num = vertDataFloat.size()/3;
buf.Add(num);
for (i=0;i<(unsigned int)3*num;i++)
buf.Add(vertDataFloat[i]);
buf.End();
}
if (vertDataDouble.size() > 0) {
buf.Begin(TRPG_GEOM_VERT64);
int32 num = vertDataDouble.size()/3;
buf.Add(num);
for (i=0;i<(unsigned int)3*num;i++)
buf.Add(vertDataDouble[i]);
buf.End();
}
/* Normals
Normal binding
Num normals
Normal data
*/
if (normDataFloat.size() > 0) {
buf.Begin(TRPG_GEOM_NORM32);
buf.Add((int32)normBind);
int32 num = normDataFloat.size()/3;
buf.Add(num);
for (i=0;i<(unsigned int)3*num;i++)
buf.Add(normDataFloat[i]);
buf.End();
}
if (normDataDouble.size() > 0) {
buf.Begin(TRPG_GEOM_NORM64);
buf.Add((int32)normBind);
int32 num = normDataDouble.size()/3;
buf.Add(num);
for (i=0;i<(unsigned int)3*num;i++)
buf.Add(normDataDouble[i]);
buf.End();
}
/* Colors
Color binding
Num colors
Colors
*/
if (colors.size() > 0) {
for (i=0;i<colors.size();i++) {
trpgColorInfo &ci = colors[i];
if (ci.data.size()) {
buf.Begin(TRPG_GEOM_COLOR);
buf.Add((int32)ci.type);
buf.Add((int32)ci.bind);
buf.Add((int32)ci.data.size());
for (j=0;j<ci.data.size();j++)
buf.Add(ci.data[j]);
buf.End();
//.........这里部分代码省略.........
示例9: Write
// Write out to a buffer
bool trpgHeader::Write(trpgWriteBuffer &buf)
{
if (!isValid())
return false;
buf.Begin(TRPGHEADER);
buf.Add((int32)verMajor);
buf.Add((int32)verMinor);
buf.Add((int32)dbVerMajor);
buf.Add((int32)dbVerMinor);
buf.Add(origin);
buf.Add(sw);
buf.Add(ne);
buf.Add((uint8)tileType);
buf.Add((int32)numLods);
buf.Begin(TRPGHEAD_LODINFO);
for (int i=0;i<numLods;i++) {
buf.Add(lodSizes[i]);
buf.Add(lodRanges[i]);
buf.Add(tileSize[i]);
}
buf.End();
buf.Add(maxGroupID);
if((verMajor >= TRPG_NOMERGE_VERSION_MAJOR) && (verMinor >=TRPG_NOMERGE_VERSION_MINOR)) {
buf.Add(flags);
buf.Add(rows);
buf.Add(cols);
}
buf.End();
return true;
}