Exemple #1
0
static void cache_pointdensity(Render *re, Tex *tex)
{
	PointDensity *pd = tex->pd;
	
	if(!pd)
		return;

	if (pd->point_tree) {
		BLI_bvhtree_free(pd->point_tree);
		pd->point_tree = NULL;
	}
	
	if (pd->source == TEX_PD_PSYS) {
		Object *ob = pd->object;
		ParticleSystem *psys;

		if (!ob || !pd->psys) return;

		psys= BLI_findlink(&ob->particlesystem, pd->psys-1);
		if (!psys) return;
		
		pointdensity_cache_psys(re, pd, ob, psys);
	}
	else if (pd->source == TEX_PD_OBJECT) {
		Object *ob = pd->object;
		if (ob && ob->type == OB_MESH)
			pointdensity_cache_object(re, pd, ob);
	}
}
Exemple #2
0
static void cache_pointdensity_ex(Scene *scene,
                                  PointDensity *pd,
                                  float viewmat[4][4],
                                  float winmat[4][4],
                                  int winx, int winy)
{
	if (pd == NULL) {
		return;
	}

	if (pd->point_tree) {
		BLI_bvhtree_free(pd->point_tree);
		pd->point_tree = NULL;
	}

	if (pd->source == TEX_PD_PSYS) {
		Object *ob = pd->object;
		ParticleSystem *psys;

		if (!ob || !pd->psys) {
			return;
		}

		psys = BLI_findlink(&ob->particlesystem, pd->psys - 1);
		if (!psys) {
			return;
		}

		pointdensity_cache_psys(scene, pd, ob, psys, viewmat, winmat, winx, winy);
	}
	else if (pd->source == TEX_PD_OBJECT) {
		Object *ob = pd->object;
		if (ob && ob->type == OB_MESH)
			pointdensity_cache_object(scene, pd, ob);
	}
}