Пример #1
0
std::string Plane::SerializeToString() const
{
	char str[256];
	char *s = SerializeFloat(normal.x, str); *s = ','; ++s;
	s = SerializeFloat(normal.y, s); *s = ','; ++s;
	s = SerializeFloat(normal.z, s); *s = ','; ++s;
	s = SerializeFloat(d, s);
	assert(s+1 - str < 256);
	MARK_UNUSED(s);
	return str;
}
Пример #2
0
std::string Sphere::SerializeToString() const
{
	char str[256];
	char *s = SerializeFloat(pos.x, str); *s = ','; ++s;
	s = SerializeFloat(pos.y, s); *s = ','; ++s;
	s = SerializeFloat(pos.z, s); *s = ','; ++s;
	s = SerializeFloat(r, s);
	assert(s+1 - str < 256);
	MARK_UNUSED(s);
	return str;
}
Пример #3
0
std::string MUST_USE_RESULT Quat::SerializeToString() const
{
	char str[256];
	char *s = SerializeFloat(x, str); *s = ','; ++s;
	s = SerializeFloat(y, s); *s = ','; ++s;
	s = SerializeFloat(z, s); *s = ','; ++s;
	s = SerializeFloat(w, s);
	assert(s+1 - str < 256);
	MARK_UNUSED(s);
	return str;
}
Пример #4
0
void SerializePhysicsInfo(XFILE *fp, int mode, physics_info *pi)
{
	SerializeFloat(fp, mode, pi->mass);
	SerializeFloat(fp, mode, pi->drag);
	SerializeVector(fp, mode, &pi->max_thrust);
	SerializeVector(fp, mode, &pi->max_rotthrust);
	SerializeFloat(fp, mode, pi->turnroll);
	SerializeInt(fp, mode, pi->flags);
	SerializeVector(fp, mode, &pi->velocity);
	SerializeVector(fp, mode, &pi->rotvel);
	SerializeVector(fp, mode, &pi->thrust);
	SerializeVector(fp, mode, &pi->rotthrust);
}
Пример #5
0
void SerializeGrid(XFILE *fp, int mode, grid *gridp)
{
	int	i;

	SerializeInt(fp, mode, gridp->nrows);
	SerializeInt(fp, mode, gridp->ncols);
	SerializeMatrix(fp, mode, &gridp->gmatrix);
	SerializePhysicsInfo(fp, mode, &gridp->physics);
	SerializeFloat(fp, mode, gridp->square_size);
	SerializeFloat(fp, mode, gridp->planeD);
	
	for (i=0; i<MAX_GRID_POINTS; i++)
		SerializeVector(fp, mode, &gridp->gpoints[i]);

}
Пример #6
0
	Uint64 GetSerializedFloatSize(double data)
	{
		Byte* p = nullptr;
		Uint64 size = SerializeFloat(data, p);
		if (p != nullptr) delete p;
		return size;
	}
Пример #7
0
static void SerializeFloats( CUtlBuffer &buf, int nCount, const float *pFloats )
{
	for ( int i = 0; i < nCount; ++i )
	{
		SerializeFloat( buf, pFloats[i] );
		if ( i != nCount-1 )
		{
			buf.PutChar( ' ' );
		}
	}
}
Пример #8
0
bool Serialize( CUtlBuffer &buf, const float &src )
{
	if ( buf.IsText() )
	{
		SerializeFloat( buf, src );
	}
	else
	{
		buf.PutFloat( src );
	}
	return buf.IsValid();
}
Пример #9
0
bool WriteEbmlElement(IMkvWriter* writer, uint64 type, float value) {
    if (!writer)
        return false;

    if (WriteID(writer, type))
        return false;

    if (WriteUInt(writer, 4))
        return false;

    if (SerializeFloat(writer, value))
        return false;

    return true;
}
Пример #10
0
/////////////////////////////////////////////////////////////////////////////
// CFREDDoc serialization
void SerializeObject(XFILE *fp, int mode, object *objp)
{
	SerializeInt(fp, mode, objp->signature);
	SerializeInt(fp, mode, objp->type);
	SerializeInt(fp, mode, objp->parent);
	SerializeInt(fp, mode, objp->parent_sig);
	SerializeInt(fp, mode, objp->parent_type);
	SerializeInt(fp, mode, objp->instance);
	SerializeInt(fp, mode, objp->flags);
	SerializeFloat(fp, mode, objp->radius);
//	SerializeInt(fp, mode, objp->wing);
	SerializePhysicsInfo(fp, mode, &objp->phys_info);
	SerializeVector(fp, mode, &objp->pos);
	SerializeMatrix(fp, mode, &objp->orient);
}
Пример #11
0
/////////////////////////////////////////////////////////////////////////////
// CFREDDoc serialization
void SerializeObject(XFILE *fp, int mode, object *objp)
{
	SerializeInt(fp, mode, objp->signature);
	SerializeInt(fp, mode, objp->type);
	SerializeInt(fp, mode, objp->parent);
	SerializeInt(fp, mode, objp->parent_sig);
	SerializeInt(fp, mode, objp->parent_type);
	SerializeInt(fp, mode, objp->instance);
	SerializeInt(fp, mode, objp->flags);
	SerializeInt(fp, mode, objp->flags2);	// Goober5000 - code is obsolete, but I added this just in case
	SerializeFloat(fp, mode, objp->radius);
//	SerializeInt(fp, mode, objp->wing);
	SerializePhysicsInfo(fp, mode, &objp->phys_info);
	SerializeVector(fp, mode, &objp->pos);
	SerializeMatrix(fp, mode, &objp->orient);
}
Пример #12
0
std::string AABB::SerializeToString() const
{
	char str[256];
	char *s = SerializeFloat(minPoint.x, str); *s = ','; ++s;
	s = SerializeFloat(minPoint.y, s); *s = ','; ++s;
	s = SerializeFloat(minPoint.z, s); *s = ','; ++s;
	s = SerializeFloat(maxPoint.x, s); *s = ','; ++s;
	s = SerializeFloat(maxPoint.y, s); *s = ','; ++s;
	s = SerializeFloat(maxPoint.z, s);
	assert(s+1 - str < 256);
	MARK_UNUSED(s);
	return str;
}
Пример #13
0
void SerializeVector(XFILE *fp, int mode, vector *v)
{
	SerializeFloat(fp, mode, v->x);
	SerializeFloat(fp, mode, v->y);
	SerializeFloat(fp, mode, v->z);
}
Пример #14
0
std::string float3x4::SerializeToString() const
{
	char str[512];
	char *s = SerializeFloat(v[0][0], str); *s = ','; ++s;
	s = SerializeFloat(v[0][1], s); *s = ','; ++s;
	s = SerializeFloat(v[0][2], s); *s = ','; ++s;
	s = SerializeFloat(v[0][3], s); *s = ','; ++s;
	s = SerializeFloat(v[1][0], s); *s = ','; ++s;
	s = SerializeFloat(v[1][1], s); *s = ','; ++s;
	s = SerializeFloat(v[1][2], s); *s = ','; ++s;
	s = SerializeFloat(v[1][3], s); *s = ','; ++s;
	s = SerializeFloat(v[2][0], s); *s = ','; ++s;
	s = SerializeFloat(v[2][1], s); *s = ','; ++s;
	s = SerializeFloat(v[2][2], s); *s = ','; ++s;
	s = SerializeFloat(v[2][3], s);
	assert(s+1 - str < 512);
	MARK_UNUSED(s);
	return str;
}