本文整理汇总了C++中ReadFloat函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadFloat函数的具体用法?C++ ReadFloat怎么用?C++ ReadFloat使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReadFloat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadUInt
void KfmEvent::Read( istream & in, unsigned int version ) {
id = ReadUInt(in);
type = ReadUInt(in);
if ( type != 5 ) {
unk_float = ReadFloat(in);
event_strings.resize(ReadUInt(in));
for ( vector<KfmEventString>::iterator it = event_strings.begin(); it != event_strings.end(); it++ ) it->Read(in, version);
unk_int3 = ReadUInt(in);
};
};
示例2: ASSERT
void Serializer::InitForReading(void *data, int data_size)
{
ASSERT(mode==SERIALIZE_NONE);
mode=SERIALIZE_READ;
buffer=data;
buffer_size=data_size;
ReadFloat(ver); //shrugs
}
示例3: ProcessTriangles
static void ProcessTriangles()
{
int numvertices;
float x, y, z;
numvertices = ReadInt();
glBegin(GL_TRIANGLES);
while (numvertices)
{
x = ReadFloat();
y = ReadFloat();
z = ReadFloat();
glVertex3f(x, y, z);
numvertices--;
}
glEnd();
}
示例4: readTeleopForwards
float readTeleopForwards()
{
TFileHandle hFileHandle;
TFileIOResult nIoResult;
float result=0;
short nFileSize=sizeof(baseHeading);
OpenRead(hFileHandle, nIoResult, TELEOPFORWARDSDAT, nFileSize);
ReadFloat(hFileHandle, nIoResult, result);
Close(hFileHandle, nIoResult);
return result;
}
示例5: ReadType
//-----------------------------------------------------------------------------------------------
Vector2 ResourceStream::ReadVector2()
{
Vector2 returnValue;
if( m_internalFormat == RESOURCE_STREAM_FORMAT_BINARY )
{
ReadType( returnValue );
// DEBUGGING - { int q = 5; } //ConsolePrintf( "ReadVector2 at offset %d, value was (%g,%g)\n", m_currentReadOffset, returnValue.x, returnValue.y );
return returnValue;
}
ReadExpectedToken( "Vector2" );
ReadExpectedToken( '(' );
returnValue.x = ReadFloat();
ReadExpectedToken( ',' );
returnValue.y = ReadFloat();
ReadExpectedToken( ')' );
return returnValue;
}
示例6: ReadInt
/// Read SMFHeader head from file
void CSMFMapFile::ReadMapHeader(SMFHeader& head, CFileHandler& file)
{
file.Read(head.magic,sizeof(head.magic));
head.version = ReadInt(file);
head.mapid = ReadInt(file);
head.mapx = ReadInt(file);
head.mapy = ReadInt(file);
head.squareSize = ReadInt(file);
head.texelPerSquare = ReadInt(file);
head.tilesize = ReadInt(file);
head.minHeight = ReadFloat(file);
head.maxHeight = ReadFloat(file);
head.heightmapPtr = ReadInt(file);
head.typeMapPtr = ReadInt(file);
head.tilesPtr = ReadInt(file);
head.minimapPtr = ReadInt(file);
head.metalmapPtr = ReadInt(file);
head.featurePtr = ReadInt(file);
head.numExtraHeaders = ReadInt(file);
}
示例7: ReadInt
/*
===================
idRestoreGame::ReadContactInfo
===================
*/
void idRestoreGame::ReadContactInfo( contactInfo_t &contactInfo ) {
ReadInt( (int &)contactInfo.type );
ReadVec3( contactInfo.point );
ReadVec3( contactInfo.normal );
ReadFloat( contactInfo.dist );
ReadInt( contactInfo.contents );
ReadMaterial( contactInfo.material );
ReadInt( contactInfo.modelFeature );
ReadInt( contactInfo.trmFeature );
ReadInt( contactInfo.entityNum );
ReadInt( contactInfo.id );
}
示例8: ReadPoint
/******************************************************************************
* read point information and load it
* point information will be read as x,y,z float coordinates
*****************************************************************************/
int ReadPoint(point *p)
{
if (!ReadFloat(&p->x))
{
PrintError("Number expected");
return 0;
}
SkipWhitespace();
if (!ReadFloat(&p->y))
{
PrintError("Number expected");
return 0;
}
SkipWhitespace();
if (!ReadFloat(&p->z))
{
PrintError("Number expected");
return 0;
}
return 1;
}
示例9: GotoChunk
void L3DS::ReadMap(const LChunk &chunk, LMap& map)
{
LChunk child;
char str[20];
GotoChunk(chunk);
child = ReadChunk();
while (child.end <= chunk.end)
{
switch (child.id)
{
case INT_PERCENTAGE:
map.strength = ReadPercentage(child);
break;
case MAT_MAPNAME:
ReadASCIIZ(str, 20);
strcpy(map.mapName, str);
break;
case MAT_MAP_TILING:
map.tiling = ReadShort();
break;
case MAT_MAP_USCALE:
map.uScale = ReadFloat();
break;
case MAT_MAP_VSCALE:
map.vScale = ReadFloat();
break;
case MAT_MAP_UOFFSET:
map.uOffset = ReadFloat();
break;
case MAT_MAP_VOFFSET:
map.vOffset = ReadFloat();
break;
case MAT_MAP_ANG:
map.angle = ReadFloat();
break;
}
SkipChunk(child);
child = ReadChunk();
}
}
示例10: ReadFloat
void VFSPlugin_LWO::read_diff(long length)
{
// Get a ptr to the last surface (hence the current one)
Material *m = m_vb->GetMaterial();
// Read the diffuse value
m->diffuse = ReadFloat();
// Read the envelope
long vxlength;
long envelope = ReadVariableLength(&vxlength);
length -= (vxlength + sizeof(float)*3);
}
示例11: if
//---------------------------------------------------------------------
// Read all parameters
//---------------------------------------------------------------------
int CNeedleMark::Read(SStream *stream, Tag tag)
{ if (0 == mgg) gtfo("<CNeedleMark: need mother gauge");
switch (tag) {
case 'bmap':
nedl.SetGauge(mgg);
nedl.ReadBMAP(stream);
return TAG_READ;
//--- rotation center --------------
case 'rotc':
nedl.ReadROTC(stream);
return TAG_READ;
//--- minimum value ----------------
case 'dmin':
ReadFloat(&dmin, stream);
return TAG_READ;
//--- maximum value ----------------
case 'dmax':
ReadFloat(&dmax, stream);
return TAG_READ;
//--- Clamp values -----------------
case 'clmp':
ReadFloat(&dmin,stream);
ReadFloat(&dmax,stream);
return TAG_READ;
//--- Current value ----------------
case 'sang':
case 'dval':
ReadFloat(&dval,stream);
SaveValue(dval);
return TAG_READ;
//--- Knob -------------------------
case 'knob':
ReadKNOB(stream);
return TAG_READ;
}
WARNINGLOG("CNeedleMark: tag %s unknowned",TagToString(tag));
return TAG_IGNORED;
}
示例12: ReadModel
/*
================
idRestoreGame::ReadRenderEntity
================
*/
void idRestoreGame::ReadRenderEntity( renderEntity_t &renderEntity ) {
int i;
int index;
ReadModel( renderEntity.hModel );
ReadInt( renderEntity.entityNum );
ReadInt( renderEntity.bodyId );
ReadBounds( renderEntity.bounds );
// callback is set by class's Restore function
renderEntity.callback = NULL;
renderEntity.callbackData = NULL;
ReadInt( renderEntity.suppressSurfaceInViewID );
ReadInt( renderEntity.suppressShadowInViewID );
ReadInt( renderEntity.suppressShadowInLightID );
ReadInt( renderEntity.allowSurfaceInViewID );
ReadVec3( renderEntity.origin );
ReadMat3( renderEntity.axis );
ReadMaterial( renderEntity.customShader );
ReadMaterial( renderEntity.referenceShader );
ReadSkin( renderEntity.customSkin );
ReadInt( index );
renderEntity.referenceSound = gameSoundWorld->EmitterForIndex( index );
for( i = 0; i < MAX_ENTITY_SHADER_PARMS; i++ ) {
ReadFloat( renderEntity.shaderParms[ i ] );
}
for( i = 0; i < MAX_RENDERENTITY_GUI; i++ ) {
ReadUserInterface( renderEntity.gui[ i ] );
}
// idEntity will restore "cameraTarget", which will be used in idEntity::Present to restore the remoteRenderView
renderEntity.remoteRenderView = NULL;
renderEntity.joints = NULL;
renderEntity.numJoints = 0;
ReadFloat( renderEntity.modelDepthHack );
ReadBool( renderEntity.noSelfShadow );
ReadBool( renderEntity.noShadow );
ReadBool( renderEntity.noDynamicInteractions );
ReadBool( renderEntity.weaponDepthHack );
ReadInt( renderEntity.forceUpdate );
}
示例13: ParseColor
/*************
* DESCRIPTION: read a color
* INPUT: color pointer to color
* OUTPUT: -
*************/
static void ParseColor(HANDLER_DATA *data, COLOR *color)
{
CHUNK chunk;
UBYTE c[3];
BeginChunk(data, &chunk);
switch (chunk.id)
{
case ID_COLOR1:
ReadFloat(data, &color->r, 1);
ReadFloat(data, &color->g, 1);
ReadFloat(data, &color->b, 1);
break;
case ID_COLOR255:
ReadChunkBytes(data, &c, 3);
color->r = c[0]/255.0f;
color->g = c[1]/255.0f;
color->b = c[2]/255.0f;
break;
}
EndChunk(data, &chunk);
}
示例14: LoadStatsFile
/* EXPORT->LoadStatsFile: load the statistics file output by HERest */
void LoadStatsFile(char *statfile,HMMSet *hset,Boolean otrace)
{
Source src;
char hname[256];
int i,idx,count,N,lnum = 0;
float x;
HMMDef *hmm;
MLink ml;
LabId hmmId;
double occSum = 0.0;
long occN = 0;
StateInfo *si;
Boolean bin=FALSE;
if(InitSource(statfile,&src,NoFilter)<SUCCESS)
HError(7210,"LoadStatsFile: Can't open file %s", statfile);
while(ReadInt(&src,&idx,1,bin)) {
++lnum;
if (!ReadString(&src,hname) || !ReadInt(&src,&count,1,bin))
HError(7250,"LoadStatsFile: Format error in file %s line %d",
statfile,lnum);
/* look up hname and find num states N */
if ((hmmId = GetLabId(hname,FALSE))==NULL)
HError(7251,"LoadStatsFile: unknown name %s at line %d",
hname,lnum);
if ((ml = FindMacroName(hset,'l',hmmId))==NULL)
HError(7251,"LoadStatsFile: unknown model %s at line %d",
hname,lnum);
hmm = (HMMDef *) ml->structure;
N = hmm->numStates;
for (i=2; i<N; i++) {
if (!ReadFloat(&src,&x,1,bin))
HError(7250,"LoadStatsFile: Float format error file %s line %d\n",
statfile,lnum);
si = hmm->svec[i].info;
si->stateCounter = count;/* load the # of times the state occurred */
memcpy(&(si->hook),&x,sizeof(float)); /* !! */
occSum += x; ++occN;
}
}
CloseSource(&src);
if (otrace || (trace & T_OCC)) {
printf(" Stats loaded for %d models\n",lnum);
printf(" Mean Occupation Count = %f\n",occSum/occN);
fflush(stdout);
}
}
示例15: ReadMat3
/*
================
idRestoreGame::ReadRenderLight
================
*/
void idRestoreGame::ReadRenderLight( renderLight_t &renderLight ) {
int index;
int i;
ReadMat3( renderLight.axis );
ReadVec3( renderLight.origin );
ReadInt( renderLight.suppressLightInViewID );
ReadInt( renderLight.allowLightInViewID );
ReadBool( renderLight.noShadows );
ReadBool( renderLight.pointLight );
ReadBool( renderLight.parallel );
ReadVec3( renderLight.lightRadius );
ReadVec3( renderLight.lightCenter );
ReadVec3( renderLight.target );
ReadVec3( renderLight.right );
ReadVec3( renderLight.up );
ReadVec3( renderLight.start );
ReadVec3( renderLight.end );
ReadBool( renderLight.ambient ); // sikk - Ambient Light Flag
// ---> sikk - Ambient Light Color
ReadVec3( renderLight.ambColor_X_Neg );
ReadVec3( renderLight.ambColor_X_Pos );
ReadVec3( renderLight.ambColor_Y_Neg );
ReadVec3( renderLight.ambColor_Y_Pos );
ReadVec3( renderLight.ambColor_Z_Neg );
ReadVec3( renderLight.ambColor_Z_Pos );
// <--- sikk - Ambient Light Color
ReadVec3( renderLight.ambRotation ); // sikk - Ambient Light Rotation
// only idLight has a prelightModel and it's always based on the entityname, so we'll restore it there
// ReadModel( renderLight.prelightModel );
renderLight.prelightModel = NULL;
ReadInt( renderLight.lightId );
ReadMaterial( renderLight.shader );
for( i = 0; i < MAX_ENTITY_SHADER_PARMS; i++ ) {
ReadFloat( renderLight.shaderParms[ i ] );
}
ReadInt( index );
renderLight.referenceSound = gameSoundWorld->EmitterForIndex( index );
}