当前位置: 首页>>代码示例>>C++>>正文


C++ CBitmap::AllocDummy方法代码示例

本文整理汇总了C++中CBitmap::AllocDummy方法的典型用法代码示例。如果您正苦于以下问题:C++ CBitmap::AllocDummy方法的具体用法?C++ CBitmap::AllocDummy怎么用?C++ CBitmap::AllocDummy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBitmap的用法示例。


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

示例1: CreateSplatDetailTextures

void CSMFReadMap::CreateSplatDetailTextures()
{
	if (!haveSplatDetailDistribTexture)
		return;

	CBitmap splatDistrTexBM;
	CBitmap splatDetailTexBM;

	// if the map supplies an intensity- AND a distribution-texture for
	// detail-splat blending, the regular detail-texture is not used
	if (!splatDetailTexBM.Load(mapInfo->smf.splatDetailTexName)) {
		// default detail-texture should be all-grey
		splatDetailTexBM.channels = 4;
		splatDetailTexBM.AllocDummy(SColor(127,127,127,127));
	}

	if (!splatDistrTexBM.Load(mapInfo->smf.splatDistrTexName)) {
		splatDistrTexBM.channels = 4;
		splatDistrTexBM.AllocDummy(SColor(255,0,0,0));
	}

	splatDetailTex.SetRawTexID(splatDetailTexBM.CreateTexture(texAnisotropyLevels[true], true));
	splatDetailTex.SetRawSize(int2(splatDetailTexBM.xsize, splatDetailTexBM.ysize));

	splatDistrTex.SetRawTexID(splatDistrTexBM.CreateTexture(texAnisotropyLevels[true], true));
	splatDistrTex.SetRawSize(int2(splatDistrTexBM.xsize, splatDistrTexBM.ysize));

	// only load the splat detail normals if any of them are defined and present
	if (!haveSplatNormalDistribTexture)
		return;

	for (size_t i = 0; i < mapInfo->smf.splatDetailNormalTexNames.size(); i++) {
		if (i == NUM_SPLAT_DETAIL_NORMALS)
			break;

		CBitmap splatDetailNormalTextureBM;

		if (!splatDetailNormalTextureBM.Load(mapInfo->smf.splatDetailNormalTexNames[i])) {
			splatDetailNormalTextureBM.channels = 4;
			splatDetailNormalTextureBM.Alloc(1, 1);
			splatDetailNormalTextureBM.mem[0] = 127; // RGB is packed standard normal map
			splatDetailNormalTextureBM.mem[1] = 127;
			splatDetailNormalTextureBM.mem[2] = 255; // With a single upward (+Z) pointing vector
			splatDetailNormalTextureBM.mem[3] = 127; // Alpha is diffuse as in old-style detail textures
		}

		splatNormalTextures[i].SetRawTexID(splatDetailNormalTextureBM.CreateTexture(texAnisotropyLevels[true], true));
		splatNormalTextures[i].SetRawSize(int2(splatDetailNormalTextureBM.xsize, splatDetailNormalTextureBM.ysize));
	}

}
开发者ID:DoctorEmmettBrown,项目名称:spring,代码行数:51,代码来源:SMFReadMap.cpp

示例2: GetFallbacks

static inline void GetFallbacks(std::unordered_map<std::string, STex>& textures)
{
	auto CREATE_SINGLE_COLOR = [](SColor c) -> STex {
		CBitmap bm;
		bm.AllocDummy(c);
		bm = bm.CreateRescaled(32, 32);
		return { bm.CreateTexture(), int2(bm.xsize, bm.ysize) };
	};

	textures["%FALLBACK_TEXTURE%"] = CREATE_SINGLE_COLOR(SColor(255, 0, 0, 255));
	textures["%FALLBACK_TEXTURE_NORMAL%"] = CREATE_SINGLE_COLOR(SColor(0, 255, 0, 255));
}
开发者ID:Liuyangbiao,项目名称:spring,代码行数:12,代码来源:DecalsDrawerGL4.cpp

示例3: GenWaterQuadsList

CBasicWater::CBasicWater()
{
	CBitmap waterTexBM;
	if (!waterTexBM.Load(mapInfo->water.texture)) {
		LOG_L(L_WARNING, "[%s] could not read water texture from file \"%s\"", __FUNCTION__, mapInfo->water.texture.c_str());

		// fallback
		waterTexBM.AllocDummy(SColor(0,0,255,255));
	}

	// create mipmapped texture
	textureID = waterTexBM.CreateMipMapTexture();
	displistID = GenWaterQuadsList(waterTexBM.xsize, waterTexBM.ysize);
}
开发者ID:DoctorEmmettBrown,项目名称:spring,代码行数:14,代码来源:BasicWater.cpp

示例4: CreateSpecularTex

void CSMFReadMap::CreateSpecularTex()
{
	if (!haveSpecularTexture)
		return;

	CBitmap specularTexBM;
	CBitmap skyReflectModTexBM;
	CBitmap blendNormalsTexBM;
	CBitmap lightEmissionTexBM;
	CBitmap parallaxHeightTexBM;

	if (!specularTexBM.Load(mapInfo->smf.specularTexName)) {
		// maps wants specular lighting, but no moderation
		specularTexBM.channels = 4;
		specularTexBM.AllocDummy(SColor(255, 255, 255, 255));
	}

	specularTex.SetRawTexID(specularTexBM.CreateTexture());
	specularTex.SetRawSize(int2(specularTexBM.xsize, specularTexBM.ysize));

	// no default 1x1 textures for these
	if (skyReflectModTexBM.Load(mapInfo->smf.skyReflectModTexName)) {
		skyReflectModTex.SetRawTexID(skyReflectModTexBM.CreateTexture());
		skyReflectModTex.SetRawSize(int2(skyReflectModTexBM.xsize, skyReflectModTexBM.ysize));
	}

	if (blendNormalsTexBM.Load(mapInfo->smf.blendNormalsTexName)) {
		blendNormalsTex.SetRawTexID(blendNormalsTexBM.CreateTexture());
		blendNormalsTex.SetRawSize(int2(blendNormalsTexBM.xsize, blendNormalsTexBM.ysize));
	}

	if (lightEmissionTexBM.Load(mapInfo->smf.lightEmissionTexName)) {
		lightEmissionTex.SetRawTexID(lightEmissionTexBM.CreateTexture());
		lightEmissionTex.SetRawSize(int2(lightEmissionTexBM.xsize, lightEmissionTexBM.ysize));
	}

	if (parallaxHeightTexBM.Load(mapInfo->smf.parallaxHeightTexName)) {
		parallaxHeightTex.SetRawTexID(parallaxHeightTexBM.CreateTexture());
		parallaxHeightTex.SetRawSize(int2(parallaxHeightTexBM.xsize, parallaxHeightTexBM.ysize));
	}
}
开发者ID:DoctorEmmettBrown,项目名称:spring,代码行数:41,代码来源:SMFReadMap.cpp


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