Ejemplo n.º 1
0
void EffectsExporter::writeBlinn(COLLADASW::EffectProfile &ep, Material *ma)
{
	COLLADASW::ColorOrTexture cot;
	ep.setShaderType(COLLADASW::EffectProfile::BLINN);
	// shininess
	ep.setShininess(ma->har, false, "shininess");
	// specular
	cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f);
	ep.setSpecular(cot, false, "specular");
}
Ejemplo n.º 2
0
void EffectsExporter::writeTextures(
        COLLADASW::EffectProfile &ep,
        std::string &key,
        COLLADASW::Sampler *sampler,
        MTex *t, Image *ima,
        std::string &uvname )
{
	// Image not set for texture
	if (!ima) return;

	// color
	if (t->mapto & MAP_COL) {
		ep.setDiffuse(createTexture(ima, uvname, sampler), false, "diffuse");
	}
	// ambient
	if (t->mapto & MAP_AMB) {
		ep.setAmbient(createTexture(ima, uvname, sampler), false, "ambient");
	}
	// specular
	if (t->mapto & (MAP_SPEC | MAP_COLSPEC)) {
		ep.setSpecular(createTexture(ima, uvname, sampler), false, "specular");
	}
	// emission
	if (t->mapto & MAP_EMIT) {
		ep.setEmission(createTexture(ima, uvname, sampler), false, "emission");
	}
	// reflective
	if (t->mapto & MAP_REF) {
		ep.setReflective(createTexture(ima, uvname, sampler));
	}
	// alpha
	if (t->mapto & MAP_ALPHA) {
		ep.setTransparent(createTexture(ima, uvname, sampler));
	}
	// extension:
	// Normal map --> Must be stored with <extra> tag as different technique,
	// since COLLADA doesn't support normal maps, even in current COLLADA 1.5.
	if (t->mapto & MAP_NORM) {
		COLLADASW::Texture texture(key);
		texture.setTexcoord(uvname);
		texture.setSampler(*sampler);
		// technique FCOLLADA, with the <bump> tag, is most likely the best understood,
		// most widespread de-facto standard.
		texture.setProfileName("FCOLLADA");
		texture.setChildElementName("bump");
		ep.addExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture));
	}
}
Ejemplo n.º 3
0
void EffectsExporter::writeLambert(COLLADASW::EffectProfile &ep, Material *ma)
{
	COLLADASW::ColorOrTexture cot;
	ep.setShaderType(COLLADASW::EffectProfile::LAMBERT);
}