Exemple #1
0
void KX_BlenderMaterial::OnConstruction(int layer)
{
	if (mConstructed)
		// when material are reused between objects
		return;
	
	if (mMaterial->glslmat)
		SetBlenderGLSLShader(layer);

	// for each unique material...
	int i;
	for (i=0; i<mMaterial->num_enabled; i++) {
		if ( mMaterial->mapping[i].mapping & USEENV ) {
			if (!GLEW_ARB_texture_cube_map) {
				spit("CubeMap textures not supported");
				continue;
			}
			if (!mTextures[i].InitCubeMap(i, mMaterial->cubemap[i] ) )
				spit("unable to initialize image("<<i<<") in "<< 
						 mMaterial->matname<< ", image will not be available");
		} 
	
		else {
			if ( mMaterial->img[i] ) {
				if ( ! mTextures[i].InitFromImage(i, mMaterial->img[i], (mMaterial->flag[i] &MIPMAP)!=0 ))
					spit("unable to initialize image("<<i<<") in "<< 
						mMaterial->matname<< ", image will not be available");
			}
		}
	}

	mBlendFunc[0] =0;
	mBlendFunc[1] =0;
	mConstructed = true;
}
void KX_BlenderMaterial::OnConstruction()
{
	if (mConstructed)
		// when material are reused between objects
		return;
	
	if (mMaterial->glslmat)
		SetBlenderGLSLShader();

	InitTextures();

	mBlendFunc[0] =0;
	mBlendFunc[1] =0;
	mConstructed = true;
}