Main Page   Class Hierarchy   Compound List   Header Files   Compound Members  

ddgeco.h

This is the verbatim text of the ddgeco.h include file.
/*
    Copyright (C) 1997, 1998, 1999, 2000 by Alex Pfaffe, Klaus Hartmann
        (Digital Dawn Graphics Inc)
  
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.
  
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.
  
    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

        Written by Klaus Hartmann.
*/
#ifndef __ddgEco_Class__
#define __ddgEco_Class__

// Include used DDG headers
#include "struct/ddghemap.h"
#include "struct/ddgimage.h"
#include "util/ddgutil.h"

struct ddgEcoLightSource
{
    // Direction vector to the light source
    float   x;
    float   y;
    float   z;

    // RGB intensities of the light
    float   Ir;
    float   Ig;
    float   Ib;
};


struct ddgEcosystem
{
    unsigned char   m_user;

    unsigned char   m_colorR;
    unsigned char   m_colorG;
    unsigned char   m_colorB;

    float           m_elevLine;

    float           m_minSlope;
    float           m_maxSlope;

    float           m_elevSkew;

    float           m_elevSkewAzimuth;

    // Filename of the texture that is to be used for this ecosystem
    char *          mp_texture;
};


struct ddgEcoParams
{
    ddgHeightMap *      mp_heightMap;

    ddgImage *          mp_baseTexture;

    ddgEcosystem *      mp_ecosystems;
    long                m_numEcosystems;

    ddgEcoLightSource * mp_lights;
    long                m_numLights;
    ddgImage *          mp_ecoMap;
    bool                m_filter;
    bool                m_randomAdditions;
};


struct ddgEcoListEntry
{
    public:
        unsigned char   m_user;
        unsigned char   m_colorR;
        unsigned char   m_colorG;
        unsigned char   m_colorB;
        float           m_elevLine;
        float           m_minSlope;
        float           m_maxSlope;
        float           m_elevSkewAzimuth;
        float           m_elevSkew;
        float           m_elevSkewX;
        float           m_elevSkewZ;
        ddgImage *      mp_texture;
};


class ddgEcoSynthesizer
{
    public:
        ddgEcoSynthesizer();
        virtual ~ddgEcoSynthesizer();
        void Destroy();
        bool Initialize(ddgEcoParams& params);
        void Synthesize(bool randomAdditions);
        void FilterTexture();

    private:
        float BiLerp(
            float nwElev,
            float neElev,
            float seElev,
            float swElev,
            float tHorz,
            float tVert);
        void VertexNormal(ddgVector3& normal, long row, long col, float gridSpacing);
        void Illuminate(ddgVector3& intensity, ddgVector3& normal);
        ddgEcoListEntry * Classify(float elev, ddgVector3& normal, unsigned char& index);
        void GetDetailColor(
            unsigned char * p_color,
            ddgEcoListEntry * p_entry, 
            long texX,
            long texY);

    private:
        ddgEcoListEntry *   mp_ecosystems;
        long                m_numEcosystems;
        ddgHeightMap *      mp_heightMap;
        ddgImage *          mp_baseTexture;
        ddgEcoLightSource * mp_lights;
        long                m_numLights;
        ddgImage *          mp_ecoMap;
};


class ddgEco
{
    public:
        ddgEco();
        virtual ~ddgEco();
    public:
        bool Synthesize(ddgEcoParams& params);
    private:
        ddgEcoSynthesizer   m_synthesizer;
};


#endif

Generated at Sun Sep 17 19:27:52 2000 for Digital Dawn Graphics Toolkit by doxygen 0.49-991205 written by Dimitri van Heesch, © 1997-1999