X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fscene%2Fmaterial%2Fmat.hxx;h=a32bde3220cd450a9b1bbe22b9d2d31fcad3d1d3;hb=7fc8c026884b2d0a1b683765c089a9bef5ac47c8;hp=12e545452c6f6e9d2ddcee3daa2b0c17236c9f26;hpb=bb238c4106be86698d83712429069f5db4654998;p=simgear.git diff --git a/simgear/scene/material/mat.hxx b/simgear/scene/material/mat.hxx index 12e54545..a32bde32 100644 --- a/simgear/scene/material/mat.hxx +++ b/simgear/scene/material/mat.hxx @@ -4,7 +4,7 @@ // Written by Curtis Olson, started May 1998. // Overhauled by David Megginson, December 2001 // -// Copyright (C) 1998 - 2000 Curtis L. Olson - curt@flightgear.org +// Copyright (C) 1998 - 2000 Curtis L. Olson - http://www.flightgear.org/~curt // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -33,16 +33,17 @@ #include #include STL_STRING // Standard C++ string library +#include #include #include #include -#include -#include "matobj.hxx" +#include "matmodel.hxx" SG_USING_STD(string); +SG_USING_STD(vector); /** @@ -110,13 +111,19 @@ public: * @return true if the texture loaded, false if it was loaded * already. */ - virtual bool load_texture (); + virtual bool load_texture (int n = -1); /** * Get the textured state. */ - virtual inline ssgSimpleState *get_state () const { return state; } + virtual ssgSimpleState *get_state (int n = -1) const; + + + /** + * Get the number of textures assigned to this material. + */ + virtual inline int get_num() const { return _status.size(); } /** @@ -150,7 +157,7 @@ public: /** * Get a randomly-placed object for this material. */ - virtual SGMatObjectGroup * get_object_group (int index) const { + virtual SGMatModelGroup * get_object_group (int index) const { return object_groups[index]; } @@ -189,6 +196,15 @@ protected: */ virtual void init(); +protected: + + struct _internal_state { + _internal_state( ssgSimpleState *s, const string &t, bool l ) + : state(s), texture_path(t), texture_loaded(l) {} + ssgSimpleState *state; + string texture_path; + bool texture_loaded; + }; private: @@ -197,11 +213,11 @@ private: // Internal state. //////////////////////////////////////////////////////////////////// - // names - string texture_path; + // texture status + vector<_internal_state> _status; - // pointers to ssg states - ssgSimpleState *state; + // Round-robin counter + unsigned int _current_ptr; // texture size double xsize, ysize; @@ -219,10 +235,7 @@ private: sgVec4 ambient, diffuse, specular, emission; double shininess; - // true if texture loading deferred, and not yet loaded - bool texture_loaded; - - vector object_groups; + vector object_groups; // ref count so we can properly delete if we have multiple // pointers to this record