Beispiel #1
0
void afxGuiTextData::initPersistFields()
{
  addField("text",    TypeString,     myOffset(text_str),
    "The literal text to display on the afxGuiTextHud. The center of the text will be "
    "placed at the projection of the 3D constraint position into 2D screen space.\n"
    "If the text field is set to the special string, '#shapeName', the shape name of the "
    "primary position constraint object will be used. (This is only meaningful if the "
    "constraint source is a ShapeBase-derived object.)");
  addField("color",   TypeColorF,     myOffset(text_clr),
    "A color value for the text label.");

  Parent::initPersistFields();
}
Beispiel #2
0
void afxForceData::initPersistFields()
{
  addField("forceSetName",    TypeString,   myOffset(force_set_name),
    "...");

  Parent::initPersistFields();
}
Beispiel #3
0
// -----------------------------------------------------------------------
bool MyCloth::generateObjMeshDesc(NxClothMeshDesc &desc, char *filename, NxReal scale, NxVec3* offset, bool textured)
{
	WavefrontObj wo;
	wo.loadObj(filename, textured);
	if (wo.mVertexCount == 0) return false;

	NxVec3 myOffset(0.f);
	if (offset != NULL)
		myOffset = *offset;

	desc.numVertices				= wo.mVertexCount;
	desc.numTriangles				= wo.mTriCount;
	desc.pointStrideBytes			= sizeof(NxVec3);
	desc.triangleStrideBytes		= 3*sizeof(NxU32);
	desc.vertexMassStrideBytes		= sizeof(NxReal);
	desc.vertexFlagStrideBytes		= sizeof(NxU32);
	desc.points						= (NxVec3*)malloc(sizeof(NxVec3)*desc.numVertices);
	desc.triangles					= (NxU32*)malloc(sizeof(NxU32)*desc.numTriangles*3);
	desc.vertexMasses				= 0;
	desc.vertexFlags				= 0;
	desc.flags						= NX_CLOTH_MESH_WELD_VERTICES;
	desc.weldingDistance			= 0.0001f;
	//desc.numHierarchyLevels         = 3; //no idea what is best here

	mMaxVertices = wo.mVertexCount;
	mMaxIndices  = 3 * wo.mTriCount;

	// copy positions and indices
	NxVec3 *vSrc = (NxVec3*)wo.mVertices;
	NxVec3 *vDest = (NxVec3*)desc.points;
	for (int i = 0; i < wo.mVertexCount; i++, vDest++, vSrc++) 
		*vDest = (*vSrc)*scale + myOffset;
	memcpy((NxU32*)desc.triangles, wo.mIndices, sizeof(NxU32)*desc.numTriangles*3);

	if (textured)
	{
		mNumTempTexCoords = desc.numVertices;
		mTempTexCoords = (GLfloat *)malloc(sizeof(GLfloat) * mNumTempTexCoords * 2);
		memcpy((NxU32*)mTempTexCoords, wo.mTexCoords, sizeof(GLfloat)*mNumTempTexCoords*2);

		mIndexRenderBuffer = (NxU32*)malloc(sizeof(NxU32) * mMaxIndices);
		memset(mIndexRenderBuffer, 0, sizeof(NxU32) * mMaxIndices);
		for (NxU32 i = 0; i < desc.numTriangles; i++)
		{
			assert((desc.flags & NX_CF_16_BIT_INDICES) == 0);
			NxU32* tri = (NxU32*)(((char*)desc.triangles) + (desc.triangleStrideBytes * i));
			mIndexRenderBuffer[3*i+0] = tri[0];
			mIndexRenderBuffer[3*i+1] = tri[1];
			mIndexRenderBuffer[3*i+2] = tri[2];
		}
	}
	else
	{
		mNumTempTexCoords = 0;
		mTempTexCoords = NULL;
	}

	return true;
}
Beispiel #4
0
void afxMooringData::initPersistFields()
{
  addField("displayAxisMarker",   TypeBool,     myOffset(display_axis_marker),
    "Specifies whether to display an axis to help visualize the position and orientation "
    "of the mooring.");
  addField("trackPosOnly",        TypeBool,     myOffset(track_pos_only),
    "This field is only meaningful for networking settings of SCOPE_ALWAYS and GHOSTABLE. "
    "In these cases, client moorings are ghosting a mooring on the server, and "
    "trackPosOnly determines if the client moorings need to be updated with the server "
    "mooring's complete transform or just its position. If only the position needs to be "
    "tracked, setting trackPosOnly to true will reduce the network traffic.");
  addField("networking",          TypeS8,       myOffset(networking),
    "Specifies the networking model used for the mooring and should be one of: "
    "$AFX::SCOPE_ALWAYS, $AFX::GHOSTABLE, $AFX::SERVER_ONLY, or $AFX::CLIENT_ONLY");

  Parent::initPersistFields();
}