⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rl.h

📁 Windows上的MUD客户端程序
💻 H
📖 第 1 页 / 共 4 页
字号:
					   int vertex_count,
					   int normal_count,
					   int face_count);

/*
 * Set the values of the each normal in the mesh to the average of the
 * face normals of the faces which share the normal.
 */
RLError			RLMeshGenerateNormals(RLMesh mesh);

/*
 * Set all the faces in a mesh to the given colour.
 */
RLError			RLMeshSetColourRGB(RLMesh, RLValue, RLValue, RLValue);
RLError			RLMeshSetColour(RLMesh, RLColour);

/*
 * Set all the faces in a mesh to the given texture.
 */
RLError			RLMeshSetTexture(RLMesh, RLTexture);

/*
 * Set all the faces in a mesh to the given material.
 */
RLError			RLMeshSetMaterial(RLMesh, RLMaterial);

/*
 * Define the topological properties of the texture coordinates
 * across the mesh.  See also RLFaceSetTextureTopology.
 */
RLError RLMeshSetTextureTopology(RLMesh mesh, int wrap_u, int wrap_v);

/*
 * Set the rendering quality for a mesh.  The quality used for
 * rendering is the minimum of the device quality and the mesh
 * quality.  Default is RLRenderPhong.
 */
RLError			RLMeshSetQuality(RLMesh, RLRenderQuality);

/*
 * Get the rendering quality for a mesh.  Returns -1 on error.
 */
RLRenderQuality		RLMeshGetQuality(RLMesh);


/*
 * Set perspective correction flag for a mesh. Default is FALSE.
 */
RLError			RLMeshSetPerspective(RLMesh mesh, int perspective);

/*
 * Get perspective correction flag for a mesh.  Returns -1 on error.
 */
int			RLMeshGetPerspective(RLMesh mesh);

/*
 * Flags to say whether to relight the mesh every tick, to light just once,
 * or to never light.
 */
RLError			RLMeshSetLightingFrequency(RLMesh, RLLightingFrequency);
RLLightingFrequency	RLMeshGetLightingFrequency(RLMesh);


/*
 * Scale a mesh.
 */
RLError			RLMeshScale(RLMesh,
				    RLValue sx,
				    RLValue sy,
				    RLValue sz);

/*
 * Translate a mesh
 */
RLError                 RLMeshTranslate(RLObject id,
					RLValue tx, 
					RLValue ty, 
					RLValue tz);

/*
 * Find the frame which owns this mesh (if any).
 */
RLFrame			RLMeshGetFrame(RLMesh);

/*
 * Find a bounding box for the mesh.
 */
RLError			RLMeshGetBox(RLMesh, RLBox*);

/*
 * Get a list of the faces in the mesh.  Sets *face_count to the
 * number of faces in the mesh and *faces to point to a list of the
 * faces.  The memory returned in *faces must be freed with RLFree.
 */
RLError			RLMeshGetFaces(RLMesh,
				       int* face_count,
				       RLFace** faces);

/*
 * Return the number of faces in the mesh.
 */
int RLMeshGetFaceCount(RLMesh id);

/*
 * Get a list of the vertices and normals which makes up the faces of the
 * mesh.  The memory returned in *vertices, *normals and *face_data
 * must be freed with RLFree.  The data returned in *face_data is in
 * the same format as that taken by RLMeshAddFaces.
 */
RLError			RLMeshGetVertices(RLMesh,
					  int* vertex_count,
					  RLVector** vertices,
					  int* normal_count,
					  RLVector** normals,
					  int** face_data);

/*
 * Return the number of vertices in the mesh.
 */
int			RLMeshGetVertexCount(RLMesh);

/* 
 * Set the coordinates for a vertex in the mesh.
 */
RLError			RLMeshSetVertex(RLMesh, int which,
					RLValue x, RLValue y, RLValue z);

/* 
 * Set the value of a normal vector in the mesh.
 */
RLError			RLMeshSetNormal(RLMesh, int which,
					RLValue x, RLValue y, RLValue z);

/* 
 * Set the texture coordinates for a vertex in the mesh.
 */
RLError			RLMeshSetTextureCoordinates(RLMesh, int which,
						    RLValue u, RLValue v);

/*
 * Get the texture coordinates for a vertex in the mesh.
 */
RLError			RLMeshGetTextureCoordinates(RLMesh id, int which,
						    RLValue* u, RLValue* v);
typedef enum _RLColourSource {
    RLColourFromFace,
    RLColourFromVertex
} RLColourSource;

/*
 * Set the colour of a vertex to be used if the mesh's colour source
 * is set to RLColourFromVertex.  Default is white.
 */
RLError			RLMeshSetVertexColour(RLMesh id, int which,
					      RLColour colour);
RLError			RLMeshSetVertexColourRGB(RLMesh id, int which,
						 RLValue red,
						 RLValue green,
						 RLValue blue);

/*
 * Get the colour of a vertex.
 */
RLColour		RLMeshGetVertexColour(RLMesh id, int which);


/*
 * Choose whether to take colours from faces or vertices when
 * rendering a mesh.  Default is to use the face colours.
 */
RLError			RLMeshSetColourSource(RLMesh id,
					      RLColourSource source);

/*
 * Return the current colour source for the mesh.
 */
RLColourSource		RLMeshGetColourSource(RLMesh id);

/*
 * Create a new light with the given type and colour.
 */
RLLight			RLCreateLightRGB(RLLightType, RLValue, RLValue, RLValue);
RLLight			RLCreateLight(RLLightType, RLColour);

/*
 * Change the type of a light.
 */
RLError			RLLightSetType(RLLight, RLLightType);

/*
 * Get the type of a light.  Returns -1 on error.
 */
RLLightType		RLLightGetType(RLLight);

/*
 * Change the colour of a light.
 */
RLError			RLLightSetColourRGB(RLLight, RLValue, RLValue, RLValue);
RLError			RLLightSetColour(RLLight, RLColour);

/*
 * Get the colour of a light.  Returns -1 on error.
 */
RLColour		RLLightGetColour(RLLight);

/*
 * Set the range of a spotlight.  Only objects within the range are
 * affected by the light.  The default value is 256.
 */
RLError			RLLightSetRange(RLLight, RLValue);

/*
 * Get the range of a spotlight.  Returns -1 on error.
 */
RLValue			RLLightGetRange(RLLight);

/*
 * The beam of a spotlight has two parts: the umbra and the penumbra.
 * Within the umbra, the spotlight acts as a point source.  Within the
 * penumbra, the spotlight intensity falls off to zero.  This sets the
 * angle of the umbra cone.  Setting the umbra angle to greater than
 * the penumbra increases the penumbra to the new umbra angle.  The
 * default value is 0.4 radians.
 */
RLError			RLLightSetUmbra(RLLight, RLValue);

/*
 * Get the umbra angle of a spotlight.  Returns -1 on error.
 */
RLValue			RLLightGetUmbra(RLLight);

/*
 * Set the angle of the penumbra cone.  Must be greater than or equal
 * to the umbra.  Setting the penumbra angle to less than the umbra
 * contracts the umbra to the new angle for the penumbra. The default
 * value is 0.5 radians.
 */
RLError			RLLightSetPenumbra(RLLight, RLValue);

/*
 * Get the penumbra angle of a spotlight.  Returns -1 on error.
 */
RLValue			RLLightGetPenumbra(RLLight);

/*
 * Set the constant attenuation factor for a light.
 */
RLError			RLLightSetConstantAttenuation(RLLight id,
						      RLValue value);
/*
 * Get the constant attenuation factor for a light.
 */
RLValue			RLLightGetConstantAttenuation(RLLight id);

/*
 * Set the linear attenuation factor for a light.
 */
RLError			RLLightSetLinearAttenuation(RLLight id,
						    RLValue value);

/*
 * Get the linear attenuation factor for a light.
 */
RLValue			RLLightGetLinearAttenuation(RLLight id);

/*
 * Set the quadratic attenuation factor for a light.
 */
RLError			RLLightSetQuadraticAttenuation(RLLight id,
						       RLValue value);
/*
 * Get the quadratic attenuation factor for a light.
 */
RLValue			RLLightGetQuadraticAttenuation(RLLight id);

/*
 * Create a frame of reference relative to a parent reference frame.
 * To create the master reference frame, specify NULL for the parent.
 */
RLFrame			RLCreateFrame(RLFrame parent);

/*
 * Apply the rotations and velocity for all frames in a hierarchy.
 */
RLError			RLFrameMove(RLFrame frame);

/*
 * Add a function to be called to move a frame in an animation.  The
 * function is called before the velocity and rotation of the frame
 * are applied, so changes to the velocity and rotation made by the
 * function will be reflected in the frame's motion.
 */
RLError			RLFrameAddCallback(RLFrame frame,
					   RLFrameCallback fn,
					   void* arg);

/*
 * Remove a function previously registered with RLFrameAddCallback.
 */
RLError			RLFrameRemoveCallback(RLFrame frame,
					      RLFrameCallback fn,
					      void* arg);

/*
 * Add a child frame to a frame.  If the child already has a parent,
 * it is removed from its current parent first.  The location and
 * orientation of the child in the scene are unchanged.
 */ 
RLError			RLFrameAddChild(RLFrame, RLFrame);

/*
 * Remove a child frame from a frame.  If there are no other
 * references to the child, it will be destroyed along with any child
 * frames, meshes and lights that it might have.
 */
RLError			RLFrameRemoveChild(RLFrame, RLFrame);

/*
 * Put an object into a frame.
 * The object added to the frame is then referenced by the frame. 
 * If the frame is destroyed the object will be destroyed as well, 
 * providing it has no other references.
 */
RLError			RLFrameAddVisual(RLFrame, RLVisual);
RLError			RLFrameAddLight(RLFrame, RLLight);

/*
 * Remove an object from a frame.  If there are no other references to
 * the object, it will be destroyed.
 */
RLError			RLFrameRemoveVisual(RLFrame, RLVisual);
RLError			RLFrameRemoveLight(RLFrame, RLLight);

/*
 * Build a mesh which is the union of all meshes in this frame and
 * all meshes in child frames of this frame.  Returns NULL on error.
 */
RLMesh			RLFrameBuildMesh(RLFrame);

/* 
 * Set frame position within the scene in the frame of reference.  If 
 * reference is NULL, position is relative to the root frame.
 */
RLError			RLFrameSetPosition(RLFrame frame,
					   RLFrame reference,
					   RLValue x,
					   RLValue y,
					   RLValue z);

/* 
 * Face the frame along the given vector.
 */
RLError			RLFrameSetOrientation(RLFrame frame,
					      RLFrame reference,
					      RLValue dx, /* direction */
					      RLValue dy,
					      RLValue dz,
					      RLValue ux, /* up */
					      RLValue uy,
					      RLValue uz);

typedef enum _RLFrameConstraint {
    RLConstrainZ,		/* use only X and Y rotations */
    RLConstrainY,		/* use only X and Z rotations */
    RLConstrainX		/* use only Y and Z rotations */
} RLFrameConstraint;

/*
 * Face the frame towards the target frame, relative to the given
 * reference frame, constraining the rotation by the given constraints.
 */
RLError			RLFrameLookAt(RLFrame frame, RLFrame target,
				      RLFrame reference,
				      RLFrameConstraint constraint);
/*
 * Move the frame linearly along the given vector at each call to
 * RLTick().
 */
RLError			RLFrameSetVelocity(RLFrame frame,
					   RLFrame reference,
					   RLValue x,
					   RLValue y,
					   RLValue z);

/*
 * Rotate the frame by theta about the axis given by (x, y, z)
 * relative to reference at each call to RLTick().
 */
RLError			RLFrameSetRotation(RLFrame frame,
					   RLFrame reference,
					   RLValue x,
					   RLValue y,
					   RLValue z,
					   RLValue theta);

/*
 * The following functions modify the frame's local transformation
 * directly.  A transform can be premultiplied by, can replace or can
 * be postmultiplied by the current local transformation.
 */

/*
 * Transform the local coordinates of the frame to the given affine
 * transform according to the value of combine.
 * Note that although a 4x4 matrix is given, the last column must be
 * transpose([0 0 0 1]) for the transform to be affine.
 */
RLError			RLFrameAddTransform(RLFrame frame,
					    RLCombineType combine,
					    RLMatrix4d matrix);

/*
 * Scale a frame by (sx, sy, sz).
 */
RLError			RLFrameAddScale(RLFrame id, RLCombineType combine,
					RLValue sx, RLValue sy, RLValue sz);

/*
 * Rotate a frame about (x, y, z) by theta radians.
 */
RLError			RLFrameAddRotation(RLFrame id, RLCombineType combine,
					   RLValue x, RLValue y, RLValue z,
					   RLValue theta);

/*
 * Translate a frame by (x, y, z).
 */
RLError			RLFrameAddTranslation(RLFrame id,
					      RLCombineType combine,
					      RLValue x, RLValue y, RLValue z);

/*
 * Get the root frame of a hierarchy.
 */
RLFrame			RLFrameGetScene(RLFrame frame);

/*
 * Get the local transform of the frame.
 */
RLError			RLFrameGetTransform(RLFrame frame,
					    RLMatrix4d matrix);

/*
 * Get the position of the frame relative to the given reference frame.
 */
RLError			RLFrameGetPosition(RLFrame frame,
					   RLFrame reference,
					   RLVector* position);

/*
 * Get the velocity of the frame relative to the given reference frame.
 */
RLError			RLFrameGetVelocity(RLFrame frame,
					   RLFrame reference,
					   RLVector* velocity);

/*
 * Get the rotation of the frame relative to the given reference frame.
 */
RLError 		RLFrameGetRotation(RLFrame frame,
					   RLFrame reference,
			   		   RLVector* axis,
					   RLValue* theta);

/*
 * Get the orientation of the frame, relative to the given reference frame.
 */
RLError			RLFrameGetOrientation(RLFrame frame,
					      RLFrame reference,
					      RLVector* dir,
					      RLVector* up);

/*
 * Get the parent frame of this frame.
 */
RLFrame			RLFrameGetParent(RLFrame frame);

/*
 * Get a list of child frames.  The number of frames is returned in
 * *count and *children is set to point to a list of the frames.  The
 * memory returned in *children should be freed with RLFree.
 */
RLError RLFrameGetChildren(RLFrame id,
			   int* count,
			   RLFrame** children);

/*
 * Get a list of visuals in the frame.  The number of visuals is
 * returned in *count and *visuals is set to point to a list of the
 * visuals.  The memory returned in *visuals should be freed with
 * RLFree.
 */
RLError			RLFrameGetVisuals(RLFrame frame,
					  int* count,
					  RLVisual** visuals);

/*
 * Get a list of lights in the frame.  The number of lights is
 * returned in *count and *lights is set to point to a list of the
 * lights.  The memory returned in *lights should be freed with
 * RLFree.
 */
RLError			RLFrameGetLights(RLFrame frame,
					 int* count,
					 RLLight** lights);

/*
 * Set the colour of the frame.  This colour is used for meshes in the
 * frame when the material mode (see RLFrameSetMaterialMode) is
 * RLMaterialFromFrame.
 */
RLError			RLFrameSetColour(RLFrame frame, RLColour colour);
RLError			RLFrameSetColourRGB(RLFrame frame,
					    RLValue red,
					    RLValue green,
					    RLValue blue);

/*
 * Get the colour of the frame.
 */
RLColour		RLFrameGetColour(RLFrame frame);

/*
 * Set the texture of the frame.  This texture is used for meshes in
 * the frame as for RLFrameSetColour.  To disable the frame's texture,
 * use a NULL texture.
 */
RLError			RLFrameSetTexture(RLFrame frame, RLTexture texture);

/*
 * Get the texture for a frame.
 */
RLTexture		RLFrameGetTexture(RLFrame frame);

/*
 * Define the topological properties of the texture coordinates
 * across objects in the frame.  See also RLFaceSetTextureTopology.
 */
RLError			RLFrameSetTextureTopology(RLFrame frame,
						  int wrap_u, int wrap_v);

/*
 * Get the topological properties of a texture when mapped onto
 * objects in the frame.
 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -