• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ BLI_ghash_lookup函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中BLI_ghash_lookup函数的典型用法代码示例。如果您正苦于以下问题:C++ BLI_ghash_lookup函数的具体用法?C++ BLI_ghash_lookup怎么用?C++ BLI_ghash_lookup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了BLI_ghash_lookup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: strand_shade_get

static void strand_shade_get(Render *re, StrandShadeCache *cache, ShadeSample *ssamp, StrandSegment *sseg, StrandVert *svert)
{
	StrandCacheEntry *entry;
	StrandPoint p;
	int *refcount;
	GHashPair pair = strand_shade_hash_pair(sseg->obi, svert);

	entry= BLI_ghash_lookup(cache->resulthash, &pair);
	refcount= BLI_ghash_lookup(cache->refcounthash, &pair);

	if (!entry) {
		/* not shaded yet, shade and insert into hash */
		p.t= (sseg->v[1] == svert)? 0.0f: 1.0f;
		strand_eval_point(sseg, &p);
		strand_shade_point(re, ssamp, sseg, svert, &p);

		entry= MEM_callocN(sizeof(StrandCacheEntry), "StrandCacheEntry");
		entry->pair = pair;
		entry->shr = ssamp->shr[0];
		BLI_ghash_insert(cache->resulthash, entry, entry);
	}
	else
		/* already shaded, just copy previous result from hash */
		ssamp->shr[0]= entry->shr;
	
	/* lower reference count and remove if not needed anymore by any samples */
	(*refcount)--;
	if (*refcount == 0) {
		BLI_ghash_remove(cache->resulthash, &pair, (GHashKeyFreeFP)MEM_freeN, NULL);
		BLI_ghash_remove(cache->refcounthash, &pair, NULL, NULL);
	}
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:32,代码来源:strand.c


示例2: if

BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BME_Mesh *bm, BME_Vert *v,
		float *co, float *org, float *vec, float *loc,
		float factor, float weight, float maxfactor, float *max) {
	BME_TransData *vtd;
	int is_new = 0;

	if (v == NULL) return NULL;

	if ((vtd = BLI_ghash_lookup(td->gh, v)) == NULL && bm != NULL) {
		vtd = BLI_memarena_alloc(td->ma, sizeof(*vtd));
		BLI_ghash_insert(td->gh, v, vtd);
		td->len++;
		is_new = 1;
	}

	vtd->bm = bm;
	vtd->v = v;
	if (co != NULL) VECCOPY(vtd->co,co);
	if (org == NULL && is_new) { VECCOPY(vtd->org,v->co); } /* default */
	else if (org != NULL) VECCOPY(vtd->org,org);
	if (vec != NULL) {
		VECCOPY(vtd->vec,vec);
		normalize_v3(vtd->vec);
	}
	vtd->loc = loc;

	vtd->factor = factor;
	vtd->weight = weight;
	vtd->maxfactor = maxfactor;
	vtd->max = max;

	return vtd;
}
开发者ID:zakharov,项目名称:blenderColladaKinematics,代码行数:33,代码来源:BME_tools.c


示例3: ghash_insert_link

static bool ghash_insert_link(
        GHash *gh, void *key, void *val, bool use_test,
        MemArena *mem_arena)
{
	struct LinkBase *ls_base;
	LinkNode *ls;

	ls_base = BLI_ghash_lookup(gh, key);

	if (ls_base) {
		if (use_test && (BLI_linklist_index(ls_base->list, key) != -1)) {
			return false;
		}
	}
	else {
		ls_base = BLI_memarena_alloc(mem_arena, sizeof(*ls_base));
		ls_base->list     = NULL;
		ls_base->list_len = 0;
		BLI_ghash_insert(gh, key, ls_base);
	}

	ls = BLI_memarena_alloc(mem_arena, sizeof(*ls));
	ls->next = ls_base->list;
	ls->link = val;
	ls_base->list = ls;
	ls_base->list_len += 1;

	return true;
}
开发者ID:pawkoz,项目名称:dyplom,代码行数:29,代码来源:bmesh_intersect.c


示例4: BLI_ghash_str_new

bool *BKE_objdef_validmap_get(Object *ob, const int defbase_tot)
{
	bDeformGroup *dg;
	ModifierData *md;
	bool *vgroup_validmap;
	GHash *gh;
	int i, step1 = 1;
	//int defbase_tot = BLI_countlist(&ob->defbase);

	if (ob->defbase.first == NULL) {
		return NULL;
	}

	gh = BLI_ghash_str_new("BKE_objdef_validmap_get gh");

	/* add all names to a hash table */
	for (dg = ob->defbase.first; dg; dg = dg->next) {
		BLI_ghash_insert(gh, dg->name, NULL);
	}

	BLI_assert(BLI_ghash_size(gh) == defbase_tot);

	/* now loop through the armature modifiers and identify deform bones */
	for (md = ob->modifiers.first; md; md = !md->next && step1 ? (step1 = 0), modifiers_getVirtualModifierList(ob) : md->next) {
		if (!(md->mode & (eModifierMode_Realtime | eModifierMode_Virtual)))
			continue;

		if (md->type == eModifierType_Armature) {
			ArmatureModifierData *amd = (ArmatureModifierData *) md;

			if (amd->object && amd->object->pose) {
				bPose *pose = amd->object->pose;
				bPoseChannel *chan;

				for (chan = pose->chanbase.first; chan; chan = chan->next) {
					if (chan->bone->flag & BONE_NO_DEFORM)
						continue;

					if (BLI_ghash_remove(gh, chan->name, NULL, NULL)) {
						BLI_ghash_insert(gh, chan->name, SET_INT_IN_POINTER(1));
					}
				}
			}
		}
	}

	vgroup_validmap = MEM_mallocN(sizeof(*vgroup_validmap) * defbase_tot, "wpaint valid map");

	/* add all names to a hash table */
	for (dg = ob->defbase.first, i = 0; dg; dg = dg->next, i++) {
		vgroup_validmap[i] = (BLI_ghash_lookup(gh, dg->name) != NULL);
	}

	BLI_assert(i == BLI_ghash_size(gh));

	BLI_ghash_free(gh, NULL, NULL);

	return vgroup_validmap;
}
开发者ID:244xiao,项目名称:blender,代码行数:59,代码来源:object_deform.c


示例5: view_layer_bases_hash_create

Base *BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
{
  if (!view_layer->object_bases_hash) {
    view_layer_bases_hash_create(view_layer);
  }

  return BLI_ghash_lookup(view_layer->object_bases_hash, ob);
}
开发者ID:dfelinto,项目名称:blender,代码行数:8,代码来源:layer.c


示例6: BLI_ghash_str_new

GPUFunction *GPU_lookup_function(const char *name)
{
	if (!FUNCTION_HASH) {
		FUNCTION_HASH = BLI_ghash_str_new("GPU_lookup_function gh");
		gpu_parse_functions_string(FUNCTION_HASH, glsl_material_library);
	}

	return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, (void *)name);
}
开发者ID:ilent2,项目名称:Blender-Billboard-Modifier,代码行数:9,代码来源:gpu_codegen.c


示例7: BLI_ghash_lookup

static bArgument *lookUp(struct bArgs *ba, const char *arg, int pass, int case_str)
{
	bAKey key;

	key.case_str = case_str;
	key.pass = pass;
	key.arg = arg;

	return BLI_ghash_lookup(ba->items, &key);
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:10,代码来源:BLI_args.c


示例8: debug_data_insert

static void debug_data_insert(SimDebugData *debug_data, SimDebugElement *elem)
{
	SimDebugElement *old_elem = BLI_ghash_lookup(debug_data->gh, elem);
	if (old_elem) {
		*old_elem = *elem;
		MEM_freeN(elem);
	}
	else
		BLI_ghash_insert(debug_data->gh, elem, elem);
}
开发者ID:Rojuinex,项目名称:Blender,代码行数:10,代码来源:effect.c


示例9: BLI_ghash_lookup

/**
 * Return a pointer to the pose channel of the given name
 * from this pose.
 */
bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name)
{
	if (ELEM(NULL, pose, name) || (name[0] == '\0'))
		return NULL;
	
	if (pose->chanhash)
		return BLI_ghash_lookup(pose->chanhash, (const void *)name);
	
	return BLI_findstring(&((const bPose *)pose)->chanbase, name, offsetof(bPoseChannel, name));
}
开发者ID:UPBGE,项目名称:blender,代码行数:14,代码来源:action.c


示例10: BLI_ghash_lookup

static ListBase *edge_isect_ls_ensure(GHash *isect_hash, ScanFillEdge *eed)
{
	ListBase *e_ls;
	e_ls = BLI_ghash_lookup(isect_hash, eed);
	if (e_ls == NULL) {
		e_ls = MEM_callocN(sizeof(ListBase), __func__);
		BLI_ghash_insert(isect_hash, eed, e_ls);
	}
	return e_ls;
}
开发者ID:YasirArafath,项目名称:blender-git,代码行数:10,代码来源:scanfill_utils.c


示例11: BLI_ghash_str_new

GPUFunction *GPU_lookup_function(const char *name)
{
	if (!FUNCTION_HASH) {
		FUNCTION_HASH = BLI_ghash_str_new("GPU_lookup_function gh");
		gpu_parse_functions_string(FUNCTION_HASH, glsl_material_library);
		/*FUNCTION_PROTOTYPES = gpu_generate_function_prototyps(FUNCTION_HASH);
		FUNCTION_LIB = GPU_shader_create_lib(datatoc_gpu_shader_material_glsl);*/
	}

	return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, (void *)name);
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:11,代码来源:gpu_codegen.c


示例12: BLI_assert

static TseGroup *BKE_outliner_treehash_lookup_group(GHash *th, short type, short nr, struct ID *id)
{
	TreeStoreElem tse_template;
	tse_template.type = type;
	tse_template.nr = type ? nr : 0;  // we're picky! :)
	tse_template.id = id;

	BLI_assert(th);

	return BLI_ghash_lookup(th, &tse_template);
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:11,代码来源:outliner_treehash.c


示例13: BLI_ghash_lookup

Icon *BKE_icon_get(int icon_id)
{
	Icon *icon = NULL;

	icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id));
	
	if (!icon) {
		printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
		return NULL;
	}

	return icon;
}
开发者ID:khanhha,项目名称:blender,代码行数:13,代码来源:icons.c


示例14: BKE_pose_channels_is_valid

bool BKE_pose_channels_is_valid(const bPose *pose)
{
	if (pose->chanhash) {
		bPoseChannel *pchan;
		for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
			if (BLI_ghash_lookup(pose->chanhash, pchan->name) != pchan) {
				return false;
			}
		}
	}

	return true;
}
开发者ID:UPBGE,项目名称:blender,代码行数:13,代码来源:action.c


示例15:

static unsigned int *imb_thread_cache_get_tile(ImThreadTileCache *cache, ImBuf *ibuf, int tx, int ty)
{
	ImThreadTile *ttile, lookuptile;
	ImGlobalTile *gtile, *replacetile;
	int toffs= ibuf->xtiles*ty + tx;

	/* test if it is already in our thread local cache */
	if((ttile=cache->tiles.first)) {
		/* check last used tile before going to hash */
		if(ttile->ibuf == ibuf && ttile->tx == tx && ttile->ty == ty)
			return ibuf->tiles[toffs];

		/* find tile in hash */
		lookuptile.ibuf = ibuf;
		lookuptile.tx = tx;
		lookuptile.ty = ty;

		if((ttile=BLI_ghash_lookup(cache->tilehash, &lookuptile))) {
			BLI_remlink(&cache->tiles, ttile);
			BLI_addhead(&cache->tiles, ttile);

			return ibuf->tiles[toffs];
		}
	}

	/* not found, have to do slow lookup in global cache */
	if(cache->unused.first == NULL) {
		ttile= cache->tiles.last;
		replacetile= ttile->global;
		BLI_remlink(&cache->tiles, ttile);
		BLI_ghash_remove(cache->tilehash, ttile, NULL, NULL);
	}
	else {
		ttile= cache->unused.first;
		replacetile= NULL;
		BLI_remlink(&cache->unused, ttile);
	}

	BLI_addhead(&cache->tiles, ttile);
	BLI_ghash_insert(cache->tilehash, ttile, ttile);

	gtile= imb_global_cache_get_tile(ibuf, tx, ty, replacetile);

	ttile->ibuf= gtile->ibuf;
	ttile->tx= gtile->tx;
	ttile->ty= gtile->ty;
	ttile->global= gtile;

	return ibuf->tiles[toffs];
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:50,代码来源:cache.c


示例16: strand_shade_unref

void strand_shade_unref(StrandShadeCache *cache, ObjectInstanceRen *obi, StrandVert *svert)
{
	GHashPair pair = strand_shade_hash_pair(obi, svert);
	int *refcount;

	/* lower reference count and remove if not needed anymore by any samples */
	refcount= BLI_ghash_lookup(cache->refcounthash, &pair);

	(*refcount)--;
	if (*refcount == 0) {
		BLI_ghash_remove(cache->resulthash, &pair, (GHashKeyFreeFP)MEM_freeN, NULL);
		BLI_ghash_remove(cache->refcounthash, &pair, NULL, NULL);
	}
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:14,代码来源:strand.c


示例17: codegen_set_texid

/* assign only one texid per buffer to avoid sampling the same texture twice */
static void codegen_set_texid(GHash *bindhash, GPUInput *input, int *texid, void *key)
{
	if (BLI_ghash_haskey(bindhash, key)) {
		/* Reuse existing texid */
		input->texid = GET_INT_FROM_POINTER(BLI_ghash_lookup(bindhash, key));
	}
	else {
		/* Allocate new texid */
		input->texid = *texid;
		(*texid)++;
		input->bindtex = true;
		BLI_ghash_insert(bindhash, key, SET_INT_IN_POINTER(input->texid));
	}
}
开发者ID:mcgrathd,项目名称:blender,代码行数:15,代码来源:gpu_codegen.c


示例18: BLI_ghash_lookup

MenuType *WM_menutype_find(const char *idname, int quiet)
{
	MenuType* mt;

	if (idname[0]) {
		mt= BLI_ghash_lookup(menutypes_hash, idname);
		if(mt)
			return mt;
	}

	if(!quiet)
		printf("search for unknown menutype %s\n", idname);

	return NULL;
}
开发者ID:mik0001,项目名称:Blender,代码行数:15,代码来源:wm.c


示例19: BLI_ghash_lookup

/**
 * Helper function for #postEditBoneDuplicate,
 * return the destination pchan from the original.
 */
static bPoseChannel *pchan_duplicate_map(const bPose *pose, GHash *name_map, bPoseChannel *pchan_src)
{
	bPoseChannel *pchan_dst = NULL;
	const char *name_src = pchan_src->name;
	const char *name_dst = BLI_ghash_lookup(name_map, name_src);
	if (name_dst) {
		pchan_dst = BKE_pose_channel_find_name(pose, name_dst);
	}

	if (pchan_dst == NULL) {
		pchan_dst = pchan_src;
	}

	return pchan_dst;
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:19,代码来源:armature_add.c


示例20: strand_shade_refcount

static void strand_shade_refcount(StrandShadeCache *cache, StrandSegment *sseg, StrandVert *svert)
{
	GHashPair pair = strand_shade_hash_pair(sseg->obi, svert);
	GHashPair *key;
	int *refcount= BLI_ghash_lookup(cache->refcounthash, &pair);

	if (!refcount) {
		key= BLI_memarena_alloc(cache->memarena, sizeof(GHashPair));
		*key = pair;
		refcount= BLI_memarena_alloc(cache->memarena, sizeof(int));
		*refcount= 1;
		BLI_ghash_insert(cache->refcounthash, key, refcount);
	}
	else
		(*refcount)++;
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:16,代码来源:strand.c



注:本文中的BLI_ghash_lookup函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BLI_insertlinkbefore函数代码示例发布时间:2022-05-30
下一篇:
C++ BLI_ghash_insert函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap