clnew.c

00001 #include <cl.h>
00002 
00003 /*
00004   CLnew: mallocs space for the struct
00005          array counts (ie. num_) are set to 0
00006          arrays are set to NULL
00007          display lists and texture objects are set to uninitialised (0 and -1)
00008          other values are undefined
00009 
00010          return NULL on failure to malloc
00011 */
00012 
00013 CLcolour* clNewColour(GLvoid)
00014 {
00015   return (CLcolour*)malloc(sizeof(CLcolour));
00016 }
00017 
00018 CLvertex* clNewVertex(GLvoid)
00019 {
00020   return (CLvertex*)malloc(sizeof(CLvertex));
00021 }
00022 
00023 CLnormal* clNewNormal(GLvoid)
00024 {
00025   return (CLnormal*)malloc(sizeof(CLnormal));
00026 }
00027 
00028 CLtexcoord* clNewTexCoord(GLvoid)
00029 {
00030   return (CLtexcoord*)malloc(sizeof(CLtexcoord));
00031 }
00032 
00033 CLedgeflag* clNewEdgeFlag(GLvoid)
00034 {
00035   return (CLedgeflag*)malloc(sizeof(CLedgeflag));
00036 }
00037 
00038 CLmatrix* clNewMatrix(GLvoid)
00039 {
00040   return (CLmatrix*)malloc(sizeof(CLmatrix));
00041 }
00042 
00043 CLimage* clNewImage(GLvoid)
00044 {
00045   CLimage* image;
00046 
00047   if (!(image = (CLimage*)malloc(sizeof(CLimage))))
00048       return 0;
00049 
00050   clInitImage(image);
00051 
00052   return image;
00053 }
00054 
00055 CLlight* clNewLight(GLvoid)
00056 {
00057   CLlight* light;
00058 
00059   if (!(light = (CLlight*)malloc(sizeof(CLlight))))
00060     return 0;
00061 
00062   clInitLight(light);
00063 
00064   return light;
00065 }
00066 
00067 CLmaterial* clNewMaterial(GLvoid)
00068 {
00069   CLmaterial* material;
00070 
00071   if (!(material = (CLmaterial*)malloc(sizeof(CLmaterial))))
00072     return 0;
00073 
00074   clInitMaterial(material);
00075   
00076   return material;
00077 }
00078 
00079 CLtexture* clNewTexture(GLvoid)
00080 {
00081   CLtexture* texture;
00082   
00083   if (!(texture = (CLtexture*)malloc(sizeof(CLtexture))))
00084     return 0;
00085   
00086   clInitTexture(texture);
00087 
00088   return texture;
00089 }
00090 
00091 CLprimitiveset* clNewPrimitiveSet(GLvoid)
00092 {
00093   CLprimitiveset* primitiveset;
00094 
00095   if (!(primitiveset = (CLprimitiveset*)malloc(sizeof(CLprimitiveset))))
00096     return 0;
00097 
00098   clInitPrimitiveSet(primitiveset);
00099 
00100   return primitiveset;
00101 }
00102 
00103 CLmesh* clNewMesh(GLvoid)
00104 {
00105   CLmesh* mesh;
00106 
00107   if (!(mesh = (CLmesh*)malloc(sizeof(CLmesh))))
00108     return 0;
00109 
00110   clInitMesh(mesh);
00111   
00112   return mesh;
00113 }
00114 
00115 CLcontext* clNewContext(GLvoid)
00116 {
00117   CLcontext* context;
00118 
00119   if (!(context = (CLcontext*)malloc(sizeof(CLcontext))))
00120     return 0;
00121 
00122   clInitContext(context);
00123   
00124   return context;
00125 }
00126 
00127 CLmodel* clNewModel(GLvoid)
00128 {
00129   CLmodel* model;
00130 
00131   if (!(model = (CLmodel*)malloc(sizeof(CLmodel))))
00132     return 0;
00133 
00134   clInitModel(model);
00135 
00136   return model;
00137 }

Generated on Thu Dec 27 13:53:41 2007 for CL by  doxygen 1.4.6