Exemplo n.º 1
0
	bool MaterialDescription::operator==(
		const MaterialDescription &material) const
	{
		Uint16 i;

		if (get_effect() != material.get_effect())
		{
			return false;
		}

		for (i = 0; i < material_texture_count; ++i)
		{
			if (get_texture(i) != material.get_texture(i))
			{
				return false;
			}
		}

		for (i = 0; i < 2; ++i)
		{
			if (get_texture_matrix(i) !=
				material.get_texture_matrix(i))
			{
				return false;
			}
		}

		if (get_color() != material.get_color())
		{
			return false;
		}

		if (get_cast_shadows() != material.get_cast_shadows())
		{
			return false;
		}

		if (get_culling() != material.get_culling())
		{
			return false;
		}

		if (get_script() != material.get_script())
		{
			return false;
		}

		return get_name() == material.get_name();
	}
Exemplo n.º 2
0
	void MaterialDescription::save_xml(
		const XmlWriterSharedPtr &writer) const
	{
		Uint32 i;
		SamplerParameterType sampler;

		writer->start_element(String(UTF8("material")));
		writer->write_element(String(UTF8("name")), get_name());
		writer->write_element(String(UTF8("effect")), get_effect());
		writer->write_element(String(UTF8("script")), get_script());

		for (i = 0; i < m_textures.size(); ++i)
		{
			sampler = static_cast<SamplerParameterType>(i);

			writer->start_element(SamplerParameterUtil::get_str(
				sampler));
			writer->write_bool_property(String(UTF8("sRGB")),
				get_sRGB(sampler));
			writer->write_string(get_texture(sampler));
			writer->end_element();
		}

		writer->write_mat2x3_element(String(UTF8("texture_matrix_0")),
			get_texture_matrix(0));
		writer->write_mat2x3_element(String(UTF8("texture_matrix_1")),
			get_texture_matrix(1));
		writer->write_vec4_element(String(UTF8("color")), get_color());
		writer->write_vec4_element(String(UTF8("dudv_scale_offset")),
			get_dudv_scale_offset());
		writer->write_bool_element(String(UTF8("cast_shadows")),
			get_cast_shadows());
		writer->write_bool_element(String(UTF8("culling")),
			get_culling());
		writer->end_element();
	}
Exemplo n.º 3
0
void setup_gl_matrices()
{
#ifdef USE_OLDGL
	Matrix4x4 modelview = get_world_matrix() * get_view_matrix();
	Matrix4x4 proj = get_projection_matrix();
	Matrix4x4 tex = get_texture_matrix();

	glMatrixMode(GL_TEXTURE);
	glLoadTransposeMatrixf(tex[0]);
	glMatrixMode(GL_PROJECTION);
	glLoadTransposeMatrixf(proj[0]);
	glMatrixMode(GL_MODELVIEW);
	glLoadTransposeMatrixf(modelview[0]);
#endif
}
Exemplo n.º 4
0
	bool MaterialDescription::operator<(const MaterialDescription &material)
		const
	{
		glm::bvec4 cmp4;
		glm::bvec3 cmp3;
		Uint16 i, j;

		if (get_effect() != material.get_effect())
		{
			return get_effect() < material.get_effect();
		}

		for (i = 0; i < material_texture_count; ++i)
		{
			if (get_texture(i) != material.get_texture(i))
			{
				return get_texture(i) <
					material.get_texture(i);
			}
		}

		for (i = 0; i < 2; ++i)
		{
			cmp3 = glm::equal(get_texture_matrix(i)[0],
				material.get_texture_matrix(i)[0]);
			
			if (glm::all(cmp3))
			{
				continue;
			}

			for (j = 0; j < 3; ++i)
			{
				if (cmp3[j])
				{
					continue;
				}

				return get_texture_matrix(i)[0][j] <
					material.get_texture_matrix(i)[0][j];
			}

			cmp3 = glm::equal(get_texture_matrix(i)[1],
				material.get_texture_matrix(i)[1]);
			
			if (glm::all(cmp3))
			{
				continue;
			}

			for (j = 0; j < 3; ++i)
			{
				if (cmp3[j])
				{
					continue;
				}

				return get_texture_matrix(i)[1][j] <
					material.get_texture_matrix(i)[1][j];
			}
		}

		for (i = 0; i < 4; ++i)
		{
			if (get_color()[i] != material.get_color()[i])
			{
				
				return get_color()[i] < material.get_color()[i];
			}
		}

		if (get_cast_shadows() != material.get_cast_shadows())
		{
			return get_cast_shadows() < material.get_cast_shadows();
		}

		if (get_culling() != material.get_culling())
		{
			return get_culling() < material.get_culling();
		}

		if (get_script() != material.get_script())
		{
			return get_script() < material.get_script();
		}

		return get_name() < material.get_name();
	}