- renderer currently uses links into tface structures that actually
are owned by mesh (or displistmesh)... this causes problems for adapting to systems that build tfaces on the fly. Added RE_findTFace function to allow allocating tfaces inside renderer itself.
This commit is contained in:
@@ -191,6 +191,7 @@ void ramp_spec_result(float *specr, float *specg, float *specb, ShadeInput *shi)
|
||||
struct VlakRen *RE_findOrAddVlak(int nr);
|
||||
struct VertRen *RE_findOrAddVert(int nr);
|
||||
struct HaloRen *RE_findOrAddHalo(int nr);
|
||||
struct TFace *RE_findTFace(void);
|
||||
HaloRen *RE_inithalo(struct Material *ma, float *vec, float *vec1, float *orco, float hasize,
|
||||
float vectsize, int seed);
|
||||
|
||||
|
||||
@@ -51,6 +51,17 @@
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
struct TFace;
|
||||
|
||||
typedef struct TFaceBlock TFaceBlock;
|
||||
|
||||
struct TFaceBlock {
|
||||
TFaceBlock *next;
|
||||
|
||||
struct TFace *tfaces;
|
||||
int numAvail;
|
||||
};
|
||||
|
||||
/* localized texture result data */
|
||||
typedef struct TexResult {
|
||||
float tin, tr, tg, tb, ta;
|
||||
@@ -139,6 +150,7 @@ typedef struct RE_Render
|
||||
struct VlakRen **blovl;
|
||||
struct VertRen **blove;
|
||||
struct HaloRen **bloha;
|
||||
struct TFaceBlock *tfaceBlocks;
|
||||
|
||||
int *rectaccu;
|
||||
int *rectz; /* z buffer: distance buffer */
|
||||
|
||||
@@ -442,6 +442,14 @@ void RE_init_render_data(void)
|
||||
|
||||
void RE_free_render_data()
|
||||
{
|
||||
TFaceBlock *tfb;
|
||||
|
||||
while (tfb = R.tfaceBlocks) {
|
||||
R.tfaceBlocks = tfb->next;
|
||||
MEM_freeN(tfb->tfaces);
|
||||
MEM_freeN(tfb);
|
||||
}
|
||||
|
||||
MEM_freeN(R.blove);
|
||||
R.blove= NULL;
|
||||
MEM_freeN(R.blovl);
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
#include "BLI_arithb.h"
|
||||
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_texture_types.h"
|
||||
|
||||
#include "BKE_texture.h"
|
||||
@@ -173,6 +174,26 @@ VlakRen *RE_findOrAddVlak(int nr)
|
||||
return v;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
TFace *RE_findTFace(void)
|
||||
{
|
||||
TFaceBlock *tfb = R.tfaceBlocks;
|
||||
|
||||
if (!tfb || !tfb->numAvail) {
|
||||
TFaceBlock *tfbn = MEM_mallocN(sizeof(*tfbn), "TFaceBlock");
|
||||
|
||||
tfbn->tfaces = MEM_mallocN(sizeof(*tfbn->tfaces)*TABLEINITSIZE, "TFaceBlock->tfaces");
|
||||
tfbn->numAvail = TABLEINITSIZE;
|
||||
tfbn->next = R.tfaceBlocks;
|
||||
R.tfaceBlocks = tfbn;
|
||||
|
||||
tfb = tfbn;
|
||||
}
|
||||
|
||||
return &tfb->tfaces[tfb->numAvail--];
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
HaloRen *RE_inithalo(Material *ma, float *vec, float *vec1,
|
||||
|
||||
Reference in New Issue
Block a user