Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/map.cc')
-rw-r--r--src/model/map.cc69
1 files changed, 11 insertions, 58 deletions
diff --git a/src/model/map.cc b/src/model/map.cc
index 45ae3fd..8217f1b 100644
--- a/src/model/map.cc
+++ b/src/model/map.cc
@@ -209,6 +209,7 @@ bool Map::getline()
n = 0;
Plane *plane = new Plane(p1, p2, p3);
+ aux::to_lowercase(texture);
plane->texture() = texture;
if (n > 0)
plane->detail() = true;
@@ -432,65 +433,17 @@ void Map::make_brushface(Plane *face)
if (vl.size() > 2) {
- // default material is none
- unsigned int material = 0;
-
- // default color makes unknown textures hot pink
- math::Color color(1.0f, 0.0, 1.0f, 1.0f);
-
- // translate texture names to color and material
- if (face->texture().compare("colors/white") == 0) {
- color.assign(1.0f);
- } else if (face->texture().compare("colors/grey90") == 0) {
- color.assign(0.9f);
- } else if (face->texture().compare("colors/grey75") == 0) {
- color.assign(0.75f);
- } else if (face->texture().compare("colors/grey50") == 0) {
- color.assign(0.5f);
- } else if (face->texture().compare("colors/grey25") == 0) {
- color.assign(0.25f);
- } else if (face->texture().compare("colors/black") == 0) {
- color.assign(0.0f);
- } else if (face->texture().compare("colors/red") == 0) {
- color.assign(1, 0, 0);
- } else if (face->texture().compare("colors/green") == 0) {
- color.assign(0, 1, 0);
- } else if (face->texture().compare("colors/blue") == 0) {
- color.assign(0, 0, 1);
-
- } else if (face->texture().compare("common/entity") == 0) {
- material |= Material::Primary;
- } else if (face->texture().compare("common/entity_dark") == 0) {
- material |= Material::Primary;
- material |= Material::Dark;
-
- } else if (face->texture().compare("common/entity_second") == 0) {
- material |= Material::Secondary;
- } else if (face->texture().compare("common/entity_second_dark") == 0) {
- material |= Material::Secondary;
- material |= Material::Dark;
-
- } else if (face->texture().compare("common/entity_third") == 0) {
- material |= Material::Tertiary;
- } else if (face->texture().compare("common/entity_thirdy_dark") == 0) {
- material |= Material::Tertiary;
- material |= Material::Dark;
-
- } else if (face->texture().compare("common/engine") == 0) {
- color.assign(1, 0, 0);
- material |= Material::Engine;
- }
-
- // translate surface flags to materials
-
- // surface flag 1 light
- if ((face->surface_flags() & 1) == 1) {
- material |= Material::Light;
- }
+ Material *material = Material::find(face->texture());
+ math::Color color(1.0, 0.0f, 1.0f);
+ if (material) {
+ color.assign(material->color());
+ } else {
+ material = new Material(face->texture());
+ Material::add(material);
+ material->set_color(color);
+ material->set_flags(Material::Bright);
- // surface flag 2 engine
- if ((face->surface_flags() & 2) == 2) {
- material |= Material::Engine;
+ con_warn << "Unkown material '" << face->texture() << "'" << std::endl;
}
// find the list if primitives for the current material, allocate a new one if necessary