📄 rl.h
字号:
RLError RLFrameGetTextureTopology(RLFrame frame,
int* wrap_u, int* wrap_v);
/*
* Set the material mode for a frame. The material mode determines
* the source of material information for visuals rendered with the
* frame. The default, RLMaterialFromMesh takes material information
* from the visual itself. RLMaterialFromFrame overrides the visual's
* material with the colour or texture from the frame.
* RLMaterialFromParent inherits the material mode setting (and
* colour or texture) from the parent frame.
*
* If a toplevel frame is rendered with its material mode set to
* RLMaterialFromParent, it behaves as if it had a parent with a
* material mode of RLMaterialFromMesh.
*/
typedef enum _RLMaterialMode {
RLMaterialFromMesh,
RLMaterialFromParent,
RLMaterialFromFrame
} RLMaterialMode;
RLError RLFrameSetMaterialMode(RLFrame frame,
RLMaterialMode mode);
/*
* Get the material mode for a frame.
*/
RLMaterialMode RLFrameGetMaterialMode(RLFrame frame);
/*
* Transform the vector *s in frame coordinates to world coordinates
* returning the result in *d.
*/
RLError RLFrameTransform(RLFrame frame,
RLVector* d,
RLVector* s);
/*
* Transform the vector *s in world coordinates to frame coordinates
* returning the result in *d.
*/
RLError RLFrameInverseTransform(RLFrame frame,
RLVector* d,
RLVector* s);
/*
* Set a background colour for a scene (a frame with no parent).
* The default background colour is black.
*/
RLError RLSceneSetBackground(RLFrame frame, RLColour bg);
RLError RLSceneSetBackgroundRGB(RLFrame frame,
RLValue red,
RLValue green,
RLValue blue);
/*
* Get the current background colour for a scene.
*/
RLColour RLSceneGetBackground(RLFrame frame);
/*
* Set a background image for a scene.
*/
RLError RLSceneSetBackgroundImage(RLFrame frame, RLTexture bg);
/*
* Set a background depth field for a scene. The image must have a depth
* of 16 bits.
*/
RLError RLSceneSetBackgroundDepth(RLFrame frame, RLImage* im);
/*
* Get the current background depth field for the scene.
*/
RLImage* RLSceneGetBackgroundDepth(RLFrame frame);
/*
* Create a texture from an image in memory.
*/
RLTexture RLCreateTexture(RLImage*);
/*
* Load a texture from the file named.
*/
RLTexture RLLoadTexture(const char*);
/*
* Load a texture from the named file, called from RLLoadMeshWithTextures.
*/
RLTexture RLLoadTextureHandler(const char*, void* arg);
/*
* Inform the renderer that the pixels or palette of a texture's image
* have been changed by the application.
*/
RLError RLTextureChanged(RLTexture,
int pixels,
int palette);
/*
* Return a pointer to the image that the texture was created with
*/
RLImage* RLTextureGetImage(RLTexture);
/*
* Set the default values for a new texture's colours and shades.
*/
void RLTextureSetDefaultColours(int);
void RLTextureSetDefaultShades(int);
/*
* Add an image which specifies opacity values for each pixel of the
* texture.
*/
RLError RLTextureSetOpacity(RLTexture, RLImage*);
/*
* Get the current image specifying opacity values for the texture.
*/
RLImage* RLTextureGetOpacity(RLTexture);
/*
* Get the maximum number of colours for a texture to use in the palette
* colour model.
*/
int RLTextureGetColours(RLTexture);
/*
* Set the maximum number of colours for a texture to use in the palette
* colour model.
*/
RLError RLTextureSetColours(RLTexture, int);
/*
* Get the maximum number of shades of each colour for a texture to use in
* the palette colour model.
*/
int RLTextureGetShades(RLTexture);
/*
* Set the maximum number of shades of each colour for a texture to use in
* the palette colour model.
*/
RLError RLTextureSetShades(RLTexture, int);
/*
* Set the size of the decal (in model space) to be used if the decal
* is being scaled according to its depth in the scene. The default
* size is (1, 1).
*/
RLError RLTextureSetDecalSize(RLTexture,
RLValue width, RLValue height);
/*
* Get the size of the decal previously set with
* RLTextureSetDecalSize.
*/
RLError RLTextureGetDecalSize(RLTexture,
RLValue* width_return,
RLValue* height_return);
/*
* Set the offset from the top left of the decal origin. The origin
* is mapped to the containing frame's position when rendering. The
* default origin is (0, 0).
*/
RLError RLTextureSetDecalOrigin(RLTexture, int x, int y);
/*
* Get the origin of the decal previously set with
* RLTextureSetDecalOrigin.
*/
RLError RLTextureGetDecalOrigin(RLTexture,
int* x_return,
int* y_return);
typedef enum _RLDecalDepth {
RLDecalFront, /* decal is in front of everything */
RLDecalBack, /* decal is behind everything */
RLDecalMix /* decal is mixed in according to depth */
} RLDecalDepth;
/*
* Set the depth properties for a decal. The decal can be in front of
* the scene, behind the scene or it can be part of the scene,
* obscuring or being obscured according to the depth value of its
* frame. Default is RLDecalMix.
*/
RLError RLTextureSetDecalDepth(RLTexture, RLDecalDepth);
/*
* Return the current depth properties of the decal. Returns -1 on
* error.
*/
RLDecalDepth RLTextureGetDecalDepth(RLTexture);
/*
* Set to TRUE to scale the decal with depth otherwise FALSE.
* Default is TRUE.
*/
RLError RLTextureSetDecalScale(RLTexture, int);
/*
* Get the scaling property of the decal. Returns -1 on error.
*/
int RLTextureGetDecalScale(RLTexture);
/*
* Set to TRUE if the decal has a transparent colour otherwise FALSE.
* Default is FALSE.
*/
RLError RLTextureSetDecalTransparency(RLTexture, int);
/*
* Get the transparency property of the decal. Returns -1 on error.
*/
int RLTextureGetDecalTransparency(RLTexture);
/*
* Set the transparent colour for a decal. The default transparent colour
* is black.
*/
RLError RLTextureSetDecalTransparentColour(RLTexture, RLColour);
/*
* Get the transparent colour for a decal.
*/
RLColour RLTextureGetDecalTransparentColour(RLTexture);
/*
* Create a shadow from the visual with the light, projecting onto the
* specified plane. The shadow is a visual which should be added
* to the frame which contains the visual.
*/
RLShadow RLCreateShadow(RLVisual visual, RLLight light,
RLValue px, RLValue py, RLValue pz,
RLValue nx, RLValue ny, RLValue nz);
/*
* Create a material with the given properties.
*/
RLMaterial RLCreateMaterial(RLValue ks, RLValue power);
/*
* Set the coefficient of specular reflection in a material.
*/
RLError RLMaterialSetKs(RLMaterial id, RLValue ks);
/*
* Get the coefficient of specular reflection in a material.
*/
RLValue RLMaterialGetKs(RLMaterial id);
/*
* Set the power used for the specular exponent in a material.
*/
RLError RLMaterialSetPower(RLMaterial id, RLValue power);
/*
* Get the power used for the specular exponent in a material.
*/
RLValue RLMaterialGetPower(RLMaterial id);
typedef enum _RLPathType {
RLPathOpen,
RLPathClosed
} RLPathType;
/*
* Create a path, specifying the type of path where RLPathOpen is a path
* with a start and end point and RLPathClosed is a path where the end
* loops back to the beginning.
*/
RLPath RLCreatePath(RLPathType type);
/*
* Add a point to the end of a path.
*/
RLError RLPathAddPoint(RLPath path,
RLValue x, RLValue y, RLValue z);
/*
* Insert a point before the existing point with the given index.
*/
RLError RLPathInsertPoint(RLPath path, int index,
RLValue x, RLValue y, RLValue z);
/*
* Delete the point with the given index from the path.
*/
RLError RLPathDeletePoint(RLPath path, int index);
/*
* Return the number of points in the path.
*/
int RLPathGetSize(RLPath path);
/*
* Return the type of the path.
*/
RLPathType RLPathGetType(RLPath id);
/*
* Return the point with the given index from the path in *p.
*/
RLError RLPathGetPoint(RLPath path, int index, RLVector* p);
/*
* Position and orient a frame at a given parametric position on a path
* relative to the given reference frame. If the path has insufficient
* points for the given parametric position, then an RLBadValue error
* is generated.
*/
RLError RLPathPositionFrame(RLPath path,
RLFrame frame, RLFrame ref,
RLValue place);
/*
* Position a frame at a given parametric position on a path
* relative to the given reference frame. Do not orient it.
* If the path has insufficient
* points for the given parametric position, then an RLBadValue error
* is generated.
*/
RLError RLPathPlaceFrame(RLPath path,
RLFrame frame, RLFrame ref,
RLValue place);
/*
* Create a new, empty animation.
*/
RLAnimation RLCreateAnimation();
/*
* Add a rotation keyframe to the animation.
*/
RLError RLAnimationAddRotateKey(RLAnimation anim,
RLValue time,
RLQuaternion* q);
/*
* Add a position keyframe to the animation.
*/
RLError RLAnimationAddPositionKey(RLAnimation anim,
RLValue time,
RLValue x,
RLValue y,
RLValue z);
/*
* Add a scaling keyframe to the animation.
*/
RLError RLAnimationAddScaleKey(RLAnimation anim,
RLValue time,
RLValue x,
RLValue y,
RLValue z);
/*
* Set the frame which is being animated.
*/
RLError RLAnimationSetFrame(RLAnimation anim,
RLFrame frame);
/*
* Set the current time of the animation, modifying the transform of the
* animation's frame (if any).
*/
RLError RLAnimationSetTime(RLAnimation anim, RLValue time);
/*
* Create a new, empty animation set.
*/
RLAnimationSet RLCreateAnimationSet();
/*
* Add an animation to the set.
*/
RLError RLAnimationSetAddAnimation(RLAnimationSet id,
RLAnimation aid);
/*
* Remove an animation from the set.
*/
RLError RLAnimationSetRemoveAnimation(RLAnimationSet id,
RLAnimation aid);
/*
* Set the time of all animations in the set.
*/
RLError RLAnimationSetSetTime(RLAnimationSet id, RLValue time);
/*
* Add two vectors. Returns its first argument.
*/
RLVector* RLVectorAdd(RLVector* d,
RLVector* s1,
RLVector* s2);
/*
* Subtract two vectors. Returns its first argument.
*/
RLVector* RLVectorSubtract(RLVector* d,
RLVector* s1,
RLVector* s2);
/*
* Reflect a ray about a given normal. Returns its first argument.
*/
RLVector* RLVectorReflect(RLVector* d,
RLVector* ray,
RLVector* norm);
/*
* Calculate the vector cross product. Returns its first argument.
*/
RLVector* RLVectorCrossProduct(RLVector* d,
RLVector* s1,
RLVector* s2);
/*
* Return the vector dot product.
*/
RLValue RLVectorDotProduct(RLVector* s1,
RLVector* s2);
/*
* Scale a vector so that its modulus is 1. Returns its argument or
* NULL if there was an error (e.g. a zero vector was passed).
*/
RLVector* RLVectorNormalise(RLVector*);
/*
* Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)).
*/
RLValue RLVectorModulus(RLVector* v);
/*
* Set the rotation part of a matrix to be a rotation of theta radians
* around the given axis.
*/
RLVector* RLVectorRotate(RLVector* r, RLVector* v, RLVector* axis, RLValue theta);
/*
* Scale a vector uniformly in all three axes
*/
RLVector* RLVectorScale(RLVector* d, RLVector* s, RLValue factor);
/*
* Return a random unit vector
*/
RLVector* RLVectorRandom(RLVector* d);
/*
* Returns a unit quaternion that represents a rotation of theta radians
* around the given axis.
*/
RLQuaternion* RLQuaternionFromRotation(RLQuaternion* quat,
RLVector* v,
RLValue theta);
/*
* Calculate the product of two quaternions
*/
RLQuaternion* RLQuaternionMultiply(RLQuaternion* q,
RLQuaternion* a,
RLQuaternion* b);
/*
* Interpolate between two quaternions
*/
RLQuaternion* RLQuaternionSlerp(RLQuaternion* q,
RLQuaternion* a,
RLQuaternion* b,
RLValue alpha);
/*
* Calculate the matrix for the rotation that a unit quaternion represents
*/
void RLMatrixFromQuaternion(RLMatrix4d mat, RLQuaternion* quat);
/*
* Register a set of functions to be used in place of malloc, realloc
* and free for memory allocation. The functions RLMalloc, RLRealloc
* and RLFree will use these functions. The default is to use the
* ANSI C library routines malloc, realloc and free.
*/
typedef void* (*RLMallocFunction)(size_t);
typedef void* (*RLReallocFunction)(void*, size_t);
typedef void (*RLFreeFunction)(void*);
void RLSetAllocator(RLMallocFunction malloc_fn,
RLReallocFunction realloc_fn,
RLFreeFunction free_fn);
/*
* Get the current functions used for memory allocation.
*/
void RLGetAllocator(RLMallocFunction* malloc_fn_return,
RLReallocFunction* realloc_fn_return,
RLFreeFunction* free_fn_return);
/*
* Print out the object id and class name of all objects currently
* allocated.
*/
void RLPrintObjects(void);
/*
* Run through the list of active RLObjects and allow the callback to be
* applied to each
*/
void RLEnumerateObjects(RLObjectEnumerateCallback enumerate_cb, void* arg);
/*
* Allocate size bytes of memory and return a pointer to it in *p_return.
* Returns RLBadAlloc with *p_return unchanged if the allocation fails.
*/
RLError RLMalloc(void** p_return, size_t size);
/*
* Change the size of an allocated block of memory. A pointer to the
* block is passed in in *p_inout. If *p_inout is NULL then a new
* block is allocated. If the reallocation is successful, *p_inout is
* changed to point to the new block. If the allocation fails,
* *p_inout is unchanged and RLBadAlloc is returned.
*/
RLError RLRealloc(void** p_inout, size_t size);
/*
* Free a block of memory previously allocated with RLMalloc or
* RLRealloc.
*/
void RLFree(void* p);
/*
* Get the total amount of memory currently allocated by the library
*/
size_t RLGetTotalAllocated(void);
#if defined(__cplusplus)
};
#endif
#endif /* rl.h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -