Compare commits
212 Commits
main/gingo
...
hg/feature
Author | SHA1 | Date |
---|---|---|
dfighter1985 | 2ca40f10eb | 11 years ago |
dfighter1985 | 681a0bc8f3 | 11 years ago |
dfighter1985 | 43ad0189c6 | 11 years ago |
dfighter1985 | 709c54e485 | 11 years ago |
dfighter1985 | 3a84270a84 | 11 years ago |
dfighter1985 | fb38a7a0a7 | 11 years ago |
dfighter1985 | 2a158e76e1 | 11 years ago |
dfighter1985 | 9c69e1bf84 | 11 years ago |
dfighter1985 | a119d3e1a0 | 11 years ago |
dfighter1985 | 8f2e75415c | 11 years ago |
dfighter1985 | 9c0e1c2449 | 11 years ago |
dfighter1985 | 7f7a3e159b | 11 years ago |
dfighter1985 | 90dc025fd8 | 11 years ago |
dfighter1985 | eb9b3e4f0f | 11 years ago |
dfighter1985 | 1cc71457eb | 11 years ago |
dfighter1985 | ed885d3df6 | 11 years ago |
dfighter1985 | d37b004372 | 11 years ago |
dfighter1985 | a9a9768872 | 11 years ago |
dfighter1985 | f768704cbf | 11 years ago |
dfighter1985 | 6947a58ba1 | 11 years ago |
dfighter1985 | 8276cb0140 | 11 years ago |
dfighter1985 | 82a7237e7d | 11 years ago |
dfighter1985 | c105164eeb | 11 years ago |
dfighter1985 | 982b99d8d0 | 11 years ago |
dfighter1985 | 3b16f096cc | 11 years ago |
dfighter1985 | 32e814ecb6 | 11 years ago |
dfighter1985 | b70ce1eb09 | 11 years ago |
dfighter1985 | ace1b5386b | 11 years ago |
dfighter1985 | cf6d2a88bc | 11 years ago |
dfighter1985 | afb56ea660 | 11 years ago |
dfighter1985 | b0613e334c | 11 years ago |
dfighter1985 | 9d3e3a6a73 | 11 years ago |
dfighter1985 | 7b5aaf7e0f | 11 years ago |
dfighter1985 | 5326324b56 | 11 years ago |
dfighter1985 | 69a4a9f9a5 | 11 years ago |
dfighter1985 | 390d1bb156 | 11 years ago |
dfighter1985 | dbd5185de1 | 11 years ago |
dfighter1985 | 586c25f864 | 11 years ago |
dfighter1985 | 3949c210f6 | 11 years ago |
dfighter1985 | 76204a844d | 11 years ago |
dfighter1985 | b775237215 | 11 years ago |
dfighter1985 | c3c3f154b1 | 11 years ago |
dfighter1985 | 8269ec7be5 | 11 years ago |
dfighter1985 | 11fe86e552 | 11 years ago |
dfighter1985 | 72e7d09113 | 11 years ago |
dfighter1985 | 69c41a31ae | 11 years ago |
dfighter1985 | 0453f30582 | 11 years ago |
dfighter1985 | f194704a28 | 11 years ago |
dfighter1985 | 0ab68ef25f | 11 years ago |
dfighter1985 | 9a647a893c | 11 years ago |
dfighter1985 | 2e4b6bb6ae | 11 years ago |
dfighter1985 | a9a1d17c4f | 11 years ago |
dfighter1985 | 1d71a540ba | 11 years ago |
dfighter1985 | c6bb6ec2a9 | 11 years ago |
dfighter1985 | 6c58856ed7 | 11 years ago |
dfighter1985 | 4ba9d815d4 | 11 years ago |
dfighter1985 | 6f396aa8f7 | 11 years ago |
dfighter1985 | 01ef7fd973 | 11 years ago |
dfighter1985 | 4ec92d2f06 | 11 years ago |
dfighter1985 | 28c4b5b157 | 11 years ago |
dfighter1985 | 354d2b8c65 | 11 years ago |
dfighter1985 | 43817746ec | 11 years ago |
dfighter1985 | 0def5caf54 | 11 years ago |
dfighter1985 | 3c99323ada | 11 years ago |
dfighter1985 | 5fbfe7b17f | 11 years ago |
dfighter1985 | 8d57eac3d4 | 11 years ago |
dfighter1985 | c6b714299a | 11 years ago |
dfighter1985 | bbb4762b77 | 11 years ago |
dfighter1985 | 06d7bd9c74 | 11 years ago |
dfighter1985 | d6558b5b0d | 11 years ago |
dfighter1985 | 37c8b096b1 | 11 years ago |
dfighter1985 | 300cd284d1 | 11 years ago |
dfighter1985 | 36a30e83a0 | 11 years ago |
dfighter1985 | 1acccdb5ef | 11 years ago |
dfighter1985 | 16290f7ff9 | 11 years ago |
dfighter1985 | 882118612d | 11 years ago |
dfighter1985 | 77ae38e452 | 11 years ago |
dfighter1985 | 931c18cb51 | 11 years ago |
dfighter1985 | 34de0b5569 | 11 years ago |
dfighter1985 | a1cf2c640b | 11 years ago |
dfighter1985 | 35429fea43 | 11 years ago |
dfighter1985 | 7307d748ea | 11 years ago |
dfighter1985 | 14aea7acc9 | 11 years ago |
dfighter1985 | eabc209303 | 11 years ago |
dfighter1985 | 888812e72d | 11 years ago |
dfighter1985 | 5bc7ecf799 | 11 years ago |
dfighter1985 | 86482ed82f | 11 years ago |
dfighter1985 | ed23ec247d | 11 years ago |
dfighter1985 | 0ab6322955 | 11 years ago |
dfighter1985 | 997a231bff | 11 years ago |
dfighter1985 | c74e279282 | 11 years ago |
dfighter1985 | e740fd4aeb | 11 years ago |
dfighter1985 | d67640dab6 | 11 years ago |
dfighter1985 | 169ee413df | 11 years ago |
dfighter1985 | f77bcf6981 | 11 years ago |
dfighter1985 | 2c84b164ee | 11 years ago |
dfighter1985 | 750e7b5e8e | 11 years ago |
dfighter1985 | d64dd4f23f | 11 years ago |
dfighter1985 | 6b3b8855ee | 11 years ago |
dfighter1985 | 2ca79259ce | 11 years ago |
dfighter1985 | 1414f4d3c1 | 11 years ago |
dfighter1985 | 12df2fd71c | 11 years ago |
dfighter1985 | 69cc5e48ed | 11 years ago |
dfighter1985 | f6737c8aa4 | 11 years ago |
dfighter1985 | 4f8ac17529 | 11 years ago |
dfighter1985 | c49265b9db | 11 years ago |
dfighter1985 | 7384cdd10a | 11 years ago |
dfighter1985 | 0dcb470a19 | 11 years ago |
dfighter1985 | 46363f1909 | 11 years ago |
dfighter1985 | d67198580a | 11 years ago |
dfighter1985 | 3ca6a98aec | 11 years ago |
dfighter1985 | 9dc91a6ed1 | 11 years ago |
dfighter1985 | 41e84066fb | 11 years ago |
dfighter1985 | f5358f712c | 11 years ago |
dfighter1985 | b3ea9ee787 | 11 years ago |
dfighter1985 | ed5741addd | 11 years ago |
dfighter1985 | f387256984 | 11 years ago |
dfighter1985 | c7e8ebcf05 | 11 years ago |
dfighter1985 | 50bb8c5d60 | 11 years ago |
dfighter1985 | 10aad932db | 11 years ago |
dfighter1985 | dd0a691fb8 | 11 years ago |
dfighter1985 | 90595b5bb6 | 11 years ago |
dfighter1985 | 3aae79c38b | 11 years ago |
dfighter1985 | 6fba0c094a | 11 years ago |
dfighter1985 | c90f51afbe | 11 years ago |
dfighter1985 | 82d29b3e23 | 11 years ago |
dfighter1985 | a81db21e0a | 11 years ago |
dfighter1985 | 932f2bdd27 | 11 years ago |
dfighter1985 | f925666d83 | 11 years ago |
dfighter1985 | b1777ff546 | 11 years ago |
dfighter1985 | f34f4d10d3 | 11 years ago |
dfighter1985 | 15b4be874e | 11 years ago |
dfighter1985 | 31451aa0f6 | 11 years ago |
dfighter1985 | cfc4565b5d | 11 years ago |
dfighter1985 | 6360302a2b | 11 years ago |
dfighter1985 | bb6195f858 | 11 years ago |
dfighter1985 | ee2c14670e | 11 years ago |
dfighter1985 | 44188b58b7 | 11 years ago |
dfighter1985 | 0d98540f2e | 11 years ago |
dfighter1985 | adab29e5a6 | 11 years ago |
dfighter1985 | 5e69d558ec | 11 years ago |
dfighter1985 | b444f69db3 | 11 years ago |
dfighter1985 | e41a15ae30 | 11 years ago |
dfighter1985 | d06f675c08 | 11 years ago |
dfighter1985 | 28c49a0427 | 11 years ago |
dfighter1985 | 5c7540d85e | 11 years ago |
dfighter1985 | 8f45e49fa0 | 11 years ago |
dfighter1985 | 7f0ae42a40 | 11 years ago |
dfighter1985 | e44b663bdb | 11 years ago |
dfighter1985 | 2b5eddbe95 | 11 years ago |
dfighter1985 | 879f2f3a85 | 11 years ago |
dfighter1985 | 40da205b59 | 11 years ago |
dfighter1985 | 296083ba61 | 11 years ago |
dfighter1985 | d5e5775f29 | 11 years ago |
dfighter1985 | dddd531249 | 11 years ago |
dfighter1985 | 1c0d74fc00 | 11 years ago |
dfighter1985 | dcf3ba2785 | 11 years ago |
dfighter1985 | 0c64261e22 | 11 years ago |
dfighter1985 | f94960dffe | 11 years ago |
dfighter1985 | 3ff8613205 | 11 years ago |
dfighter1985 | 7a9ae41fd5 | 11 years ago |
dfighter1985 | ac98c00088 | 11 years ago |
dfighter1985 | 80bcf2026a | 11 years ago |
dfighter1985 | e99c1e2785 | 11 years ago |
dfighter1985 | b776409cc8 | 11 years ago |
dfighter1985 | 6ad18a88f5 | 11 years ago |
dfighter1985 | 37fb2cfcda | 11 years ago |
dfighter1985 | fb3f069a38 | 12 years ago |
dfighter1985 | c8147b301c | 12 years ago |
dfighter1985 | 192e9c058a | 12 years ago |
dfighter1985 | a113c81db3 | 12 years ago |
dfighter1985 | 9306bd71e6 | 12 years ago |
dfighter1985 | c2296a2a93 | 12 years ago |
dfighter1985 | 04dcad32e7 | 12 years ago |
dfighter1985 | a2ccb7e796 | 12 years ago |
dfighter1985 | 6d31a50f5d | 12 years ago |
dfighter1985 | 42bf13dcfd | 12 years ago |
dfighter1985 | 66fb3c1284 | 12 years ago |
dfighter1985 | 8408ddd552 | 12 years ago |
dfighter1985 | 96eb64ecbe | 12 years ago |
dfighter1985 | cc86cdd3ef | 12 years ago |
dfighter1985 | c9cd9cdd3c | 12 years ago |
dfighter1985 | 1f2ff5721e | 12 years ago |
dfighter1985 | 00b47d6a50 | 12 years ago |
dfighter1985 | 128c2a3270 | 12 years ago |
dfighter1985 | a57bb57c58 | 12 years ago |
dfighter1985 | a71e4bc3ed | 12 years ago |
dfighter1985 | 6d79a2cf6f | 12 years ago |
dfighter1985 | 2e6b1a834f | 12 years ago |
dfighter1985 | 9294cdc644 | 12 years ago |
dfighter1985 | ea06a2c656 | 12 years ago |
dfighter1985 | 9ee24b3b93 | 12 years ago |
dfighter1985 | ed267a6587 | 12 years ago |
dfighter1985 | fa3ad050de | 12 years ago |
dfighter1985 | d96b7e2d66 | 12 years ago |
dfighter1985 | c9605dde57 | 12 years ago |
dfighter1985 | 832178a83f | 12 years ago |
dfighter1985 | 94fe455a1a | 12 years ago |
dfighter1985 | 067676c049 | 12 years ago |
dfighter1985 | 02e61b1e1b | 12 years ago |
dfighter1985 | 30f8c9f9e1 | 12 years ago |
dfighter1985 | 8c35946010 | 12 years ago |
dfighter1985 | 85e885f274 | 12 years ago |
dfighter1985 | 26fab0c173 | 12 years ago |
dfighter1985 | 32071d9053 | 12 years ago |
dfighter1985 | 40c95e82ff | 12 years ago |
dfighter1985 | abbc09e19c | 12 years ago |
dfighter1985 | d46944f258 | 12 years ago |
dfighter1985 | e87e265c42 | 12 years ago |
dfighter1985 | 5aec012c5f | 12 years ago |
dfighter1985 | ca52a76e5d | 12 years ago |
dfighter1985 | 8fa5067506 | 12 years ago |
@ -0,0 +1,45 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef DYN_MAT_LOADER_H
|
||||
#define DYN_MAT_LOADER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
class CDynMaterial;
|
||||
|
||||
class CDynMatLoader
|
||||
{
|
||||
public:
|
||||
CDynMatLoader();
|
||||
~CDynMatLoader();
|
||||
|
||||
bool loadFrom( const std::string &fileName );
|
||||
|
||||
CDynMaterial* getDynMat() const{ return mat; }
|
||||
|
||||
private:
|
||||
CDynMaterial *mat;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,121 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef DYN_MATERIAL_H
|
||||
#define DYN_MATERIAL_H
|
||||
|
||||
#include "nel/misc/stream.h"
|
||||
#include "nel/misc/variant.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
/// Rendering property
|
||||
struct SDynMaterialProp
|
||||
{
|
||||
enum EPropertyType
|
||||
{
|
||||
Color,
|
||||
Vector4,
|
||||
Float,
|
||||
Double,
|
||||
Int,
|
||||
Uint,
|
||||
Matrix4,
|
||||
Texture
|
||||
};
|
||||
|
||||
/// Id of the property
|
||||
std::string prop;
|
||||
|
||||
/// Label of the property ( user-friendly name )
|
||||
std::string label;
|
||||
|
||||
/// type of the property ( see EPropertyType )
|
||||
uint8 type;
|
||||
|
||||
NLMISC::CVariant value;
|
||||
|
||||
void serial( NLMISC::IStream &f );
|
||||
};
|
||||
|
||||
|
||||
/// Rendering pass data, contains the rendering properties for the pass
|
||||
struct SRenderPass
|
||||
{
|
||||
public:
|
||||
void addProperty( const SDynMaterialProp &prop );
|
||||
void removeProperty( const std::string &name );
|
||||
bool changeProperty( const std::string &name, const SDynMaterialProp &prop );
|
||||
void setName( const std::string &n ){ name = n; }
|
||||
void getName( std::string &n ) const { n = name; }
|
||||
void getShaderRef( std::string &s ) const{ s = shaderRef; }
|
||||
void setShaderRef( const std::string &s ){ shaderRef = s; }
|
||||
void serial( NLMISC::IStream &f );
|
||||
|
||||
/// Returns the number of properties this pass has
|
||||
uint32 count(){ return properties.size(); }
|
||||
|
||||
/// Clears all properties
|
||||
void clear(){ properties.clear(); }
|
||||
|
||||
const SDynMaterialProp* getProperty( uint32 i ) const;
|
||||
|
||||
private:
|
||||
std::vector< SDynMaterialProp > properties;
|
||||
std::string shaderRef;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// Multi-pass material for rendering using user shaders
|
||||
class CDynMaterial : public NLMISC::IStreamable
|
||||
{
|
||||
public:
|
||||
CDynMaterial();
|
||||
~CDynMaterial();
|
||||
CDynMaterial& operator=( const CDynMaterial &other );
|
||||
|
||||
/// Clears all passes, and then adds a new pass
|
||||
void reconstruct();
|
||||
|
||||
/// Clears all passes
|
||||
void clear();
|
||||
void serial( NLMISC::IStream &f );
|
||||
std::string getClassName(){ return "CDynMaterial"; }
|
||||
|
||||
void addPass( const SRenderPass &pass );
|
||||
void removePass( const std::string &name );
|
||||
void renamePass( const std::string &from, const std::string &to );
|
||||
void movePassUp( const std::string &name );
|
||||
void movePassDown( const std::string &name );
|
||||
|
||||
SRenderPass* getPass( const std::string &name );
|
||||
SRenderPass* getPass( uint32 i );
|
||||
uint32 getPassCount(){ return passes.size(); }
|
||||
void getPassList( std::vector< std::string > &l );
|
||||
|
||||
private:
|
||||
std::vector< SRenderPass* > passes;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,37 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef SHAPE_MAT_SERIALIZER_H
|
||||
#define SHAPE_MAT_SERIALIZER_H
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
class IShape;
|
||||
|
||||
class ShapeMatSerial
|
||||
{
|
||||
public:
|
||||
ShapeMatSerial();
|
||||
~ShapeMatSerial();
|
||||
void setShape( IShape *s ){ shape = s; }
|
||||
void serial( const char *sPath );
|
||||
|
||||
private:
|
||||
IShape *shape;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,44 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef SHADER_LOADER_H
|
||||
#define SHADER_LOADER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
class CUsrShaderManager;
|
||||
|
||||
class CUsrShaderLoader
|
||||
{
|
||||
public:
|
||||
CUsrShaderLoader();
|
||||
~CUsrShaderLoader();
|
||||
void setManager( CUsrShaderManager *mgr ){ manager = mgr; }
|
||||
void loadShaders( const std::string &directory );
|
||||
|
||||
private:
|
||||
void loadShader( const std::string &file );
|
||||
|
||||
CUsrShaderManager *manager;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,65 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef USR_SHADER_MANAGER_H
|
||||
#define USR_SHADER_MANAGER_H
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
class CUsrShaderProgram;
|
||||
class IUsrShaderVisitor;
|
||||
|
||||
/// Manages user defined shaders ( add, remove, change )
|
||||
class CUsrShaderManager
|
||||
{
|
||||
public:
|
||||
CUsrShaderManager();
|
||||
~CUsrShaderManager();
|
||||
|
||||
/// Throw away the currently loaded shaders
|
||||
void clear();
|
||||
|
||||
/// Returns a list of the currently loaded shaders
|
||||
void getShaderList( std::vector< std::string > &v );
|
||||
|
||||
/// Adds a shader
|
||||
bool addShader( CUsrShaderProgram *program );
|
||||
|
||||
/// Removes a shader
|
||||
bool removeShader( const std::string &name );
|
||||
|
||||
/// Changes a shader
|
||||
bool changeShader( const std::string &name, CUsrShaderProgram *program );
|
||||
|
||||
/// Looks up and returns a shader
|
||||
bool getShader( const std::string &name, CUsrShaderProgram *program );
|
||||
|
||||
|
||||
void visitShaders( IUsrShaderVisitor *visitor );
|
||||
void visitShader( const std::string &name, IUsrShaderVisitor *visitor );
|
||||
|
||||
private:
|
||||
std::map< std::string, CUsrShaderProgram* > programs;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,71 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef SHADER_PROGRAM_H
|
||||
#define SHADER_PROGRAM_H
|
||||
|
||||
#include "nel/misc/stream.h"
|
||||
#include <string>
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
class CUsrShaderProgram : public NLMISC::IStreamable
|
||||
{
|
||||
public:
|
||||
CUsrShaderProgram();
|
||||
|
||||
~CUsrShaderProgram();
|
||||
|
||||
std::string getClassName(){ return "CUsrShaderProgram"; }
|
||||
|
||||
void serial( NLMISC::IStream &f );
|
||||
|
||||
void getName( std::string &n ) const{ n = name; }
|
||||
void getDescription( std::string &d ) const{ d = description; }
|
||||
void getVP( std::string &vp ) const{ vp = vertexProgram; }
|
||||
void getFP( std::string &fp ) const{ fp = fragmentProgram; }
|
||||
|
||||
void setName( const std::string &n ){ name = n; }
|
||||
void setDescription( const std::string &d ){ description = d; }
|
||||
void setVP( const std::string &vp ){ vertexProgram = vp; }
|
||||
void setFP( const std::string &fp ){ fragmentProgram = fp; }
|
||||
|
||||
uint32 getVPId() const{ return vpId; }
|
||||
uint32 getFPId() const{ return fpId; }
|
||||
uint32 getPId() const{ return pId; }
|
||||
|
||||
void setVPId( uint32 id ){ vpId = id; }
|
||||
void setFPId( uint32 id ){ fpId = id;}
|
||||
void setPid( uint32 id ){ pId = id; }
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
std::string description;
|
||||
std::string vertexProgram;
|
||||
std::string fragmentProgram;
|
||||
|
||||
|
||||
uint32 vpId;
|
||||
uint32 fpId;
|
||||
uint32 pId;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,50 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef USR_SHADER_SAVER_H
|
||||
#define USR_SHADER_SAVER_H
|
||||
|
||||
#include "nel/3d/usr_shader_visitor.h"
|
||||
#include <string>
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
class CUsrShaderProgram;
|
||||
class CUsrShaderManager;
|
||||
|
||||
class CUsrShaderSaver : public IUsrShaderVisitor
|
||||
{
|
||||
public:
|
||||
CUsrShaderSaver();
|
||||
~CUsrShaderSaver();
|
||||
|
||||
void setManager( CUsrShaderManager *mgr ){ manager = mgr; }
|
||||
|
||||
void visit( CUsrShaderProgram *program );
|
||||
|
||||
void saveShaders( const std::string &directory );
|
||||
void saveShader( const std::string &directory, const std::string &name );
|
||||
|
||||
private:
|
||||
CUsrShaderManager *manager;
|
||||
std::string outputDir;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,40 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef USR_SHADER_VISITOR_H
|
||||
#define USR_SHADER_VISITOR_H
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
class CUsrShaderProgram;
|
||||
|
||||
class IUsrShaderVisitor
|
||||
{
|
||||
public:
|
||||
IUsrShaderVisitor(){}
|
||||
~IUsrShaderVisitor(){}
|
||||
|
||||
virtual void visit( CUsrShaderProgram *program ) = 0;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,109 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef NLVARIANT_H
|
||||
#define NLVARIANT_H
|
||||
|
||||
#include "nel/misc/stream.h"
|
||||
#include <string>
|
||||
|
||||
#define VARIANT_VVAL_END 16
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
class CVariant : public IStreamable
|
||||
{
|
||||
public:
|
||||
|
||||
enum EVarType
|
||||
{
|
||||
Float,
|
||||
Double,
|
||||
Int,
|
||||
UInt,
|
||||
String,
|
||||
Vector4,
|
||||
Matrix4
|
||||
};
|
||||
|
||||
CVariant();
|
||||
~CVariant();
|
||||
|
||||
std::string getClassName(){ return "CVariant"; }
|
||||
|
||||
void serial( IStream &f );
|
||||
|
||||
void setDouble( double d ){
|
||||
type = Double;
|
||||
uvalue.dval = d;
|
||||
}
|
||||
|
||||
void setFloat( float f ){
|
||||
type = Float;
|
||||
uvalue.fval = f;
|
||||
}
|
||||
|
||||
void setInt( int i ){
|
||||
type = Int;
|
||||
uvalue.ival = i;
|
||||
}
|
||||
|
||||
void setUInt( unsigned int u ){
|
||||
type = UInt;
|
||||
uvalue.uval = u;
|
||||
}
|
||||
|
||||
void setString( const std::string &s ){
|
||||
type = String;
|
||||
sval = s;
|
||||
}
|
||||
|
||||
void setVector4( const float *v );
|
||||
void setMatrix4( const float *m );
|
||||
|
||||
double toDouble() const{ return uvalue.dval; }
|
||||
float toFloat() const{ return uvalue.fval; }
|
||||
int toInt() const{ return uvalue.ival; }
|
||||
unsigned int toUInt() const{ return uvalue.uval; }
|
||||
std::string toString() const{ return sval; }
|
||||
void getVector4( float *v ) const;
|
||||
void getMatrix4( float *m ) const;
|
||||
|
||||
bool valueAsString( std::string &s ) const;
|
||||
void fromString( const std::string &s, EVarType t );
|
||||
|
||||
EVarType getType() const{ return type; }
|
||||
|
||||
private:
|
||||
|
||||
union{
|
||||
double dval;
|
||||
float fval;
|
||||
int ival;
|
||||
unsigned int uval;
|
||||
float vval[ VARIANT_VVAL_END ];
|
||||
}uvalue;
|
||||
|
||||
std::string sval;
|
||||
|
||||
EVarType type;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,81 @@
|
||||
FIND_PACKAGE(OpenGL REQUIRED)
|
||||
|
||||
IF(NOT WIN32)
|
||||
IF(APPLE)
|
||||
FIND_LIBRARY(CARBON NAMES Carbon)
|
||||
FIND_LIBRARY(COCOA NAMES Cocoa)
|
||||
ELSE(APPLE)
|
||||
FIND_PACKAGE(X11)
|
||||
FIND_PACKAGE(XF86VidMode)
|
||||
ENDIF(APPLE)
|
||||
ENDIF(NOT WIN32)
|
||||
|
||||
FILE(GLOB SRC *.cpp *.h *.def)
|
||||
|
||||
IF(APPLE)
|
||||
FILE(GLOB MAC_SRC mac/*.h mac/*.m mac/*.mm mac/*.cpp)
|
||||
SET(SRC ${SRC} ${MAC_SRC})
|
||||
SET_SOURCE_FILES_PROPERTIES(${SRC}
|
||||
PROPERTIES COMPILE_FLAGS "-x objective-c++")
|
||||
ENDIF(APPLE)
|
||||
|
||||
IF(WIN32)
|
||||
SET(NLDRV_OGL_LIB "nel_drv_opengl3_win")
|
||||
ELSE(WIN32)
|
||||
SET(NLDRV_OGL_LIB "nel_drv_opengl3")
|
||||
ENDIF(WIN32)
|
||||
|
||||
NL_TARGET_DRIVER(${NLDRV_OGL_LIB} ${SRC})
|
||||
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} nel3d nelmisc ${OPENGL_gl_LIBRARY})
|
||||
NL_DEFAULT_PROPS(${NLDRV_OGL_LIB} "NeL, Driver, Video: OpenGL3")
|
||||
NL_ADD_LIB_SUFFIX(${NLDRV_OGL_LIB})
|
||||
NL_ADD_RUNTIME_FLAGS(${NLDRV_OGL_LIB})
|
||||
|
||||
IF(WIN32)
|
||||
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
|
||||
ADD_DEFINITIONS(/DDRIVER_OPENGL_EXPORTS)
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(APPLE)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${CARBON})
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${COCOA})
|
||||
ENDIF(APPLE)
|
||||
|
||||
IF(UNIX AND NOT APPLE)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_X11_LIB})
|
||||
IF(XF86VidMode_FOUND)
|
||||
INCLUDE_DIRECTORIES(${XF86VidMode_INCLUDE_DIR})
|
||||
ADD_DEFINITIONS(${XF86VidMode_DEFINITIONS})
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${XF86VidMode_LIBRARY})
|
||||
ENDIF(XF86VidMode_FOUND)
|
||||
IF(X11_Xrandr_FOUND)
|
||||
INCLUDE_DIRECTORIES(${X11_Xrandr_INCLUDE_PATH})
|
||||
ADD_DEFINITIONS(-DHAVE_XRANDR)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xrandr_LIB})
|
||||
ENDIF(X11_Xrandr_FOUND)
|
||||
IF(X11_Xrender_FOUND)
|
||||
INCLUDE_DIRECTORIES(${X11_Xrender_INCLUDE_PATH})
|
||||
ADD_DEFINITIONS(-DHAVE_XRENDER)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xrender_LIB})
|
||||
ENDIF(X11_Xrender_FOUND)
|
||||
IF(X11_Xcursor_FOUND)
|
||||
INCLUDE_DIRECTORIES(${X11_Xcursor_INCLUDE_PATH})
|
||||
ADD_DEFINITIONS(-DHAVE_XCURSOR)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xcursor_LIB})
|
||||
ENDIF(X11_Xcursor_FOUND)
|
||||
ENDIF(UNIX AND NOT APPLE)
|
||||
|
||||
IF(WITH_PCH)
|
||||
ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.cpp)
|
||||
ENDIF(WITH_PCH)
|
||||
|
||||
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
|
||||
INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_DRIVER_PREFIX} COMPONENT drivers3d)
|
||||
IF(WITH_MAXPLUGIN)
|
||||
INSTALL(TARGETS ${NLDRV_OGL_LIB} RUNTIME DESTINATION maxplugin COMPONENT drivers3d)
|
||||
ENDIF(WITH_MAXPLUGIN)
|
||||
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS)
|
@ -0,0 +1,329 @@
|
||||
/* -*- mode: c; tab-width: 8; -*- */
|
||||
/* vi: set sw=4 ts=8: */
|
||||
/* Reference version of egl.h for EGL 1.4.
|
||||
* $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
|
||||
*/
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2009 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
#ifndef __egl_h_
|
||||
#define __egl_h_
|
||||
|
||||
/* All platform-dependent types and macro boilerplate (such as EGLAPI
|
||||
* and EGLAPIENTRY) should go in eglplatform.h.
|
||||
*/
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* EGL Types */
|
||||
/* EGLint is defined in eglplatform.h */
|
||||
typedef unsigned int EGLBoolean;
|
||||
typedef unsigned int EGLenum;
|
||||
typedef void *EGLConfig;
|
||||
typedef void *EGLContext;
|
||||
typedef void *EGLDisplay;
|
||||
typedef void *EGLSurface;
|
||||
typedef void *EGLClientBuffer;
|
||||
|
||||
/* EGL Versioning */
|
||||
#define EGL_VERSION_1_0 1
|
||||
#define EGL_VERSION_1_1 1
|
||||
#define EGL_VERSION_1_2 1
|
||||
#define EGL_VERSION_1_3 1
|
||||
#define EGL_VERSION_1_4 1
|
||||
|
||||
/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
|
||||
* enums are assigned unique values starting at 0x3000.
|
||||
*/
|
||||
|
||||
/* EGL aliases */
|
||||
#define EGL_FALSE 0
|
||||
#define EGL_TRUE 1
|
||||
|
||||
/* Out-of-band handle values */
|
||||
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
|
||||
#define EGL_NO_CONTEXT ((EGLContext)0)
|
||||
#define EGL_NO_DISPLAY ((EGLDisplay)0)
|
||||
#define EGL_NO_SURFACE ((EGLSurface)0)
|
||||
|
||||
/* Out-of-band attribute value */
|
||||
#define EGL_DONT_CARE ((EGLint)-1)
|
||||
|
||||
/* Errors / GetError return values */
|
||||
#define EGL_SUCCESS 0x3000
|
||||
#define EGL_NOT_INITIALIZED 0x3001
|
||||
#define EGL_BAD_ACCESS 0x3002
|
||||
#define EGL_BAD_ALLOC 0x3003
|
||||
#define EGL_BAD_ATTRIBUTE 0x3004
|
||||
#define EGL_BAD_CONFIG 0x3005
|
||||
#define EGL_BAD_CONTEXT 0x3006
|
||||
#define EGL_BAD_CURRENT_SURFACE 0x3007
|
||||
#define EGL_BAD_DISPLAY 0x3008
|
||||
#define EGL_BAD_MATCH 0x3009
|
||||
#define EGL_BAD_NATIVE_PIXMAP 0x300A
|
||||
#define EGL_BAD_NATIVE_WINDOW 0x300B
|
||||
#define EGL_BAD_PARAMETER 0x300C
|
||||
#define EGL_BAD_SURFACE 0x300D
|
||||
#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */
|
||||
|
||||
/* Reserved 0x300F-0x301F for additional errors */
|
||||
|
||||
/* Config attributes */
|
||||
#define EGL_BUFFER_SIZE 0x3020
|
||||
#define EGL_ALPHA_SIZE 0x3021
|
||||
#define EGL_BLUE_SIZE 0x3022
|
||||
#define EGL_GREEN_SIZE 0x3023
|
||||
#define EGL_RED_SIZE 0x3024
|
||||
#define EGL_DEPTH_SIZE 0x3025
|
||||
#define EGL_STENCIL_SIZE 0x3026
|
||||
#define EGL_CONFIG_CAVEAT 0x3027
|
||||
#define EGL_CONFIG_ID 0x3028
|
||||
#define EGL_LEVEL 0x3029
|
||||
#define EGL_MAX_PBUFFER_HEIGHT 0x302A
|
||||
#define EGL_MAX_PBUFFER_PIXELS 0x302B
|
||||
#define EGL_MAX_PBUFFER_WIDTH 0x302C
|
||||
#define EGL_NATIVE_RENDERABLE 0x302D
|
||||
#define EGL_NATIVE_VISUAL_ID 0x302E
|
||||
#define EGL_NATIVE_VISUAL_TYPE 0x302F
|
||||
#define EGL_SAMPLES 0x3031
|
||||
#define EGL_SAMPLE_BUFFERS 0x3032
|
||||
#define EGL_SURFACE_TYPE 0x3033
|
||||
#define EGL_TRANSPARENT_TYPE 0x3034
|
||||
#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
|
||||
#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
|
||||
#define EGL_TRANSPARENT_RED_VALUE 0x3037
|
||||
#define EGL_NONE 0x3038 /* Attrib list terminator */
|
||||
#define EGL_BIND_TO_TEXTURE_RGB 0x3039
|
||||
#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
|
||||
#define EGL_MIN_SWAP_INTERVAL 0x303B
|
||||
#define EGL_MAX_SWAP_INTERVAL 0x303C
|
||||
#define EGL_LUMINANCE_SIZE 0x303D
|
||||
#define EGL_ALPHA_MASK_SIZE 0x303E
|
||||
#define EGL_COLOR_BUFFER_TYPE 0x303F
|
||||
#define EGL_RENDERABLE_TYPE 0x3040
|
||||
#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */
|
||||
#define EGL_CONFORMANT 0x3042
|
||||
|
||||
/* Reserved 0x3041-0x304F for additional config attributes */
|
||||
|
||||
/* Config attribute values */
|
||||
#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
|
||||
#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */
|
||||
#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
|
||||
#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */
|
||||
#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */
|
||||
|
||||
/* More config attribute values, for EGL_TEXTURE_FORMAT */
|
||||
#define EGL_NO_TEXTURE 0x305C
|
||||
#define EGL_TEXTURE_RGB 0x305D
|
||||
#define EGL_TEXTURE_RGBA 0x305E
|
||||
#define EGL_TEXTURE_2D 0x305F
|
||||
|
||||
/* Config attribute mask bits */
|
||||
#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */
|
||||
#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */
|
||||
|
||||
#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */
|
||||
#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */
|
||||
#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */
|
||||
#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */
|
||||
|
||||
/* QueryString targets */
|
||||
#define EGL_VENDOR 0x3053
|
||||
#define EGL_VERSION 0x3054
|
||||
#define EGL_EXTENSIONS 0x3055
|
||||
#define EGL_CLIENT_APIS 0x308D
|
||||
|
||||
/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
|
||||
#define EGL_HEIGHT 0x3056
|
||||
#define EGL_WIDTH 0x3057
|
||||
#define EGL_LARGEST_PBUFFER 0x3058
|
||||
#define EGL_TEXTURE_FORMAT 0x3080
|
||||
#define EGL_TEXTURE_TARGET 0x3081
|
||||
#define EGL_MIPMAP_TEXTURE 0x3082
|
||||
#define EGL_MIPMAP_LEVEL 0x3083
|
||||
#define EGL_RENDER_BUFFER 0x3086
|
||||
#define EGL_VG_COLORSPACE 0x3087
|
||||
#define EGL_VG_ALPHA_FORMAT 0x3088
|
||||
#define EGL_HORIZONTAL_RESOLUTION 0x3090
|
||||
#define EGL_VERTICAL_RESOLUTION 0x3091
|
||||
#define EGL_PIXEL_ASPECT_RATIO 0x3092
|
||||
#define EGL_SWAP_BEHAVIOR 0x3093
|
||||
#define EGL_MULTISAMPLE_RESOLVE 0x3099
|
||||
|
||||
/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
|
||||
#define EGL_BACK_BUFFER 0x3084
|
||||
#define EGL_SINGLE_BUFFER 0x3085
|
||||
|
||||
/* OpenVG color spaces */
|
||||
#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */
|
||||
#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */
|
||||
|
||||
/* OpenVG alpha formats */
|
||||
#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */
|
||||
|
||||
/* Constant scale factor by which fractional display resolutions &
|
||||
* aspect ratio are scaled when queried as integer values.
|
||||
*/
|
||||
#define EGL_DISPLAY_SCALING 10000
|
||||
|
||||
/* Unknown display resolution/aspect ratio */
|
||||
#define EGL_UNKNOWN ((EGLint)-1)
|
||||
|
||||
/* Back buffer swap behaviors */
|
||||
#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */
|
||||
#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */
|
||||
|
||||
/* CreatePbufferFromClientBuffer buffer types */
|
||||
#define EGL_OPENVG_IMAGE 0x3096
|
||||
|
||||
/* QueryContext targets */
|
||||
#define EGL_CONTEXT_CLIENT_TYPE 0x3097
|
||||
|
||||
/* CreateContext attributes */
|
||||
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
|
||||
|
||||
/* Multisample resolution behaviors */
|
||||
#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */
|
||||
#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */
|
||||
|
||||
/* BindAPI/QueryAPI targets */
|
||||
#define EGL_OPENGL_ES_API 0x30A0
|
||||
#define EGL_OPENVG_API 0x30A1
|
||||
#define EGL_OPENGL_API 0x30A2
|
||||
|
||||
/* GetCurrentSurface targets */
|
||||
#define EGL_DRAW 0x3059
|
||||
#define EGL_READ 0x305A
|
||||
|
||||
/* WaitNative engines */
|
||||
#define EGL_CORE_NATIVE_ENGINE 0x305B
|
||||
|
||||
/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
|
||||
#define EGL_COLORSPACE EGL_VG_COLORSPACE
|
||||
#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT
|
||||
#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB
|
||||
#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR
|
||||
#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE
|
||||
#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
|
||||
|
||||
/* EGL extensions must request enum blocks from the Khronos
|
||||
* API Registrar, who maintains the enumerant registry. Submit
|
||||
* a bug in Khronos Bugzilla against task "Registry".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* EGL Functions */
|
||||
|
||||
EGLAPI EGLint EGLAPIENTRY eglGetError(void);
|
||||
|
||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
|
||||
|
||||
EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
|
||||
EGLint config_size, EGLint *num_config);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
|
||||
EGLConfig *configs, EGLint config_size,
|
||||
EGLint *num_config);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
|
||||
EGLint attribute, EGLint *value);
|
||||
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
|
||||
EGLNativeWindowType win,
|
||||
const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
|
||||
const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
|
||||
EGLNativePixmapType pixmap,
|
||||
const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
|
||||
EGLint attribute, EGLint *value);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
|
||||
EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
|
||||
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
|
||||
EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
|
||||
EGLConfig config, const EGLint *attrib_list);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
|
||||
EGLint attribute, EGLint value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
|
||||
|
||||
|
||||
EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
|
||||
EGLContext share_context,
|
||||
const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
|
||||
EGLSurface read, EGLContext ctx);
|
||||
|
||||
EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
|
||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
|
||||
EGLint attribute, EGLint *value);
|
||||
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
|
||||
EGLNativePixmapType target);
|
||||
|
||||
/* This is a generic function pointer type, whose name indicates it must
|
||||
* be cast to the proper type *and calling convention* before use.
|
||||
*/
|
||||
typedef void (*__eglMustCastToProperFunctionPointerType)(void);
|
||||
|
||||
/* Now, define eglGetProcAddress using the generic function ptr. type */
|
||||
EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
|
||||
eglGetProcAddress(const char *procname);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __egl_h_ */
|
@ -0,0 +1,488 @@
|
||||
#ifndef __eglext_h_
|
||||
#define __eglext_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2012 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/* Header file version number */
|
||||
/* Current version at http://www.khronos.org/registry/egl/ */
|
||||
/* $Revision: 19332 $ on $Date: 2012-09-28 17:56:20 -0700 (Fri, 28 Sep 2012) $ */
|
||||
#define EGL_EGLEXT_VERSION 14
|
||||
|
||||
#ifndef EGL_KHR_config_attribs
|
||||
#define EGL_KHR_config_attribs 1
|
||||
#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */
|
||||
#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_lock_surface
|
||||
#define EGL_KHR_lock_surface 1
|
||||
#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
|
||||
#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
|
||||
#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */
|
||||
#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */
|
||||
#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */
|
||||
#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */
|
||||
#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */
|
||||
#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */
|
||||
#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */
|
||||
#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */
|
||||
#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */
|
||||
#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */
|
||||
#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */
|
||||
#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_image
|
||||
#define EGL_KHR_image 1
|
||||
#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
|
||||
typedef void *EGLImageKHR;
|
||||
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_vg_parent_image
|
||||
#define EGL_KHR_vg_parent_image 1
|
||||
#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_2D_image
|
||||
#define EGL_KHR_gl_texture_2D_image 1
|
||||
#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_cubemap_image
|
||||
#define EGL_KHR_gl_texture_cubemap_image 1
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_3D_image
|
||||
#define EGL_KHR_gl_texture_3D_image 1
|
||||
#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_gl_renderbuffer_image
|
||||
#define EGL_KHR_gl_renderbuffer_image 1
|
||||
#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */
|
||||
#ifndef EGL_KHR_reusable_sync
|
||||
#define EGL_KHR_reusable_sync 1
|
||||
|
||||
typedef void* EGLSyncKHR;
|
||||
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
|
||||
|
||||
#define EGL_SYNC_STATUS_KHR 0x30F1
|
||||
#define EGL_SIGNALED_KHR 0x30F2
|
||||
#define EGL_UNSIGNALED_KHR 0x30F3
|
||||
#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
|
||||
#define EGL_CONDITION_SATISFIED_KHR 0x30F6
|
||||
#define EGL_SYNC_TYPE_KHR 0x30F7
|
||||
#define EGL_SYNC_REUSABLE_KHR 0x30FA
|
||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR <flags> bitfield */
|
||||
#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
|
||||
#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
|
||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_image_base
|
||||
#define EGL_KHR_image_base 1
|
||||
/* Most interfaces defined by EGL_KHR_image_pixmap above */
|
||||
#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_image_pixmap
|
||||
#define EGL_KHR_image_pixmap 1
|
||||
/* Interfaces defined by EGL_KHR_image above */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_IMG_context_priority
|
||||
#define EGL_IMG_context_priority 1
|
||||
#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
|
||||
#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
|
||||
#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
|
||||
#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_lock_surface2
|
||||
#define EGL_KHR_lock_surface2 1
|
||||
#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
|
||||
#endif
|
||||
|
||||
#ifndef EGL_NV_coverage_sample
|
||||
#define EGL_NV_coverage_sample 1
|
||||
#define EGL_COVERAGE_BUFFERS_NV 0x30E0
|
||||
#define EGL_COVERAGE_SAMPLES_NV 0x30E1
|
||||
#endif
|
||||
|
||||
#ifndef EGL_NV_depth_nonlinear
|
||||
#define EGL_NV_depth_nonlinear 1
|
||||
#define EGL_DEPTH_ENCODING_NV 0x30E2
|
||||
#define EGL_DEPTH_ENCODING_NONE_NV 0
|
||||
#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64 /* EGLTimeNV requires 64-bit uint support */
|
||||
#ifndef EGL_NV_sync
|
||||
#define EGL_NV_sync 1
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
|
||||
#define EGL_SYNC_STATUS_NV 0x30E7
|
||||
#define EGL_SIGNALED_NV 0x30E8
|
||||
#define EGL_UNSIGNALED_NV 0x30E9
|
||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
|
||||
#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
|
||||
#define EGL_ALREADY_SIGNALED_NV 0x30EA
|
||||
#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
|
||||
#define EGL_CONDITION_SATISFIED_NV 0x30EC
|
||||
#define EGL_SYNC_TYPE_NV 0x30ED
|
||||
#define EGL_SYNC_CONDITION_NV 0x30EE
|
||||
#define EGL_SYNC_FENCE_NV 0x30EF
|
||||
#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
|
||||
typedef void* EGLSyncNV;
|
||||
typedef khronos_utime_nanoseconds_t EGLTimeNV;
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
|
||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64 /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */
|
||||
#ifndef EGL_KHR_fence_sync
|
||||
#define EGL_KHR_fence_sync 1
|
||||
/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
|
||||
#define EGL_SYNC_CONDITION_KHR 0x30F8
|
||||
#define EGL_SYNC_FENCE_KHR 0x30F9
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EGL_HI_clientpixmap
|
||||
#define EGL_HI_clientpixmap 1
|
||||
|
||||
/* Surface Attribute */
|
||||
#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
|
||||
/*
|
||||
* Structure representing a client pixmap
|
||||
* (pixmap's data is in client-space memory).
|
||||
*/
|
||||
struct EGLClientPixmapHI
|
||||
{
|
||||
void* pData;
|
||||
EGLint iWidth;
|
||||
EGLint iHeight;
|
||||
EGLint iStride;
|
||||
};
|
||||
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
|
||||
#endif /* EGL_HI_clientpixmap */
|
||||
|
||||
#ifndef EGL_HI_colorformats
|
||||
#define EGL_HI_colorformats 1
|
||||
/* Config Attribute */
|
||||
#define EGL_COLOR_FORMAT_HI 0x8F70
|
||||
/* Color Formats */
|
||||
#define EGL_COLOR_RGB_HI 0x8F71
|
||||
#define EGL_COLOR_RGBA_HI 0x8F72
|
||||
#define EGL_COLOR_ARGB_HI 0x8F73
|
||||
#endif /* EGL_HI_colorformats */
|
||||
|
||||
#ifndef EGL_MESA_drm_image
|
||||
#define EGL_MESA_drm_image 1
|
||||
#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* CreateDRMImageMESA attribute */
|
||||
#define EGL_DRM_BUFFER_USE_MESA 0x31D1 /* CreateDRMImageMESA attribute */
|
||||
#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 /* EGL_IMAGE_FORMAT_MESA attribute value */
|
||||
#define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */
|
||||
#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
|
||||
#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 /* EGL_DRM_BUFFER_USE_MESA bits */
|
||||
#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 /* EGL_DRM_BUFFER_USE_MESA bits */
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
|
||||
#endif
|
||||
|
||||
#ifndef EGL_NV_post_sub_buffer
|
||||
#define EGL_NV_post_sub_buffer 1
|
||||
#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
|
||||
#endif
|
||||
|
||||
#ifndef EGL_ANDROID_image_native_buffer
|
||||
#define EGL_ANDROID_image_native_buffer 1
|
||||
struct ANativeWindowBuffer;
|
||||
#define EGL_NATIVE_BUFFER_ANDROID 0x3140 /* eglCreateImageKHR target */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_ANDROID_swap_rectangle
|
||||
#define EGL_ANDROID_swap_rectangle 1
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSetSwapRectangleANDROID (EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSWAPRECTANGLEANDROIDPROC) (EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height);
|
||||
#endif
|
||||
|
||||
#ifndef EGL_ANDROID_recordable
|
||||
#define EGL_ANDROID_recordable 1
|
||||
#define EGL_RECORDABLE_ANDROID 0x3142 /* EGLConfig attribute */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_ANGLE_query_surface_pointer
|
||||
#define EGL_ANGLE_query_surface_pointer 1
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
|
||||
#endif
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
|
||||
#endif
|
||||
|
||||
#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
|
||||
#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
|
||||
#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
|
||||
#endif
|
||||
|
||||
#ifndef EGL_NV_coverage_sample_resolve
|
||||
#define EGL_NV_coverage_sample_resolve 1
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64 /* EGLuint64NV requires 64-bit uint support */
|
||||
#ifndef EGL_NV_system_time
|
||||
#define EGL_NV_system_time 1
|
||||
|
||||
typedef khronos_utime_nanoseconds_t EGLuint64NV;
|
||||
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
|
||||
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
|
||||
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64 /* EGLuint64KHR requires 64-bit uint support */
|
||||
#ifndef EGL_KHR_stream
|
||||
#define EGL_KHR_stream 1
|
||||
typedef void* EGLStreamKHR;
|
||||
typedef khronos_uint64_t EGLuint64KHR;
|
||||
#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
|
||||
#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
|
||||
#define EGL_PRODUCER_FRAME_KHR 0x3212
|
||||
#define EGL_CONSUMER_FRAME_KHR 0x3213
|
||||
#define EGL_STREAM_STATE_KHR 0x3214
|
||||
#define EGL_STREAM_STATE_CREATED_KHR 0x3215
|
||||
#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
|
||||
#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
|
||||
#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
|
||||
#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
|
||||
#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
|
||||
#define EGL_BAD_STREAM_KHR 0x321B
|
||||
#define EGL_BAD_STATE_KHR 0x321C
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC)(EGLDisplay dpy, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
|
||||
#ifndef EGL_KHR_stream_consumer_gltexture
|
||||
#define EGL_KHR_stream_consumer_gltexture 1
|
||||
#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
|
||||
#ifndef EGL_KHR_stream_producer_eglsurface
|
||||
#define EGL_KHR_stream_producer_eglsurface 1
|
||||
#define EGL_STREAM_BIT_KHR 0x0800
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
|
||||
#ifndef EGL_KHR_stream_producer_aldatalocator
|
||||
#define EGL_KHR_stream_producer_aldatalocator 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
|
||||
#ifndef EGL_KHR_stream_fifo
|
||||
#define EGL_KHR_stream_fifo 1
|
||||
/* reuse EGLTimeKHR */
|
||||
#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
|
||||
#define EGL_STREAM_TIME_NOW_KHR 0x31FD
|
||||
#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
|
||||
#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EGL_EXT_create_context_robustness
|
||||
#define EGL_EXT_create_context_robustness 1
|
||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
|
||||
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
|
||||
#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
|
||||
#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
|
||||
#endif
|
||||
|
||||
#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
|
||||
#define EGL_ANGLE_d3d_share_handle_client_buffer 1
|
||||
/* reuse EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_create_context
|
||||
#define EGL_KHR_create_context 1
|
||||
#define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION
|
||||
#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
|
||||
#define EGL_CONTEXT_FLAGS_KHR 0x30FC
|
||||
#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
|
||||
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
|
||||
#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
|
||||
#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
|
||||
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
|
||||
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
|
||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
|
||||
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
|
||||
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
|
||||
#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_surfaceless_context
|
||||
#define EGL_KHR_surfaceless_context 1
|
||||
/* No tokens/entry points, just relaxes an error condition */
|
||||
#endif
|
||||
|
||||
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
|
||||
#ifndef EGL_KHR_stream_cross_process_fd
|
||||
#define EGL_KHR_stream_cross_process_fd 1
|
||||
typedef int EGLNativeFileDescriptorKHR;
|
||||
#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EGL_EXT_multiview_window
|
||||
#define EGL_EXT_multiview_window 1
|
||||
#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,115 @@
|
||||
#ifndef __eglplatform_h_
|
||||
#define __eglplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2009 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Platform-specific types and definitions for egl.h
|
||||
* $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $
|
||||
*
|
||||
* Adopters may modify khrplatform.h and this file to suit their platform.
|
||||
* You are encouraged to submit all modifications to the Khronos group so that
|
||||
* they can be included in future versions of this file. Please submit changes
|
||||
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
|
||||
* by filing a bug against product "EGL" component "Registry".
|
||||
*/
|
||||
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
/* Macros used in EGL function prototype declarations.
|
||||
*
|
||||
* EGL functions should be prototyped as:
|
||||
*
|
||||
* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
|
||||
* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
|
||||
*
|
||||
* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
|
||||
*/
|
||||
|
||||
#ifndef EGLAPI
|
||||
#define EGLAPI KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
#ifndef EGLAPIENTRY
|
||||
#define EGLAPIENTRY KHRONOS_APIENTRY
|
||||
#endif
|
||||
#define EGLAPIENTRYP EGLAPIENTRY*
|
||||
|
||||
/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
|
||||
* are aliases of window-system-dependent types, such as X Display * or
|
||||
* Windows Device Context. They must be defined in platform-specific
|
||||
* code below. The EGL-prefixed versions of Native*Type are the same
|
||||
* types, renamed in EGL 1.3 so all types in the API start with "EGL".
|
||||
*
|
||||
* Khronos STRONGLY RECOMMENDS that you use the default definitions
|
||||
* provided below, since these changes affect both binary and source
|
||||
* portability of applications using EGL running on different EGL
|
||||
* implementations.
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
typedef HDC EGLNativeDisplayType;
|
||||
typedef HBITMAP EGLNativePixmapType;
|
||||
typedef HWND EGLNativeWindowType;
|
||||
|
||||
#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
|
||||
|
||||
typedef int EGLNativeDisplayType;
|
||||
typedef void *EGLNativeWindowType;
|
||||
typedef void *EGLNativePixmapType;
|
||||
|
||||
#elif defined(__unix__)
|
||||
|
||||
/* X11 (tentative) */
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
typedef Display *EGLNativeDisplayType;
|
||||
typedef Pixmap EGLNativePixmapType;
|
||||
typedef Window EGLNativeWindowType;
|
||||
|
||||
#else
|
||||
#error "Platform not recognized"
|
||||
#endif
|
||||
|
||||
/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
|
||||
typedef EGLNativeDisplayType NativeDisplayType;
|
||||
typedef EGLNativePixmapType NativePixmapType;
|
||||
typedef EGLNativeWindowType NativeWindowType;
|
||||
|
||||
|
||||
/* Define EGLint. This must be a signed integral type large enough to contain
|
||||
* all legal attribute names and values passed into and out of EGL, whether
|
||||
* their type is boolean, bitmask, enumerant (symbolic constant), integer,
|
||||
* handle, or other. While in general a 32-bit integer will suffice, if
|
||||
* handles are 64 bit types, then EGLint should be defined as a signed 64-bit
|
||||
* integer type.
|
||||
*/
|
||||
typedef khronos_int32_t EGLint;
|
||||
|
||||
#endif /* __eglplatform_h */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,943 @@
|
||||
#ifndef __wglext_h_
|
||||
#define __wglext_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2012 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Function declaration macros - to move into glplatform.h */
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
#ifndef APIENTRYP
|
||||
#define APIENTRYP APIENTRY *
|
||||
#endif
|
||||
#ifndef GLAPI
|
||||
#define GLAPI extern
|
||||
#endif
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/* Header file version number */
|
||||
/* wglext.h last updated 2012/01/04 */
|
||||
/* Current version at http://www.opengl.org/registry/ */
|
||||
#define WGL_WGLEXT_VERSION 24
|
||||
|
||||
#ifndef WGL_ARB_buffer_region
|
||||
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
|
||||
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
|
||||
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
|
||||
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_multisample
|
||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
||||
#define WGL_SAMPLES_ARB 0x2042
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
|
||||
#define WGL_ACCELERATION_ARB 0x2003
|
||||
#define WGL_NEED_PALETTE_ARB 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
|
||||
#define WGL_SWAP_METHOD_ARB 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
|
||||
#define WGL_TRANSPARENT_ARB 0x200A
|
||||
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
|
||||
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
|
||||
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
|
||||
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
|
||||
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
|
||||
#define WGL_SHARE_DEPTH_ARB 0x200C
|
||||
#define WGL_SHARE_STENCIL_ARB 0x200D
|
||||
#define WGL_SHARE_ACCUM_ARB 0x200E
|
||||
#define WGL_SUPPORT_GDI_ARB 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
||||
#define WGL_STEREO_ARB 0x2012
|
||||
#define WGL_PIXEL_TYPE_ARB 0x2013
|
||||
#define WGL_COLOR_BITS_ARB 0x2014
|
||||
#define WGL_RED_BITS_ARB 0x2015
|
||||
#define WGL_RED_SHIFT_ARB 0x2016
|
||||
#define WGL_GREEN_BITS_ARB 0x2017
|
||||
#define WGL_GREEN_SHIFT_ARB 0x2018
|
||||
#define WGL_BLUE_BITS_ARB 0x2019
|
||||
#define WGL_BLUE_SHIFT_ARB 0x201A
|
||||
#define WGL_ALPHA_BITS_ARB 0x201B
|
||||
#define WGL_ALPHA_SHIFT_ARB 0x201C
|
||||
#define WGL_ACCUM_BITS_ARB 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_ARB 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
|
||||
#define WGL_DEPTH_BITS_ARB 0x2022
|
||||
#define WGL_STENCIL_BITS_ARB 0x2023
|
||||
#define WGL_AUX_BUFFERS_ARB 0x2024
|
||||
#define WGL_NO_ACCELERATION_ARB 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
|
||||
#define WGL_FULL_ACCELERATION_ARB 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_ARB 0x2028
|
||||
#define WGL_SWAP_COPY_ARB 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_ARB 0x202A
|
||||
#define WGL_TYPE_RGBA_ARB 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_ARB 0x202C
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_make_current_read
|
||||
#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
|
||||
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
|
||||
#define WGL_PBUFFER_LARGEST_ARB 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_ARB 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
|
||||
#define WGL_PBUFFER_LOST_ARB 0x2036
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_render_texture
|
||||
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
|
||||
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
|
||||
#define WGL_TEXTURE_FORMAT_ARB 0x2072
|
||||
#define WGL_TEXTURE_TARGET_ARB 0x2073
|
||||
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
|
||||
#define WGL_TEXTURE_RGB_ARB 0x2075
|
||||
#define WGL_TEXTURE_RGBA_ARB 0x2076
|
||||
#define WGL_NO_TEXTURE_ARB 0x2077
|
||||
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
|
||||
#define WGL_TEXTURE_1D_ARB 0x2079
|
||||
#define WGL_TEXTURE_2D_ARB 0x207A
|
||||
#define WGL_MIPMAP_LEVEL_ARB 0x207B
|
||||
#define WGL_CUBE_MAP_FACE_ARB 0x207C
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
|
||||
#define WGL_FRONT_LEFT_ARB 0x2083
|
||||
#define WGL_FRONT_RIGHT_ARB 0x2084
|
||||
#define WGL_BACK_LEFT_ARB 0x2085
|
||||
#define WGL_BACK_RIGHT_ARB 0x2086
|
||||
#define WGL_AUX0_ARB 0x2087
|
||||
#define WGL_AUX1_ARB 0x2088
|
||||
#define WGL_AUX2_ARB 0x2089
|
||||
#define WGL_AUX3_ARB 0x208A
|
||||
#define WGL_AUX4_ARB 0x208B
|
||||
#define WGL_AUX5_ARB 0x208C
|
||||
#define WGL_AUX6_ARB 0x208D
|
||||
#define WGL_AUX7_ARB 0x208E
|
||||
#define WGL_AUX8_ARB 0x208F
|
||||
#define WGL_AUX9_ARB 0x2090
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format_float
|
||||
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_framebuffer_sRGB
|
||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context
|
||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
|
||||
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
|
||||
#define WGL_CONTEXT_FLAGS_ARB 0x2094
|
||||
#define ERROR_INVALID_VERSION_ARB 0x2095
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context_profile
|
||||
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
|
||||
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
|
||||
#define ERROR_INVALID_PROFILE_ARB 0x2096
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context_robustness
|
||||
#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
|
||||
#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
|
||||
#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
|
||||
#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_make_current_read
|
||||
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
|
||||
#define WGL_ACCELERATION_EXT 0x2003
|
||||
#define WGL_NEED_PALETTE_EXT 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
|
||||
#define WGL_SWAP_METHOD_EXT 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
|
||||
#define WGL_TRANSPARENT_EXT 0x200A
|
||||
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
|
||||
#define WGL_SHARE_DEPTH_EXT 0x200C
|
||||
#define WGL_SHARE_STENCIL_EXT 0x200D
|
||||
#define WGL_SHARE_ACCUM_EXT 0x200E
|
||||
#define WGL_SUPPORT_GDI_EXT 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_EXT 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_EXT 0x2011
|
||||
#define WGL_STEREO_EXT 0x2012
|
||||
#define WGL_PIXEL_TYPE_EXT 0x2013
|
||||
#define WGL_COLOR_BITS_EXT 0x2014
|
||||
#define WGL_RED_BITS_EXT 0x2015
|
||||
#define WGL_RED_SHIFT_EXT 0x2016
|
||||
#define WGL_GREEN_BITS_EXT 0x2017
|
||||
#define WGL_GREEN_SHIFT_EXT 0x2018
|
||||
#define WGL_BLUE_BITS_EXT 0x2019
|
||||
#define WGL_BLUE_SHIFT_EXT 0x201A
|
||||
#define WGL_ALPHA_BITS_EXT 0x201B
|
||||
#define WGL_ALPHA_SHIFT_EXT 0x201C
|
||||
#define WGL_ACCUM_BITS_EXT 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_EXT 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
|
||||
#define WGL_DEPTH_BITS_EXT 0x2022
|
||||
#define WGL_STENCIL_BITS_EXT 0x2023
|
||||
#define WGL_AUX_BUFFERS_EXT 0x2024
|
||||
#define WGL_NO_ACCELERATION_EXT 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
|
||||
#define WGL_FULL_ACCELERATION_EXT 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_EXT 0x2028
|
||||
#define WGL_SWAP_COPY_EXT 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_EXT 0x202A
|
||||
#define WGL_TYPE_RGBA_EXT 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_EXT 0x202C
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
|
||||
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
|
||||
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
|
||||
#define WGL_PBUFFER_LARGEST_EXT 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_EXT 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_depth_float
|
||||
#define WGL_DEPTH_FLOAT_EXT 0x2040
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DFX_multisample
|
||||
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
|
||||
#define WGL_SAMPLES_3DFX 0x2061
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_multisample
|
||||
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
|
||||
#define WGL_SAMPLES_EXT 0x2042
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_digital_video_control
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
|
||||
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_gamma
|
||||
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
|
||||
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_genlock
|
||||
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
|
||||
#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045
|
||||
#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046
|
||||
#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_image_buffer
|
||||
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
|
||||
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_lock
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_render_depth_texture
|
||||
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
|
||||
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
|
||||
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
|
||||
#define WGL_DEPTH_COMPONENT_NV 0x20A7
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_render_texture_rectangle
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
|
||||
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ATI_pixel_format_float
|
||||
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_float_buffer
|
||||
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
|
||||
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
|
||||
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
|
||||
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
|
||||
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DL_stereo_control
|
||||
#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
|
||||
#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
|
||||
#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
|
||||
#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format_packed_float
|
||||
#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_framebuffer_sRGB
|
||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_present_video
|
||||
#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_video_out
|
||||
#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
|
||||
#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
|
||||
#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
|
||||
#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
|
||||
#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
|
||||
#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
|
||||
#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
|
||||
#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
|
||||
#define WGL_VIDEO_OUT_FRAME 0x20C8
|
||||
#define WGL_VIDEO_OUT_FIELD_1 0x20C9
|
||||
#define WGL_VIDEO_OUT_FIELD_2 0x20CA
|
||||
#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
|
||||
#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_swap_group
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_gpu_affinity
|
||||
#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
|
||||
#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_AMD_gpu_association
|
||||
#define WGL_GPU_VENDOR_AMD 0x1F00
|
||||
#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
|
||||
#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
|
||||
#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
|
||||
#define WGL_GPU_RAM_AMD 0x21A3
|
||||
#define WGL_GPU_CLOCK_AMD 0x21A4
|
||||
#define WGL_GPU_NUM_PIPES_AMD 0x21A5
|
||||
#define WGL_GPU_NUM_SIMD_AMD 0x21A6
|
||||
#define WGL_GPU_NUM_RB_AMD 0x21A7
|
||||
#define WGL_GPU_NUM_SPI_AMD 0x21A8
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_video_capture
|
||||
#define WGL_UNIQUE_ID_NV 0x20CE
|
||||
#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_copy_image
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_multisample_coverage
|
||||
#define WGL_COVERAGE_SAMPLES_NV 0x2042
|
||||
#define WGL_COLOR_SAMPLES_NV 0x20B9
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_create_context_es2_profile
|
||||
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_DX_interop
|
||||
#define WGL_ACCESS_READ_ONLY_NV 0x00000000
|
||||
#define WGL_ACCESS_READ_WRITE_NV 0x00000001
|
||||
#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_DX_interop2
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_swap_control_tear
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
DECLARE_HANDLE(HPBUFFERARB);
|
||||
#endif
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
DECLARE_HANDLE(HPBUFFEREXT);
|
||||
#endif
|
||||
#ifndef WGL_NV_present_video
|
||||
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
|
||||
#endif
|
||||
#ifndef WGL_NV_video_output
|
||||
DECLARE_HANDLE(HPVIDEODEV);
|
||||
#endif
|
||||
#ifndef WGL_NV_gpu_affinity
|
||||
DECLARE_HANDLE(HPGPUNV);
|
||||
DECLARE_HANDLE(HGPUNV);
|
||||
|
||||
typedef struct _GPU_DEVICE {
|
||||
DWORD cb;
|
||||
CHAR DeviceName[32];
|
||||
CHAR DeviceString[128];
|
||||
DWORD Flags;
|
||||
RECT rcVirtualScreen;
|
||||
} GPU_DEVICE, *PGPU_DEVICE;
|
||||
#endif
|
||||
#ifndef WGL_NV_video_capture
|
||||
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_buffer_region
|
||||
#define WGL_ARB_buffer_region 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
|
||||
extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
|
||||
extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
|
||||
extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
|
||||
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
|
||||
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
|
||||
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_multisample
|
||||
#define WGL_ARB_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#define WGL_ARB_extensions_string 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern const char * WINAPI wglGetExtensionsStringARB (HDC hdc);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format
|
||||
#define WGL_ARB_pixel_format 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||
extern BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_make_current_read
|
||||
#define WGL_ARB_make_current_read 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
extern HDC WINAPI wglGetCurrentReadDCARB (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
#define WGL_ARB_pbuffer 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
|
||||
extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
|
||||
extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_render_texture
|
||||
#define WGL_ARB_render_texture 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format_float
|
||||
#define WGL_ARB_pixel_format_float 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_framebuffer_sRGB
|
||||
#define WGL_ARB_framebuffer_sRGB 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context
|
||||
#define WGL_ARB_create_context 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context_profile
|
||||
#define WGL_ARB_create_context_profile 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_create_context_robustness
|
||||
#define WGL_ARB_create_context_robustness 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_display_color_table
|
||||
#define WGL_EXT_display_color_table 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
|
||||
extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
|
||||
extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
|
||||
extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
|
||||
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_extensions_string
|
||||
#define WGL_EXT_extensions_string 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern const char * WINAPI wglGetExtensionsStringEXT (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_make_current_read
|
||||
#define WGL_EXT_make_current_read 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
extern HDC WINAPI wglGetCurrentReadDCEXT (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
#define WGL_EXT_pbuffer 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
|
||||
extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
|
||||
extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
|
||||
extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format
|
||||
#define WGL_EXT_pixel_format 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
||||
extern BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_swap_control
|
||||
#define WGL_EXT_swap_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglSwapIntervalEXT (int interval);
|
||||
extern int WINAPI wglGetSwapIntervalEXT (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
|
||||
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_depth_float
|
||||
#define WGL_EXT_depth_float 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_vertex_array_range
|
||||
#define WGL_NV_vertex_array_range 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern void* WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
extern void WINAPI wglFreeMemoryNV (void *pointer);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DFX_multisample
|
||||
#define WGL_3DFX_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_multisample
|
||||
#define WGL_EXT_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_OML_sync_control
|
||||
#define WGL_OML_sync_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
extern BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
|
||||
extern INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
extern BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
extern BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_digital_video_control
|
||||
#define WGL_I3D_digital_video_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
|
||||
extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_gamma
|
||||
#define WGL_I3D_gamma 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
|
||||
extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
|
||||
extern BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
||||
extern BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_genlock
|
||||
#define WGL_I3D_genlock 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
|
||||
extern BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
|
||||
extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
|
||||
extern BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
|
||||
extern BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
|
||||
extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
|
||||
extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
|
||||
extern BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
|
||||
extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
|
||||
extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
|
||||
extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
|
||||
extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_image_buffer
|
||||
#define WGL_I3D_image_buffer 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
|
||||
extern BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
|
||||
extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
||||
extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
|
||||
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_lock
|
||||
#define WGL_I3D_swap_frame_lock 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglEnableFrameLockI3D (void);
|
||||
extern BOOL WINAPI wglDisableFrameLockI3D (void);
|
||||
extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
|
||||
extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_usage
|
||||
#define WGL_I3D_swap_frame_usage 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
|
||||
extern BOOL WINAPI wglBeginFrameTrackingI3D (void);
|
||||
extern BOOL WINAPI wglEndFrameTrackingI3D (void);
|
||||
extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
|
||||
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ATI_pixel_format_float
|
||||
#define WGL_ATI_pixel_format_float 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_float_buffer
|
||||
#define WGL_NV_float_buffer 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DL_stereo_control
|
||||
#define WGL_3DL_stereo_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format_packed_float
|
||||
#define WGL_EXT_pixel_format_packed_float 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_framebuffer_sRGB
|
||||
#define WGL_EXT_framebuffer_sRGB 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_present_video
|
||||
#define WGL_NV_present_video 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
|
||||
extern BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
|
||||
extern BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_video_output
|
||||
#define WGL_NV_video_output 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
|
||||
extern BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
|
||||
extern BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
extern BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
extern BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
|
||||
extern BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
|
||||
typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_swap_group
|
||||
#define WGL_NV_swap_group 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
|
||||
extern BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
|
||||
extern BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
|
||||
extern BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
extern BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
|
||||
extern BOOL WINAPI wglResetFrameCountNV (HDC hDC);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
|
||||
typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_gpu_affinity
|
||||
#define WGL_NV_gpu_affinity 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
|
||||
extern BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
||||
extern HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
|
||||
extern BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
||||
extern BOOL WINAPI wglDeleteDCNV (HDC hdc);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
||||
typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
||||
typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_AMD_gpu_association
|
||||
#define WGL_AMD_gpu_association 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
|
||||
extern INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
|
||||
extern UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
|
||||
extern HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
|
||||
extern HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
|
||||
extern BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
|
||||
extern BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
|
||||
extern HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
|
||||
extern VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
|
||||
typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
|
||||
typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
|
||||
typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
|
||||
typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
|
||||
typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
|
||||
typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_video_capture
|
||||
#define WGL_NV_video_capture 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
||||
extern UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
||||
extern BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
extern BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
||||
extern BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
||||
typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
||||
typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_copy_image
|
||||
#define WGL_NV_copy_image 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_multisample_coverage
|
||||
#define WGL_NV_multisample_coverage 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_DX_interop
|
||||
#define WGL_NV_DX_interop 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle);
|
||||
extern HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice);
|
||||
extern BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice);
|
||||
extern HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
||||
extern BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject);
|
||||
extern BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access);
|
||||
extern BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
extern BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);
|
||||
typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
|
||||
typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
||||
typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);
|
||||
typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
|
||||
typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_DX_interop2
|
||||
#define WGL_NV_DX_interop2 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_swap_control_tear
|
||||
#define WGL_EXT_swap_control_tear 1
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Skeleton egl.h to provide compatibility for early GLES 1.0
|
||||
* applications. Several early implementations included gl.h
|
||||
* in egl.h leading applications to include only egl.h
|
||||
*
|
||||
* $Revision: 6252 $ on $Date:: 2008-08-06 16:35:08 -0700 #$
|
||||
*/
|
||||
|
||||
#ifndef __legacy_egl_h_
|
||||
#define __legacy_egl_h_
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES/gl.h>
|
||||
|
||||
#endif /* __legacy_egl_h_ */
|
@ -0,0 +1,770 @@
|
||||
#ifndef __gl_h_
|
||||
#define __gl_h_
|
||||
|
||||
/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */
|
||||
|
||||
#include <GLES/glplatform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This document is licensed under the SGI Free Software B License Version
|
||||
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
|
||||
*/
|
||||
|
||||
typedef void GLvoid;
|
||||
typedef char GLchar;
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef khronos_int8_t GLbyte;
|
||||
typedef short GLshort;
|
||||
typedef int GLint;
|
||||
typedef int GLsizei;
|
||||
typedef khronos_uint8_t GLubyte;
|
||||
typedef unsigned short GLushort;
|
||||
typedef unsigned int GLuint;
|
||||
typedef khronos_float_t GLfloat;
|
||||
typedef khronos_float_t GLclampf;
|
||||
typedef khronos_int32_t GLfixed;
|
||||
typedef khronos_int32_t GLclampx;
|
||||
|
||||
typedef khronos_intptr_t GLintptr;
|
||||
typedef khronos_ssize_t GLsizeiptr;
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/* OpenGL ES core versions */
|
||||
#define GL_VERSION_ES_CM_1_0 1
|
||||
#define GL_VERSION_ES_CL_1_0 1
|
||||
#define GL_VERSION_ES_CM_1_1 1
|
||||
#define GL_VERSION_ES_CL_1_1 1
|
||||
|
||||
/* ClearBufferMask */
|
||||
#define GL_DEPTH_BUFFER_BIT 0x00000100
|
||||
#define GL_STENCIL_BUFFER_BIT 0x00000400
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
|
||||
/* Boolean */
|
||||
#define GL_FALSE 0
|
||||
#define GL_TRUE 1
|
||||
|
||||
/* BeginMode */
|
||||
#define GL_POINTS 0x0000
|
||||
#define GL_LINES 0x0001
|
||||
#define GL_LINE_LOOP 0x0002
|
||||
#define GL_LINE_STRIP 0x0003
|
||||
#define GL_TRIANGLES 0x0004
|
||||
#define GL_TRIANGLE_STRIP 0x0005
|
||||
#define GL_TRIANGLE_FAN 0x0006
|
||||
|
||||
/* AlphaFunction */
|
||||
#define GL_NEVER 0x0200
|
||||
#define GL_LESS 0x0201
|
||||
#define GL_EQUAL 0x0202
|
||||
#define GL_LEQUAL 0x0203
|
||||
#define GL_GREATER 0x0204
|
||||
#define GL_NOTEQUAL 0x0205
|
||||
#define GL_GEQUAL 0x0206
|
||||
#define GL_ALWAYS 0x0207
|
||||
|
||||
/* BlendingFactorDest */
|
||||
#define GL_ZERO 0
|
||||
#define GL_ONE 1
|
||||
#define GL_SRC_COLOR 0x0300
|
||||
#define GL_ONE_MINUS_SRC_COLOR 0x0301
|
||||
#define GL_SRC_ALPHA 0x0302
|
||||
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
|
||||
#define GL_DST_ALPHA 0x0304
|
||||
#define GL_ONE_MINUS_DST_ALPHA 0x0305
|
||||
|
||||
/* BlendingFactorSrc */
|
||||
/* GL_ZERO */
|
||||
/* GL_ONE */
|
||||
#define GL_DST_COLOR 0x0306
|
||||
#define GL_ONE_MINUS_DST_COLOR 0x0307
|
||||
#define GL_SRC_ALPHA_SATURATE 0x0308
|
||||
/* GL_SRC_ALPHA */
|
||||
/* GL_ONE_MINUS_SRC_ALPHA */
|
||||
/* GL_DST_ALPHA */
|
||||
/* GL_ONE_MINUS_DST_ALPHA */
|
||||
|
||||
/* ClipPlaneName */
|
||||
#define GL_CLIP_PLANE0 0x3000
|
||||
#define GL_CLIP_PLANE1 0x3001
|
||||
#define GL_CLIP_PLANE2 0x3002
|
||||
#define GL_CLIP_PLANE3 0x3003
|
||||
#define GL_CLIP_PLANE4 0x3004
|
||||
#define GL_CLIP_PLANE5 0x3005
|
||||
|
||||
/* ColorMaterialFace */
|
||||
/* GL_FRONT_AND_BACK */
|
||||
|
||||
/* ColorMaterialParameter */
|
||||
/* GL_AMBIENT_AND_DIFFUSE */
|
||||
|
||||
/* ColorPointerType */
|
||||
/* GL_UNSIGNED_BYTE */
|
||||
/* GL_FLOAT */
|
||||
/* GL_FIXED */
|
||||
|
||||
/* CullFaceMode */
|
||||
#define GL_FRONT 0x0404
|
||||
#define GL_BACK 0x0405
|
||||
#define GL_FRONT_AND_BACK 0x0408
|
||||
|
||||
/* DepthFunction */
|
||||
/* GL_NEVER */
|
||||
/* GL_LESS */
|
||||
/* GL_EQUAL */
|
||||
/* GL_LEQUAL */
|
||||
/* GL_GREATER */
|
||||
/* GL_NOTEQUAL */
|
||||
/* GL_GEQUAL */
|
||||
/* GL_ALWAYS */
|
||||
|
||||
/* EnableCap */
|
||||
#define GL_FOG 0x0B60
|
||||
#define GL_LIGHTING 0x0B50
|
||||
#define GL_TEXTURE_2D 0x0DE1
|
||||
#define GL_CULL_FACE 0x0B44
|
||||
#define GL_ALPHA_TEST 0x0BC0
|
||||
#define GL_BLEND 0x0BE2
|
||||
#define GL_COLOR_LOGIC_OP 0x0BF2
|
||||
#define GL_DITHER 0x0BD0
|
||||
#define GL_STENCIL_TEST 0x0B90
|
||||
#define GL_DEPTH_TEST 0x0B71
|
||||
/* GL_LIGHT0 */
|
||||
/* GL_LIGHT1 */
|
||||
/* GL_LIGHT2 */
|
||||
/* GL_LIGHT3 */
|
||||
/* GL_LIGHT4 */
|
||||
/* GL_LIGHT5 */
|
||||
/* GL_LIGHT6 */
|
||||
/* GL_LIGHT7 */
|
||||
#define GL_POINT_SMOOTH 0x0B10
|
||||
#define GL_LINE_SMOOTH 0x0B20
|
||||
#define GL_SCISSOR_TEST 0x0C11
|
||||
#define GL_COLOR_MATERIAL 0x0B57
|
||||
#define GL_NORMALIZE 0x0BA1
|
||||
#define GL_RESCALE_NORMAL 0x803A
|
||||
#define GL_POLYGON_OFFSET_FILL 0x8037
|
||||
#define GL_VERTEX_ARRAY 0x8074
|
||||
#define GL_NORMAL_ARRAY 0x8075
|
||||
#define GL_COLOR_ARRAY 0x8076
|
||||
#define GL_TEXTURE_COORD_ARRAY 0x8078
|
||||
#define GL_MULTISAMPLE 0x809D
|
||||
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
|
||||
#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
|
||||
#define GL_SAMPLE_COVERAGE 0x80A0
|
||||
|
||||
/* ErrorCode */
|
||||
#define GL_NO_ERROR 0
|
||||
#define GL_INVALID_ENUM 0x0500
|
||||
#define GL_INVALID_VALUE 0x0501
|
||||
#define GL_INVALID_OPERATION 0x0502
|
||||
#define GL_STACK_OVERFLOW 0x0503
|
||||
#define GL_STACK_UNDERFLOW 0x0504
|
||||
#define GL_OUT_OF_MEMORY 0x0505
|
||||
|
||||
/* FogMode */
|
||||
/* GL_LINEAR */
|
||||
#define GL_EXP 0x0800
|
||||
#define GL_EXP2 0x0801
|
||||
|
||||
/* FogParameter */
|
||||
#define GL_FOG_DENSITY 0x0B62
|
||||
#define GL_FOG_START 0x0B63
|
||||
#define GL_FOG_END 0x0B64
|
||||
#define GL_FOG_MODE 0x0B65
|
||||
#define GL_FOG_COLOR 0x0B66
|
||||
|
||||
/* FrontFaceDirection */
|
||||
#define GL_CW 0x0900
|
||||
#define GL_CCW 0x0901
|
||||
|
||||
/* GetPName */
|
||||
#define GL_CURRENT_COLOR 0x0B00
|
||||
#define GL_CURRENT_NORMAL 0x0B02
|
||||
#define GL_CURRENT_TEXTURE_COORDS 0x0B03
|
||||
#define GL_POINT_SIZE 0x0B11
|
||||
#define GL_POINT_SIZE_MIN 0x8126
|
||||
#define GL_POINT_SIZE_MAX 0x8127
|
||||
#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
|
||||
#define GL_POINT_DISTANCE_ATTENUATION 0x8129
|
||||
#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
|
||||
#define GL_LINE_WIDTH 0x0B21
|
||||
#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
|
||||
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
|
||||
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
|
||||
#define GL_CULL_FACE_MODE 0x0B45
|
||||
#define GL_FRONT_FACE 0x0B46
|
||||
#define GL_SHADE_MODEL 0x0B54
|
||||
#define GL_DEPTH_RANGE 0x0B70
|
||||
#define GL_DEPTH_WRITEMASK 0x0B72
|
||||
#define GL_DEPTH_CLEAR_VALUE 0x0B73
|
||||
#define GL_DEPTH_FUNC 0x0B74
|
||||
#define GL_STENCIL_CLEAR_VALUE 0x0B91
|
||||
#define GL_STENCIL_FUNC 0x0B92
|
||||
#define GL_STENCIL_VALUE_MASK 0x0B93
|
||||
#define GL_STENCIL_FAIL 0x0B94
|
||||
#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
|
||||
#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
|
||||
#define GL_STENCIL_REF 0x0B97
|
||||
#define GL_STENCIL_WRITEMASK 0x0B98
|
||||
#define GL_MATRIX_MODE 0x0BA0
|
||||
#define GL_VIEWPORT 0x0BA2
|
||||
#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
|
||||
#define GL_PROJECTION_STACK_DEPTH 0x0BA4
|
||||
#define GL_TEXTURE_STACK_DEPTH 0x0BA5
|
||||
#define GL_MODELVIEW_MATRIX 0x0BA6
|
||||
#define GL_PROJECTION_MATRIX 0x0BA7
|
||||
#define GL_TEXTURE_MATRIX 0x0BA8
|
||||
#define GL_ALPHA_TEST_FUNC 0x0BC1
|
||||
#define GL_ALPHA_TEST_REF 0x0BC2
|
||||
#define GL_BLEND_DST 0x0BE0
|
||||
#define GL_BLEND_SRC 0x0BE1
|
||||
#define GL_LOGIC_OP_MODE 0x0BF0
|
||||
#define GL_SCISSOR_BOX 0x0C10
|
||||
#define GL_SCISSOR_TEST 0x0C11
|
||||
#define GL_COLOR_CLEAR_VALUE 0x0C22
|
||||
#define GL_COLOR_WRITEMASK 0x0C23
|
||||
#define GL_UNPACK_ALIGNMENT 0x0CF5
|
||||
#define GL_PACK_ALIGNMENT 0x0D05
|
||||
#define GL_MAX_LIGHTS 0x0D31
|
||||
#define GL_MAX_CLIP_PLANES 0x0D32
|
||||
#define GL_MAX_TEXTURE_SIZE 0x0D33
|
||||
#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
|
||||
#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
|
||||
#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
|
||||
#define GL_MAX_VIEWPORT_DIMS 0x0D3A
|
||||
#define GL_MAX_TEXTURE_UNITS 0x84E2
|
||||
#define GL_SUBPIXEL_BITS 0x0D50
|
||||
#define GL_RED_BITS 0x0D52
|
||||
#define GL_GREEN_BITS 0x0D53
|
||||
#define GL_BLUE_BITS 0x0D54
|
||||
#define GL_ALPHA_BITS 0x0D55
|
||||
#define GL_DEPTH_BITS 0x0D56
|
||||
#define GL_STENCIL_BITS 0x0D57
|
||||
#define GL_POLYGON_OFFSET_UNITS 0x2A00
|
||||
#define GL_POLYGON_OFFSET_FILL 0x8037
|
||||
#define GL_POLYGON_OFFSET_FACTOR 0x8038
|
||||
#define GL_TEXTURE_BINDING_2D 0x8069
|
||||
#define GL_VERTEX_ARRAY_SIZE 0x807A
|
||||
#define GL_VERTEX_ARRAY_TYPE 0x807B
|
||||
#define GL_VERTEX_ARRAY_STRIDE 0x807C
|
||||
#define GL_NORMAL_ARRAY_TYPE 0x807E
|
||||
#define GL_NORMAL_ARRAY_STRIDE 0x807F
|
||||
#define GL_COLOR_ARRAY_SIZE 0x8081
|
||||
#define GL_COLOR_ARRAY_TYPE 0x8082
|
||||
#define GL_COLOR_ARRAY_STRIDE 0x8083
|
||||
#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
|
||||
#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
|
||||
#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
|
||||
#define GL_VERTEX_ARRAY_POINTER 0x808E
|
||||
#define GL_NORMAL_ARRAY_POINTER 0x808F
|
||||
#define GL_COLOR_ARRAY_POINTER 0x8090
|
||||
#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
|
||||
#define GL_SAMPLE_BUFFERS 0x80A8
|
||||
#define GL_SAMPLES 0x80A9
|
||||
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
|
||||
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
|
||||
|
||||
/* GetTextureParameter */
|
||||
/* GL_TEXTURE_MAG_FILTER */
|
||||
/* GL_TEXTURE_MIN_FILTER */
|
||||
/* GL_TEXTURE_WRAP_S */
|
||||
/* GL_TEXTURE_WRAP_T */
|
||||
|
||||
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
|
||||
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
|
||||
|
||||
/* HintMode */
|
||||
#define GL_DONT_CARE 0x1100
|
||||
#define GL_FASTEST 0x1101
|
||||
#define GL_NICEST 0x1102
|
||||
|
||||
/* HintTarget */
|
||||
#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
|
||||
#define GL_POINT_SMOOTH_HINT 0x0C51
|
||||
#define GL_LINE_SMOOTH_HINT 0x0C52
|
||||
#define GL_FOG_HINT 0x0C54
|
||||
#define GL_GENERATE_MIPMAP_HINT 0x8192
|
||||
|
||||
/* LightModelParameter */
|
||||
#define GL_LIGHT_MODEL_AMBIENT 0x0B53
|
||||
#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
|
||||
|
||||
/* LightParameter */
|
||||
#define GL_AMBIENT 0x1200
|
||||
#define GL_DIFFUSE 0x1201
|
||||
#define GL_SPECULAR 0x1202
|
||||
#define GL_POSITION 0x1203
|
||||
#define GL_SPOT_DIRECTION 0x1204
|
||||
#define GL_SPOT_EXPONENT 0x1205
|
||||
#define GL_SPOT_CUTOFF 0x1206
|
||||
#define GL_CONSTANT_ATTENUATION 0x1207
|
||||
#define GL_LINEAR_ATTENUATION 0x1208
|
||||
#define GL_QUADRATIC_ATTENUATION 0x1209
|
||||
|
||||
/* DataType */
|
||||
#define GL_BYTE 0x1400
|
||||
#define GL_UNSIGNED_BYTE 0x1401
|
||||
#define GL_SHORT 0x1402
|
||||
#define GL_UNSIGNED_SHORT 0x1403
|
||||
#define GL_FLOAT 0x1406
|
||||
#define GL_FIXED 0x140C
|
||||
|
||||
/* LogicOp */
|
||||
#define GL_CLEAR 0x1500
|
||||
#define GL_AND 0x1501
|
||||
#define GL_AND_REVERSE 0x1502
|
||||
#define GL_COPY 0x1503
|
||||
#define GL_AND_INVERTED 0x1504
|
||||
#define GL_NOOP 0x1505
|
||||
#define GL_XOR 0x1506
|
||||
#define GL_OR 0x1507
|
||||
#define GL_NOR 0x1508
|
||||
#define GL_EQUIV 0x1509
|
||||
#define GL_INVERT 0x150A
|
||||
#define GL_OR_REVERSE 0x150B
|
||||
#define GL_COPY_INVERTED 0x150C
|
||||
#define GL_OR_INVERTED 0x150D
|
||||
#define GL_NAND 0x150E
|
||||
#define GL_SET 0x150F
|
||||
|
||||
/* MaterialFace */
|
||||
/* GL_FRONT_AND_BACK */
|
||||
|
||||
/* MaterialParameter */
|
||||
#define GL_EMISSION 0x1600
|
||||
#define GL_SHININESS 0x1601
|
||||
#define GL_AMBIENT_AND_DIFFUSE 0x1602
|
||||
/* GL_AMBIENT */
|
||||
/* GL_DIFFUSE */
|
||||
/* GL_SPECULAR */
|
||||
|
||||
/* MatrixMode */
|
||||
#define GL_MODELVIEW 0x1700
|
||||
#define GL_PROJECTION 0x1701
|
||||
#define GL_TEXTURE 0x1702
|
||||
|
||||
/* NormalPointerType */
|
||||
/* GL_BYTE */
|
||||
/* GL_SHORT */
|
||||
/* GL_FLOAT */
|
||||
/* GL_FIXED */
|
||||
|
||||
/* PixelFormat */
|
||||
#define GL_ALPHA 0x1906
|
||||
#define GL_RGB 0x1907
|
||||
#define GL_RGBA 0x1908
|
||||
#define GL_LUMINANCE 0x1909
|
||||
#define GL_LUMINANCE_ALPHA 0x190A
|
||||
|
||||
/* PixelStoreParameter */
|
||||
#define GL_UNPACK_ALIGNMENT 0x0CF5
|
||||
#define GL_PACK_ALIGNMENT 0x0D05
|
||||
|
||||
/* PixelType */
|
||||
/* GL_UNSIGNED_BYTE */
|
||||
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
|
||||
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
|
||||
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
|
||||
|
||||
/* ShadingModel */
|
||||
#define GL_FLAT 0x1D00
|
||||
#define GL_SMOOTH 0x1D01
|
||||
|
||||
/* StencilFunction */
|
||||
/* GL_NEVER */
|
||||
/* GL_LESS */
|
||||
/* GL_EQUAL */
|
||||
/* GL_LEQUAL */
|
||||
/* GL_GREATER */
|
||||
/* GL_NOTEQUAL */
|
||||
/* GL_GEQUAL */
|
||||
/* GL_ALWAYS */
|
||||
|
||||
/* StencilOp */
|
||||
/* GL_ZERO */
|
||||
#define GL_KEEP 0x1E00
|
||||
#define GL_REPLACE 0x1E01
|
||||
#define GL_INCR 0x1E02
|
||||
#define GL_DECR 0x1E03
|
||||
/* GL_INVERT */
|
||||
|
||||
/* StringName */
|
||||
#define GL_VENDOR 0x1F00
|
||||
#define GL_RENDERER 0x1F01
|
||||
#define GL_VERSION 0x1F02
|
||||
#define GL_EXTENSIONS 0x1F03
|
||||
|
||||
/* TexCoordPointerType */
|
||||
/* GL_SHORT */
|
||||
/* GL_FLOAT */
|
||||
/* GL_FIXED */
|
||||
/* GL_BYTE */
|
||||
|
||||
/* TextureEnvMode */
|
||||
#define GL_MODULATE 0x2100
|
||||
#define GL_DECAL 0x2101
|
||||
/* GL_BLEND */
|
||||
#define GL_ADD 0x0104
|
||||
/* GL_REPLACE */
|
||||
|
||||
/* TextureEnvParameter */
|
||||
#define GL_TEXTURE_ENV_MODE 0x2200
|
||||
#define GL_TEXTURE_ENV_COLOR 0x2201
|
||||
|
||||
/* TextureEnvTarget */
|
||||
#define GL_TEXTURE_ENV 0x2300
|
||||
|
||||
/* TextureMagFilter */
|
||||
#define GL_NEAREST 0x2600
|
||||
#define GL_LINEAR 0x2601
|
||||
|
||||
/* TextureMinFilter */
|
||||
/* GL_NEAREST */
|
||||
/* GL_LINEAR */
|
||||
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
|
||||
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
|
||||
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
|
||||
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
|
||||
|
||||
/* TextureParameterName */
|
||||
#define GL_TEXTURE_MAG_FILTER 0x2800
|
||||
#define GL_TEXTURE_MIN_FILTER 0x2801
|
||||
#define GL_TEXTURE_WRAP_S 0x2802
|
||||
#define GL_TEXTURE_WRAP_T 0x2803
|
||||
#define GL_GENERATE_MIPMAP 0x8191
|
||||
|
||||
/* TextureTarget */
|
||||
/* GL_TEXTURE_2D */
|
||||
|
||||
/* TextureUnit */
|
||||
#define GL_TEXTURE0 0x84C0
|
||||
#define GL_TEXTURE1 0x84C1
|
||||
#define GL_TEXTURE2 0x84C2
|
||||
#define GL_TEXTURE3 0x84C3
|
||||
#define GL_TEXTURE4 0x84C4
|
||||
#define GL_TEXTURE5 0x84C5
|
||||
#define GL_TEXTURE6 0x84C6
|
||||
#define GL_TEXTURE7 0x84C7
|
||||
#define GL_TEXTURE8 0x84C8
|
||||
#define GL_TEXTURE9 0x84C9
|
||||
#define GL_TEXTURE10 0x84CA
|
||||
#define GL_TEXTURE11 0x84CB
|
||||
#define GL_TEXTURE12 0x84CC
|
||||
#define GL_TEXTURE13 0x84CD
|
||||
#define GL_TEXTURE14 0x84CE
|
||||
#define GL_TEXTURE15 0x84CF
|
||||
#define GL_TEXTURE16 0x84D0
|
||||
#define GL_TEXTURE17 0x84D1
|
||||
#define GL_TEXTURE18 0x84D2
|
||||
#define GL_TEXTURE19 0x84D3
|
||||
#define GL_TEXTURE20 0x84D4
|
||||
#define GL_TEXTURE21 0x84D5
|
||||
#define GL_TEXTURE22 0x84D6
|
||||
#define GL_TEXTURE23 0x84D7
|
||||
#define GL_TEXTURE24 0x84D8
|
||||
#define GL_TEXTURE25 0x84D9
|
||||
#define GL_TEXTURE26 0x84DA
|
||||
#define GL_TEXTURE27 0x84DB
|
||||
#define GL_TEXTURE28 0x84DC
|
||||
#define GL_TEXTURE29 0x84DD
|
||||
#define GL_TEXTURE30 0x84DE
|
||||
#define GL_TEXTURE31 0x84DF
|
||||
#define GL_ACTIVE_TEXTURE 0x84E0
|
||||
#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
|
||||
|
||||
/* TextureWrapMode */
|
||||
#define GL_REPEAT 0x2901
|
||||
#define GL_CLAMP_TO_EDGE 0x812F
|
||||
|
||||
/* VertexPointerType */
|
||||
/* GL_SHORT */
|
||||
/* GL_FLOAT */
|
||||
/* GL_FIXED */
|
||||
/* GL_BYTE */
|
||||
|
||||
/* LightName */
|
||||
#define GL_LIGHT0 0x4000
|
||||
#define GL_LIGHT1 0x4001
|
||||
#define GL_LIGHT2 0x4002
|
||||
#define GL_LIGHT3 0x4003
|
||||
#define GL_LIGHT4 0x4004
|
||||
#define GL_LIGHT5 0x4005
|
||||
#define GL_LIGHT6 0x4006
|
||||
#define GL_LIGHT7 0x4007
|
||||
|
||||
/* Buffer Objects */
|
||||
#define GL_ARRAY_BUFFER 0x8892
|
||||
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
|
||||
|
||||
#define GL_ARRAY_BUFFER_BINDING 0x8894
|
||||
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
|
||||
#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
|
||||
#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
|
||||
#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
|
||||
#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
|
||||
|
||||
#define GL_STATIC_DRAW 0x88E4
|
||||
#define GL_DYNAMIC_DRAW 0x88E8
|
||||
|
||||
#define GL_BUFFER_SIZE 0x8764
|
||||
#define GL_BUFFER_USAGE 0x8765
|
||||
|
||||
/* Texture combine + dot3 */
|
||||
#define GL_SUBTRACT 0x84E7
|
||||
#define GL_COMBINE 0x8570
|
||||
#define GL_COMBINE_RGB 0x8571
|
||||
#define GL_COMBINE_ALPHA 0x8572
|
||||
#define GL_RGB_SCALE 0x8573
|
||||
#define GL_ADD_SIGNED 0x8574
|
||||
#define GL_INTERPOLATE 0x8575
|
||||
#define GL_CONSTANT 0x8576
|
||||
#define GL_PRIMARY_COLOR 0x8577
|
||||
#define GL_PREVIOUS 0x8578
|
||||
#define GL_OPERAND0_RGB 0x8590
|
||||
#define GL_OPERAND1_RGB 0x8591
|
||||
#define GL_OPERAND2_RGB 0x8592
|
||||
#define GL_OPERAND0_ALPHA 0x8598
|
||||
#define GL_OPERAND1_ALPHA 0x8599
|
||||
#define GL_OPERAND2_ALPHA 0x859A
|
||||
|
||||
#define GL_ALPHA_SCALE 0x0D1C
|
||||
|
||||
#define GL_SRC0_RGB 0x8580
|
||||
#define GL_SRC1_RGB 0x8581
|
||||
#define GL_SRC2_RGB 0x8582
|
||||
#define GL_SRC0_ALPHA 0x8588
|
||||
#define GL_SRC1_ALPHA 0x8589
|
||||
#define GL_SRC2_ALPHA 0x858A
|
||||
|
||||
#define GL_DOT3_RGB 0x86AE
|
||||
#define GL_DOT3_RGBA 0x86AF
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* required OES extension tokens
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* OES_read_format */
|
||||
#ifndef GL_OES_read_format
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
|
||||
#endif
|
||||
|
||||
/* GL_OES_compressed_paletted_texture */
|
||||
#ifndef GL_OES_compressed_paletted_texture
|
||||
#define GL_PALETTE4_RGB8_OES 0x8B90
|
||||
#define GL_PALETTE4_RGBA8_OES 0x8B91
|
||||
#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
|
||||
#define GL_PALETTE4_RGBA4_OES 0x8B93
|
||||
#define GL_PALETTE4_RGB5_A1_OES 0x8B94
|
||||
#define GL_PALETTE8_RGB8_OES 0x8B95
|
||||
#define GL_PALETTE8_RGBA8_OES 0x8B96
|
||||
#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
|
||||
#define GL_PALETTE8_RGBA4_OES 0x8B98
|
||||
#define GL_PALETTE8_RGB5_A1_OES 0x8B99
|
||||
#endif
|
||||
|
||||
/* OES_point_size_array */
|
||||
#ifndef GL_OES_point_size_array
|
||||
#define GL_POINT_SIZE_ARRAY_OES 0x8B9C
|
||||
#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A
|
||||
#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B
|
||||
#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C
|
||||
#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F
|
||||
#endif
|
||||
|
||||
/* GL_OES_point_sprite */
|
||||
#ifndef GL_OES_point_sprite
|
||||
#define GL_POINT_SPRITE_OES 0x8861
|
||||
#define GL_COORD_REPLACE_OES 0x8862
|
||||
#endif
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/* Available only in Common profile */
|
||||
GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLclampf ref);
|
||||
GL_API void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
GL_API void GL_APIENTRY glClearDepthf (GLclampf depth);
|
||||
GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation);
|
||||
GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
GL_API void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
|
||||
GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
|
||||
GL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat eqn[4]);
|
||||
GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glGetTexEnvfv (GLenum env, GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
|
||||
GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glLineWidth (GLfloat width);
|
||||
GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m);
|
||||
GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m);
|
||||
GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
|
||||
GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
|
||||
GL_API void GL_APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
|
||||
GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glPointSize (GLfloat size);
|
||||
GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
|
||||
GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
|
||||
GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
|
||||
GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);
|
||||
|
||||
/* Available in both Common and Common-Lite profiles */
|
||||
GL_API void GL_APIENTRY glActiveTexture (GLenum texture);
|
||||
GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref);
|
||||
GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
|
||||
GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
|
||||
GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
|
||||
GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
|
||||
GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
|
||||
GL_API void GL_APIENTRY glClear (GLbitfield mask);
|
||||
GL_API void GL_APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
|
||||
GL_API void GL_APIENTRY glClearDepthx (GLclampx depth);
|
||||
GL_API void GL_APIENTRY glClearStencil (GLint s);
|
||||
GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture);
|
||||
GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation);
|
||||
GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
|
||||
GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
|
||||
GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
GL_API void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_API void GL_APIENTRY glCullFace (GLenum mode);
|
||||
GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
|
||||
GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
|
||||
GL_API void GL_APIENTRY glDepthFunc (GLenum func);
|
||||
GL_API void GL_APIENTRY glDepthMask (GLboolean flag);
|
||||
GL_API void GL_APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar);
|
||||
GL_API void GL_APIENTRY glDisable (GLenum cap);
|
||||
GL_API void GL_APIENTRY glDisableClientState (GLenum array);
|
||||
GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
|
||||
GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
|
||||
GL_API void GL_APIENTRY glEnable (GLenum cap);
|
||||
GL_API void GL_APIENTRY glEnableClientState (GLenum array);
|
||||
GL_API void GL_APIENTRY glFinish (void);
|
||||
GL_API void GL_APIENTRY glFlush (void);
|
||||
GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glFrontFace (GLenum mode);
|
||||
GL_API void GL_APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
|
||||
GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *params);
|
||||
GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed eqn[4]);
|
||||
GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
|
||||
GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
|
||||
GL_API GLenum GL_APIENTRY glGetError (void);
|
||||
GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetPointerv (GLenum pname, GLvoid **params);
|
||||
GL_API const GLubyte * GL_APIENTRY glGetString (GLenum name);
|
||||
GL_API void GL_APIENTRY glGetTexEnviv (GLenum env, GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params);
|
||||
GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode);
|
||||
GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
|
||||
GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
|
||||
GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture);
|
||||
GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glLineWidthx (GLfixed width);
|
||||
GL_API void GL_APIENTRY glLoadIdentity (void);
|
||||
GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m);
|
||||
GL_API void GL_APIENTRY glLogicOp (GLenum opcode);
|
||||
GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glMatrixMode (GLenum mode);
|
||||
GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m);
|
||||
GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
|
||||
GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);
|
||||
GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
GL_API void GL_APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
|
||||
GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
|
||||
GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glPointSizex (GLfixed size);
|
||||
GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units);
|
||||
GL_API void GL_APIENTRY glPopMatrix (void);
|
||||
GL_API void GL_APIENTRY glPushMatrix (void);
|
||||
GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
|
||||
GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
|
||||
GL_API void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
|
||||
GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert);
|
||||
GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z);
|
||||
GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_API void GL_APIENTRY glShadeModel (GLenum mode);
|
||||
GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
|
||||
GL_API void GL_APIENTRY glStencilMask (GLuint mask);
|
||||
GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
|
||||
GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);
|
||||
GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);
|
||||
GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
|
||||
GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param);
|
||||
GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
|
||||
GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params);
|
||||
GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
|
||||
GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* Required OES extension functions
|
||||
*------------------------------------------------------------------------*/
|
||||
|
||||
/* GL_OES_read_format */
|
||||
#ifndef GL_OES_read_format
|
||||
#define GL_OES_read_format 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_compressed_paletted_texture */
|
||||
#ifndef GL_OES_compressed_paletted_texture
|
||||
#define GL_OES_compressed_paletted_texture 1
|
||||
#endif
|
||||
|
||||
/* GL_OES_point_size_array */
|
||||
#ifndef GL_OES_point_size_array
|
||||
#define GL_OES_point_size_array 1
|
||||
GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
#endif
|
||||
|
||||
/* GL_OES_point_sprite */
|
||||
#ifndef GL_OES_point_sprite
|
||||
#define GL_OES_point_sprite 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __gl_h_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,30 @@
|
||||
#ifndef __glplatform_h_
|
||||
#define __glplatform_h_
|
||||
|
||||
/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */
|
||||
|
||||
/*
|
||||
* This document is licensed under the SGI Free Software B License Version
|
||||
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
|
||||
*/
|
||||
|
||||
/* Platform-specific types and definitions for OpenGL ES 1.X gl.h
|
||||
*
|
||||
* Adopters may modify khrplatform.h and this file to suit their platform.
|
||||
* You are encouraged to submit all modifications to the Khronos group so that
|
||||
* they can be included in future versions of this file. Please submit changes
|
||||
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
|
||||
* by filing a bug against product "OpenGL-ES" component "Registry".
|
||||
*/
|
||||
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
#ifndef GL_API
|
||||
#define GL_API KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
#ifndef GL_APIENTRY
|
||||
#define GL_APIENTRY KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
#endif /* __glplatform_h_ */
|
@ -0,0 +1,302 @@
|
||||
#ifndef __khrplatform_h_
|
||||
#define __khrplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2008-2009 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* $Revision: 1.5 $ on $Date: 2010/06/03 16:51:55 $
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
* group so that they can be included in future versions of this file.
|
||||
* Please submit changes by sending them to the public Khronos Bugzilla
|
||||
* (http://khronos.org/bugzilla) by filing a bug against product
|
||||
* "Khronos (general)" component "Registry".
|
||||
*
|
||||
* A predefined template which fills in some of the bug fields can be
|
||||
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
|
||||
* must create a Bugzilla login first.
|
||||
*
|
||||
*
|
||||
* See the Implementer's Guidelines for information about where this file
|
||||
* should be located on your system and for more details of its use:
|
||||
* http://www.khronos.org/registry/implementers_guide.pdf
|
||||
*
|
||||
* This file should be included as
|
||||
* #include <KHR/khrplatform.h>
|
||||
* by Khronos client API header files that use its types and defines.
|
||||
*
|
||||
* The types in khrplatform.h should only be used to define API-specific types.
|
||||
*
|
||||
* Types defined in khrplatform.h:
|
||||
* khronos_int8_t signed 8 bit
|
||||
* khronos_uint8_t unsigned 8 bit
|
||||
* khronos_int16_t signed 16 bit
|
||||
* khronos_uint16_t unsigned 16 bit
|
||||
* khronos_int32_t signed 32 bit
|
||||
* khronos_uint32_t unsigned 32 bit
|
||||
* khronos_int64_t signed 64 bit
|
||||
* khronos_uint64_t unsigned 64 bit
|
||||
* khronos_intptr_t signed same number of bits as a pointer
|
||||
* khronos_uintptr_t unsigned same number of bits as a pointer
|
||||
* khronos_ssize_t signed size
|
||||
* khronos_usize_t unsigned size
|
||||
* khronos_float_t signed 32 bit floating point
|
||||
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
|
||||
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
|
||||
* nanoseconds
|
||||
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
|
||||
* khronos_boolean_enum_t enumerated boolean type. This should
|
||||
* only be used as a base type when a client API's boolean type is
|
||||
* an enum. Client APIs which use an integer or other type for
|
||||
* booleans cannot use this as the base type for their boolean.
|
||||
*
|
||||
* Tokens defined in khrplatform.h:
|
||||
*
|
||||
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
|
||||
*
|
||||
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
|
||||
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
|
||||
*
|
||||
* Calling convention macros defined in this file:
|
||||
* KHRONOS_APICALL
|
||||
* KHRONOS_APIENTRY
|
||||
* KHRONOS_APIATTRIBUTES
|
||||
*
|
||||
* These may be used in function prototypes as:
|
||||
*
|
||||
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
|
||||
* int arg1,
|
||||
* int arg2) KHRONOS_APIATTRIBUTES;
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APICALL
|
||||
*-------------------------------------------------------------------------
|
||||
* This precedes the return type of the function in the function prototype.
|
||||
*/
|
||||
|
||||
#if (defined(_WIN32) || defined(__VC32__)) && !defined(__SCITECH_SNAP__) && !defined(__WINSCW__)
|
||||
# if defined (_DLL_EXPORTS)
|
||||
# define KHRONOS_APICALL __declspec(dllexport)
|
||||
# else
|
||||
# define KHRONOS_APICALL __declspec(dllimport)
|
||||
# endif
|
||||
#elif defined (__SYMBIAN32__)
|
||||
# if defined (__GCC32__)
|
||||
# define KHRONOS_APICALL __declspec(dllexport)
|
||||
# else
|
||||
# define KHRONOS_APICALL IMPORT_C
|
||||
# endif
|
||||
#else
|
||||
# define KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIENTRY
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the return type of the function and precedes the function
|
||||
* name in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) && !defined(__WINSCW__)
|
||||
/* Win32 but not WinCE */
|
||||
# define KHRONOS_APIENTRY __stdcall
|
||||
#else
|
||||
# define KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIATTRIBUTES
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the closing parenthesis of the function prototype arguments.
|
||||
*/
|
||||
#if defined (__ARMCC_2__)
|
||||
#define KHRONOS_APIATTRIBUTES __softfp
|
||||
#else
|
||||
#define KHRONOS_APIATTRIBUTES
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* basic type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
#if defined(__SYMBIAN32__)
|
||||
|
||||
#include <e32def.h>
|
||||
|
||||
typedef TInt32 khronos_int32_t;
|
||||
typedef TUint32 khronos_uint32_t;
|
||||
typedef TInt64 khronos_int64_t;
|
||||
typedef TUint64 khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
|
||||
|
||||
|
||||
/*
|
||||
* Using <stdint.h>
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__VMS ) || defined(__sgi)
|
||||
|
||||
/*
|
||||
* Using <inttypes.h>
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
|
||||
/*
|
||||
* Win32
|
||||
*/
|
||||
typedef __int32 khronos_int32_t;
|
||||
typedef unsigned __int32 khronos_uint32_t;
|
||||
typedef __int64 khronos_int64_t;
|
||||
typedef unsigned __int64 khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
|
||||
/*
|
||||
* Sun or Digital
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int khronos_int64_t;
|
||||
typedef unsigned long int khronos_uint64_t;
|
||||
#else
|
||||
typedef long long int khronos_int64_t;
|
||||
typedef unsigned long long int khronos_uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(_UITRON_)
|
||||
|
||||
/*
|
||||
* uITRON
|
||||
*/
|
||||
typedef signed int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
typedef long long khronos_int64_t;
|
||||
typedef unsigned long long khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
|
||||
#elif 0
|
||||
|
||||
/*
|
||||
* Hypothetical platform with no float or int64 support
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#define KHRONOS_SUPPORT_INT64 0
|
||||
#define KHRONOS_SUPPORT_FLOAT 0
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Generic fallback
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Types that are (so far) the same on all platforms
|
||||
*/
|
||||
typedef signed char khronos_int8_t;
|
||||
typedef unsigned char khronos_uint8_t;
|
||||
typedef signed short int khronos_int16_t;
|
||||
typedef unsigned short int khronos_uint16_t;
|
||||
typedef signed long int khronos_intptr_t;
|
||||
typedef unsigned long int khronos_uintptr_t;
|
||||
typedef signed long int khronos_ssize_t;
|
||||
typedef unsigned long int khronos_usize_t;
|
||||
|
||||
#if KHRONOS_SUPPORT_FLOAT
|
||||
/*
|
||||
* Float type
|
||||
*/
|
||||
typedef float khronos_float_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64
|
||||
/* Time types
|
||||
*
|
||||
* These types can be used to represent a time interval in nanoseconds or
|
||||
* an absolute Unadjusted System Time. Unadjusted System Time is the number
|
||||
* of nanoseconds since some arbitrary system event (e.g. since the last
|
||||
* time the system booted). The Unadjusted System Time is an unsigned
|
||||
* 64 bit value that wraps back to 0 every 584 years. Time intervals
|
||||
* may be either signed or unsigned.
|
||||
*/
|
||||
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
|
||||
typedef khronos_int64_t khronos_stime_nanoseconds_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dummy value used to pad enum types to 32 bits.
|
||||
*/
|
||||
#ifndef KHRONOS_MAX_ENUM
|
||||
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enumerated boolean type
|
||||
*
|
||||
* Values other than zero should be considered to be true. Therefore
|
||||
* comparisons should not be made against KHRONOS_TRUE.
|
||||
*/
|
||||
typedef enum {
|
||||
KHRONOS_FALSE = 0,
|
||||
KHRONOS_TRUE = 1,
|
||||
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
|
||||
} khronos_boolean_enum_t;
|
||||
|
||||
#endif /* __khrplatform_h_ */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,175 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef GLSL_SHADER_GENERATOR
|
||||
#define GLSL_SHADER_GENERATOR
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
class CMaterial;
|
||||
class CShaderDesc;
|
||||
|
||||
/// GLSL 330+ shader program generator
|
||||
class CGLSLShaderGenerator
|
||||
{
|
||||
public:
|
||||
CGLSLShaderGenerator();
|
||||
~CGLSLShaderGenerator();
|
||||
|
||||
/// Resets the generator to 0.
|
||||
void reset();
|
||||
|
||||
/// Generate Vertex Shader based on the data provided in material, descriptor and vertexbuffer flags
|
||||
void generateVS( std::string &vs );
|
||||
|
||||
/// Generate Pixel Shader based on the data provided in material, descriptor and vertexbuffer flags
|
||||
void generatePS( std::string &ps );
|
||||
|
||||
void setMaterial( CMaterial *mat ){ material = mat; }
|
||||
void setVBFormat( uint16 format ){ vbFormat = format; }
|
||||
void setShaderDesc( CShaderDesc *d ){ desc = d; }
|
||||
|
||||
private:
|
||||
/// Adds ambient color constant uniform declaration to the program
|
||||
void addAmbient();
|
||||
|
||||
/// Adds diffuse constant uniform declaration to the program
|
||||
void addDiffuse();
|
||||
|
||||
/// Adds specular color constant uniform declaration to the program
|
||||
void addSpecular();
|
||||
|
||||
/// Adds Color constant uniform declaration to the program
|
||||
void addColor();
|
||||
|
||||
/// Adds constant uniform declarations to the program
|
||||
void addConstants();
|
||||
|
||||
/// Adds the normal matrix declaration to the program
|
||||
void addNormalMatrix();
|
||||
|
||||
void addViewMatrix();
|
||||
|
||||
//////////////////////////// Alpha Threshold //////////////////
|
||||
|
||||
/// Adds the alpha threshold uniform to the program
|
||||
void addAlphaTreshold();
|
||||
|
||||
/// Adds the actual alpha test to the program ( discards fragment if below threshold )
|
||||
void addAlphaTest();
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
/////////////////////////// Fog ///////////////////////////////
|
||||
|
||||
/// Adds the fog uniforms to the program
|
||||
void addFogUniform();
|
||||
|
||||
/// Adds the fog function to the program
|
||||
void addFogFunction();
|
||||
|
||||
/// Adds the fog call to the program
|
||||
void addFog();
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////// Lights ///////////////////////////
|
||||
|
||||
/// Adds the Vertex Shader light uniforms to the program
|
||||
void addLightUniformsVS();
|
||||
|
||||
/// Adds the Pixel Shader light uniforms to the program
|
||||
void addLightUniformsFS();
|
||||
|
||||
/// Adds the Vertex Shader light output variables to the program
|
||||
void addLightOutsVS();
|
||||
|
||||
/// Adds the Pixel Shader light output variables to the program
|
||||
void addLightInsFS();
|
||||
|
||||
/// Adds the directional light Vertex Shader function, num is the light number
|
||||
void addDirectionalFunctionVS( int num );
|
||||
|
||||
/// Adds the point-light Vertex Shader function, num is the light number
|
||||
void addPointLightFunctionVS( int num );
|
||||
|
||||
/// Adds the appropriate light functions to the Vertex Shader
|
||||
void addLightsFunctionVS();
|
||||
|
||||
/// Adds the appropriate light functions to the Pixel Shader
|
||||
void addLightsFunctionFS();
|
||||
|
||||
/// Adds the lights to the Vertex Shader ( calls the appropriate functions )
|
||||
void addLightsVS();
|
||||
|
||||
/// Adds the lights to the Fragment Shader ( calls the appropriate functions )
|
||||
void addLightsFS();
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////// Vertex Shader generation ////////////////////////////////////
|
||||
|
||||
|
||||
void generateNormalVS();
|
||||
void generateSpecularVS();
|
||||
|
||||
/// Per-Pixel Lighting
|
||||
void generatePPLVS();
|
||||
|
||||
void generateWaterVS();
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////// Pixel Shader generation ///////////////////////////////////////
|
||||
|
||||
void generateNormalPS();
|
||||
|
||||
|
||||
void generateTexEnv();
|
||||
void generateTexEnvRGB( unsigned int stage );
|
||||
void generateTexEnvAlpha( unsigned int stage );
|
||||
void buildArg( unsigned int stage, unsigned int n, bool alpha, std::string &arg );
|
||||
|
||||
void generateLightMapPS();
|
||||
void generateSpecularPS();
|
||||
|
||||
/// Per-Pixel Lighting
|
||||
void generatePPLPS();
|
||||
|
||||
void generateWaterPS();
|
||||
|
||||
void generateCloudPS();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::stringstream ss;
|
||||
uint16 vbFormat;
|
||||
CMaterial const *material;
|
||||
CShaderDesc const *desc;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,2 @@
|
||||
EXPORTS NL3D_createIDriverInstance
|
||||
EXPORTS NL3D_interfaceVersion
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,621 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef NL_OPENGL_EXTENSION_H
|
||||
#define NL_OPENGL_EXTENSION_H
|
||||
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/misc/string_common.h"
|
||||
|
||||
#include "driver_opengl_extension_def.h"
|
||||
|
||||
namespace NL3D {
|
||||
|
||||
#ifdef NL_STATIC
|
||||
namespace NLDRIVERGL3 {
|
||||
#endif
|
||||
|
||||
// ***************************************************************************
|
||||
/// The extensions used by NL3D.
|
||||
struct CGlExtensions
|
||||
{
|
||||
std::string GLVersion;
|
||||
|
||||
// Required Extensions.
|
||||
bool ARBMultiTexture;
|
||||
uint NbTextureStages;
|
||||
bool EXTTextureEnvCombine;
|
||||
|
||||
// Optional Extensions.
|
||||
bool EXTTextureCompressionS3TC;
|
||||
bool EXTVertexWeighting;
|
||||
bool EXTSeparateSpecularColor;
|
||||
bool ARBTextureCubeMap;
|
||||
bool NVOcclusionQuery;
|
||||
bool NVTextureRectangle;
|
||||
bool EXTTextureRectangle;
|
||||
bool ARBTextureRectangle;
|
||||
bool FrameBufferObject;
|
||||
bool FrameBufferBlit;
|
||||
bool FrameBufferMultisample;
|
||||
bool PackedDepthStencil;
|
||||
bool EXTTextureFilterAnisotropic;
|
||||
float EXTTextureFilterAnisotropicMaximum;
|
||||
|
||||
bool EXTSecondaryColor;
|
||||
bool EXTBlendColor;
|
||||
// equal to GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV if possible, or GL_VERTEX_ARRAY_RANGE_NV
|
||||
uint NVStateVARWithoutFlush;
|
||||
|
||||
// WGL ARB extensions, true if supported
|
||||
bool WGLARBPBuffer;
|
||||
bool WGLARBPixelFormat;
|
||||
bool WGLEXTSwapControl;
|
||||
|
||||
// GLX extensions, true if supported
|
||||
bool GLXEXTSwapControl;
|
||||
bool GLXSGISwapControl;
|
||||
bool GLXMESASwapControl;
|
||||
|
||||
// ATI Extensions.
|
||||
bool ATITextureEnvCombine3;
|
||||
bool ATIXTextureEnvRoute;
|
||||
|
||||
// ARB Extensions
|
||||
bool ARBTextureCompression;
|
||||
bool ARBTextureNonPowerOfTwo;
|
||||
bool ARBMultisample;
|
||||
|
||||
public:
|
||||
CGlExtensions()
|
||||
{
|
||||
// Fill all false by default.
|
||||
ARBMultiTexture= false;
|
||||
NbTextureStages= 1;
|
||||
EXTTextureEnvCombine= false;
|
||||
ARBTextureCompression= false;
|
||||
EXTTextureCompressionS3TC= false;
|
||||
EXTVertexWeighting= false;
|
||||
EXTSeparateSpecularColor= false;
|
||||
ATITextureEnvCombine3= false;
|
||||
ATIXTextureEnvRoute= false;
|
||||
ARBTextureCubeMap= false;
|
||||
EXTSecondaryColor= false;
|
||||
WGLARBPBuffer= false;
|
||||
WGLARBPixelFormat= false;
|
||||
WGLEXTSwapControl= false;
|
||||
GLXEXTSwapControl= false;
|
||||
GLXSGISwapControl= false;
|
||||
GLXMESASwapControl= false;
|
||||
EXTBlendColor= false;
|
||||
NVTextureRectangle = false;
|
||||
EXTTextureRectangle = false;
|
||||
EXTTextureFilterAnisotropic = false;
|
||||
EXTTextureFilterAnisotropicMaximum = 0.f;
|
||||
ARBTextureRectangle = false;
|
||||
ARBTextureNonPowerOfTwo = false;
|
||||
ARBMultisample = false;
|
||||
NVOcclusionQuery = false;
|
||||
FrameBufferObject = false;
|
||||
FrameBufferBlit = false;
|
||||
FrameBufferMultisample = false;
|
||||
PackedDepthStencil = false;
|
||||
NVStateVARWithoutFlush = 0;
|
||||
}
|
||||
|
||||
std::string toString()
|
||||
{
|
||||
std::string result = "OpenGL version ";
|
||||
result += GLVersion;
|
||||
result += "; Available extensions:";
|
||||
|
||||
result += "\n Texturing: ";
|
||||
result += ARBMultiTexture ? "ARBMultiTexture " : "";
|
||||
result += EXTTextureEnvCombine ? "EXTTextureEnvCombine(*) " : "";
|
||||
result += ARBTextureCompression ? "ARBTextureCompression " : "";
|
||||
result += EXTTextureCompressionS3TC ? "EXTTextureCompressionS3TC " : "";
|
||||
result += ATITextureEnvCombine3 ? "ATITextureEnvCombine3 " : "";
|
||||
result += ATIXTextureEnvRoute ? "ATITextureEnvRoute " : "";
|
||||
result += ARBTextureCubeMap ? "ARBTextureCubeMap " : "";
|
||||
result += NVTextureRectangle ? "NVTextureRectangle " : "";
|
||||
result += EXTTextureRectangle ? "EXTTextureRectangle " : "";
|
||||
result += ARBTextureRectangle ? "ARBTextureRectangle " : "";
|
||||
result += EXTTextureFilterAnisotropic ? "EXTTextureFilterAnisotropic (Maximum = " + NLMISC::toString(EXTTextureFilterAnisotropicMaximum) + ") " : "";
|
||||
result += ARBTextureNonPowerOfTwo ? "ARBTextureNonPowerOfTwo " : "";
|
||||
result += "texture stages(*) = ";
|
||||
result += NLMISC::toString(NbTextureStages);
|
||||
|
||||
result += "\n Programs: ";
|
||||
result += "ARBFragmentProgram ";
|
||||
result += "ARBVertexProgram";
|
||||
|
||||
result += "\n Misc: ";
|
||||
result += EXTVertexWeighting ? "EXTVertexWeighting " : "";
|
||||
result += EXTSeparateSpecularColor ? "EXTSeparateSpecularColor " : "";
|
||||
result += EXTSecondaryColor ? "EXTSecondaryColor " : "";
|
||||
result += EXTBlendColor ? "EXTBlendColor " : "";
|
||||
result += NVOcclusionQuery ? "NVOcclusionQuery " : "";
|
||||
result += NVStateVARWithoutFlush ? "NVStateVARWithoutFlush " : "";
|
||||
result += ARBMultisample ? "ARBMultisample " : "";
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
result += "\n WindowsGL: ";
|
||||
result += WGLARBPBuffer ? "WGLARBPBuffer " : "";
|
||||
result += WGLARBPixelFormat ? "WGLARBPixelFormat " : "";
|
||||
result += WGLEXTSwapControl ? "WGLEXTSwapControl " : "";
|
||||
#elif defined(NL_OS_MAC)
|
||||
#elif defined(NL_OS_UNIX)
|
||||
result += "\n GLX: ";
|
||||
result += GLXEXTSwapControl ? "GLXEXTSwapControl " : "";
|
||||
result += GLXSGISwapControl ? "GLXSGISwapControl " : "";
|
||||
result += GLXMESASwapControl ? "GLXMESASwapControl " : "";
|
||||
#endif
|
||||
|
||||
result += "\n Array/VBO: ";
|
||||
result += "VertexBufferObject";
|
||||
|
||||
result += "\n FBO: ";
|
||||
result += FrameBufferObject ? "FramebufferObject " : "";
|
||||
result += FrameBufferBlit ? "FrameBufferBlit " : "";
|
||||
result += FrameBufferMultisample ? "FrameBufferMultisample " : "";
|
||||
result += PackedDepthStencil ? "PackedDepthStencil " : "";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
#if defined(NL_OS_WINDOWS)
|
||||
/// This function will test and register WGL functions before than the gl context is created
|
||||
bool registerWGlExtensions(CGlExtensions &ext, HDC hDC);
|
||||
#elif defined(NL_OS_MAC)
|
||||
#elif defined(NL_OS_UNIX)
|
||||
/// This function will test and register GLX functions before than the gl context is created
|
||||
bool registerGlXExtensions(CGlExtensions &ext, Display *dpy, sint screen);
|
||||
#endif // NL_OS_WINDOWS
|
||||
|
||||
/// This function test and register the extensions for the current GL context.
|
||||
void registerGlExtensions(CGlExtensions &ext);
|
||||
|
||||
#ifdef NL_STATIC
|
||||
} // NLDRIVERGL/ES
|
||||
#endif
|
||||
|
||||
} // NL3D
|
||||
|
||||
// ***************************************************************************
|
||||
// The exported function names
|
||||
/* NB: We named all like nglActiveTextureARB (n for NEL :)
|
||||
to avoid compilation conflict with future version of gl.h
|
||||
eg: gl.h Version 1.2 define glActiveTextureARB so we can't use it.
|
||||
|
||||
NB: we do it for all (EXT, NV, ARB extension) even it should be useful only for ARB ones.
|
||||
*/
|
||||
|
||||
// ARB_multitexture
|
||||
//=================
|
||||
extern NEL_PFNGLACTIVETEXTUREARBPROC nglActiveTextureARB;
|
||||
extern NEL_PFNGLCLIENTACTIVETEXTUREARBPROC nglClientActiveTextureARB;
|
||||
|
||||
extern NEL_PFNGLMULTITEXCOORD1SARBPROC nglMultiTexCoord1sARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD1IARBPROC nglMultiTexCoord1iARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD1FARBPROC nglMultiTexCoord1fARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD1FARBPROC nglMultiTexCoord1fARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD1DARBPROC nglMultiTexCoord1dARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD2SARBPROC nglMultiTexCoord2sARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD2IARBPROC nglMultiTexCoord2iARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD2FARBPROC nglMultiTexCoord2fARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD2DARBPROC nglMultiTexCoord2dARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD3SARBPROC nglMultiTexCoord3sARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD3IARBPROC nglMultiTexCoord3iARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD3FARBPROC nglMultiTexCoord3fARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD3DARBPROC nglMultiTexCoord3dARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD4SARBPROC nglMultiTexCoord4sARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD4IARBPROC nglMultiTexCoord4iARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD4FARBPROC nglMultiTexCoord4fARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD4DARBPROC nglMultiTexCoord4dARB;
|
||||
|
||||
extern NEL_PFNGLMULTITEXCOORD1SVARBPROC nglMultiTexCoord1svARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD1IVARBPROC nglMultiTexCoord1ivARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD1FVARBPROC nglMultiTexCoord1fvARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD1DVARBPROC nglMultiTexCoord1dvARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD2SVARBPROC nglMultiTexCoord2svARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD2IVARBPROC nglMultiTexCoord2ivARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD2FVARBPROC nglMultiTexCoord2fvARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD2DVARBPROC nglMultiTexCoord2dvARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD3SVARBPROC nglMultiTexCoord3svARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD3IVARBPROC nglMultiTexCoord3ivARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD3FVARBPROC nglMultiTexCoord3fvARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD3DVARBPROC nglMultiTexCoord3dvARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD4SVARBPROC nglMultiTexCoord4svARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD4IVARBPROC nglMultiTexCoord4ivARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD4FVARBPROC nglMultiTexCoord4fvARB;
|
||||
extern NEL_PFNGLMULTITEXCOORD4DVARBPROC nglMultiTexCoord4dvARB;
|
||||
|
||||
|
||||
// ARB_TextureCompression.
|
||||
//========================
|
||||
extern NEL_PFNGLCOMPRESSEDTEXIMAGE3DARBPROC nglCompressedTexImage3DARB;
|
||||
extern NEL_PFNGLCOMPRESSEDTEXIMAGE2DARBPROC nglCompressedTexImage2DARB;
|
||||
extern NEL_PFNGLCOMPRESSEDTEXIMAGE1DARBPROC nglCompressedTexImage1DARB;
|
||||
extern NEL_PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC nglCompressedTexSubImage3DARB;
|
||||
extern NEL_PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC nglCompressedTexSubImage2DARB;
|
||||
extern NEL_PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC nglCompressedTexSubImage1DARB;
|
||||
extern NEL_PFNGLGETCOMPRESSEDTEXIMAGEARBPROC nglGetCompressedTexImageARB;
|
||||
|
||||
|
||||
// VertexWeighting.
|
||||
//==================
|
||||
extern NEL_PFNGLVERTEXWEIGHTFEXTPROC nglVertexWeightfEXT;
|
||||
extern NEL_PFNGLVERTEXWEIGHTFVEXTPROC nglVertexWeightfvEXT;
|
||||
extern NEL_PFNGLVERTEXWEIGHTPOINTEREXTPROC nglVertexWeightPointerEXT;
|
||||
|
||||
|
||||
// ATI_envmap_bumpmap extension
|
||||
|
||||
extern PFNGLTEXBUMPPARAMETERIVATIPROC nglTexBumpParameterivATI;
|
||||
extern PFNGLTEXBUMPPARAMETERFVATIPROC nglTexBumpParameterfvATI;
|
||||
extern PFNGLGETTEXBUMPPARAMETERIVATIPROC nglGetTexBumpParameterivATI;
|
||||
extern PFNGLGETTEXBUMPPARAMETERFVATIPROC nglGetTexBumpParameterfvATI;
|
||||
|
||||
|
||||
// SecondaryColor extension
|
||||
//========================
|
||||
extern NEL_PFNGLSECONDARYCOLOR3BEXTPROC nglSecondaryColor3bEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3BVEXTPROC nglSecondaryColor3bvEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3DEXTPROC nglSecondaryColor3dEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3DVEXTPROC nglSecondaryColor3dvEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3FEXTPROC nglSecondaryColor3fEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3FVEXTPROC nglSecondaryColor3fvEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3IEXTPROC nglSecondaryColor3iEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3IVEXTPROC nglSecondaryColor3ivEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3SEXTPROC nglSecondaryColor3sEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3SVEXTPROC nglSecondaryColor3svEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3UBEXTPROC nglSecondaryColor3ubEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3UBVEXTPROC nglSecondaryColor3ubvEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3UIEXTPROC nglSecondaryColor3uiEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3UIVEXTPROC nglSecondaryColor3uivEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3USEXTPROC nglSecondaryColor3usEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLOR3USVEXTPROC nglSecondaryColor3usvEXT;
|
||||
extern NEL_PFNGLSECONDARYCOLORPOINTEREXTPROC nglSecondaryColorPointerEXT;
|
||||
|
||||
|
||||
// BlendColor extension
|
||||
//========================
|
||||
extern NEL_PFNGLBLENDCOLOREXTPROC nglBlendColorEXT;
|
||||
|
||||
|
||||
// GL_ATI_fragment_shader extension
|
||||
//===================================
|
||||
|
||||
extern NEL_PFNGLGENFRAGMENTSHADERSATIPROC nglGenFragmentShadersATI;
|
||||
extern NEL_PFNGLBINDFRAGMENTSHADERATIPROC nglBindFragmentShaderATI;
|
||||
extern NEL_PFNGLDELETEFRAGMENTSHADERATIPROC nglDeleteFragmentShaderATI;
|
||||
extern NEL_PFNGLBEGINFRAGMENTSHADERATIPROC nglBeginFragmentShaderATI;
|
||||
extern NEL_PFNGLENDFRAGMENTSHADERATIPROC nglEndFragmentShaderATI;
|
||||
extern NEL_PFNGLPASSTEXCOORDATIPROC nglPassTexCoordATI;
|
||||
extern NEL_PFNGLSAMPLEMAPATIPROC nglSampleMapATI;
|
||||
extern NEL_PFNGLCOLORFRAGMENTOP1ATIPROC nglColorFragmentOp1ATI;
|
||||
extern NEL_PFNGLCOLORFRAGMENTOP2ATIPROC nglColorFragmentOp2ATI;
|
||||
extern NEL_PFNGLCOLORFRAGMENTOP3ATIPROC nglColorFragmentOp3ATI;
|
||||
extern NEL_PFNGLALPHAFRAGMENTOP1ATIPROC nglAlphaFragmentOp1ATI;
|
||||
extern NEL_PFNGLALPHAFRAGMENTOP2ATIPROC nglAlphaFragmentOp2ATI;
|
||||
extern NEL_PFNGLALPHAFRAGMENTOP3ATIPROC nglAlphaFragmentOp3ATI;
|
||||
extern NEL_PFNGLSETFRAGMENTSHADERCONSTANTATIPROC nglSetFragmentShaderConstantATI;
|
||||
|
||||
// GL_ARB_fragment_shader_extension
|
||||
//==================================
|
||||
extern NEL_PFNGLPROGRAMSTRINGARBPROC nglProgramStringARB;
|
||||
extern NEL_PFNGLBINDPROGRAMARBPROC nglBindProgramARB;
|
||||
extern NEL_PFNGLDELETEPROGRAMSARBPROC nglDeleteProgramsARB;
|
||||
extern NEL_PFNGLGENPROGRAMSARBPROC nglGenProgramsARB;
|
||||
extern NEL_PFNGLPROGRAMENVPARAMETER4DARBPROC nglProgramEnvParameter4dARB;
|
||||
extern NEL_PFNGLPROGRAMENVPARAMETER4DVARBPROC nglProgramEnvParameter4dvARB;
|
||||
extern NEL_PFNGLPROGRAMENVPARAMETER4FARBPROC nglProgramEnvParameter4fARB;
|
||||
extern NEL_PFNGLPROGRAMENVPARAMETER4FVARBPROC nglProgramEnvParameter4fvARB;
|
||||
extern NEL_PFNGLPROGRAMLOCALPARAMETER4DARBPROC nglGetProgramLocalParameter4dARB;
|
||||
extern NEL_PFNGLPROGRAMLOCALPARAMETER4DVARBPROC nglGetProgramLocalParameter4dvARB;
|
||||
extern NEL_PFNGLPROGRAMLOCALPARAMETER4FARBPROC nglGetProgramLocalParameter4fARB;
|
||||
extern NEL_PFNGLPROGRAMLOCALPARAMETER4FVARBPROC nglGetProgramLocalParameter4fvARB;
|
||||
extern NEL_PFNGLGETPROGRAMENVPARAMETERDVARBPROC nglGetProgramEnvParameterdvARB;
|
||||
extern NEL_PFNGLGETPROGRAMENVPARAMETERFVARBPROC nglGetProgramEnvParameterfvARB;
|
||||
extern NEL_PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC nglGetProgramLocalParameterdvARB;
|
||||
extern NEL_PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC nglGetProgramLocalParameterfvARB;
|
||||
extern NEL_PFNGLGETPROGRAMIVARBPROC nglGetProgramivARB;
|
||||
extern NEL_PFNGLGETPROGRAMSTRINGARBPROC nglGetProgramStringARB;
|
||||
extern NEL_PFNGLISPROGRAMARBPROC nglIsProgramARB;
|
||||
|
||||
// GL_ARB_vertex_buffer_object
|
||||
//==================================
|
||||
extern PFNGLBINDBUFFERPROC nglBindBuffer;
|
||||
extern PFNGLDELETEBUFFERSPROC nglDeleteBuffers;
|
||||
extern PFNGLGENBUFFERSPROC nglGenBuffers;
|
||||
extern PFNGLISBUFFERPROC nglIsBuffer;
|
||||
extern PFNGLBUFFERDATAPROC nglBufferData;
|
||||
extern PFNGLBUFFERSUBDATAPROC nglBufferSubData;
|
||||
extern PFNGLGETBUFFERSUBDATAPROC nglGetBufferSubData;
|
||||
extern PFNGLMAPBUFFERPROC nglMapBuffer;
|
||||
extern PFNGLUNMAPBUFFERPROC nglUnmapBuffer;
|
||||
extern PFNGLGETBUFFERPARAMETERIVPROC nglGetBufferParameteriv;
|
||||
extern PFNGLGETBUFFERPOINTERVPROC nglGetBufferPointerv;
|
||||
|
||||
|
||||
|
||||
// GL_ARB_vertex_program
|
||||
//==================================
|
||||
extern PFNGLVERTEXATTRIB1SARBPROC nglVertexAttrib1sARB;
|
||||
extern PFNGLVERTEXATTRIB1FARBPROC nglVertexAttrib1fARB;
|
||||
extern PFNGLVERTEXATTRIB1DARBPROC nglVertexAttrib1dARB;
|
||||
extern PFNGLVERTEXATTRIB2SARBPROC nglVertexAttrib2sARB;
|
||||
extern PFNGLVERTEXATTRIB2FARBPROC nglVertexAttrib2fARB;
|
||||
extern PFNGLVERTEXATTRIB2DARBPROC nglVertexAttrib2dARB;
|
||||
extern PFNGLVERTEXATTRIB3SARBPROC nglVertexAttrib3sARB;
|
||||
extern PFNGLVERTEXATTRIB3FARBPROC nglVertexAttrib3fARB;
|
||||
extern PFNGLVERTEXATTRIB3DARBPROC nglVertexAttrib3dARB;
|
||||
extern PFNGLVERTEXATTRIB4SARBPROC nglVertexAttrib4sARB;
|
||||
extern PFNGLVERTEXATTRIB4FARBPROC nglVertexAttrib4fARB;
|
||||
extern PFNGLVERTEXATTRIB4DARBPROC nglVertexAttrib4dARB;
|
||||
extern PFNGLVERTEXATTRIB4NUBARBPROC nglVertexAttrib4NubARB;
|
||||
extern PFNGLVERTEXATTRIB1SVARBPROC nglVertexAttrib1svARB;
|
||||
extern PFNGLVERTEXATTRIB1FVARBPROC nglVertexAttrib1fvARB;
|
||||
extern PFNGLVERTEXATTRIB1DVARBPROC nglVertexAttrib1dvARB;
|
||||
extern PFNGLVERTEXATTRIB2SVARBPROC nglVertexAttrib2svARB;
|
||||
extern PFNGLVERTEXATTRIB2FVARBPROC nglVertexAttrib2fvARB;
|
||||
extern PFNGLVERTEXATTRIB2DVARBPROC nglVertexAttrib2dvARB;
|
||||
extern PFNGLVERTEXATTRIB3SVARBPROC nglVertexAttrib3svARB;
|
||||
extern PFNGLVERTEXATTRIB3FVARBPROC nglVertexAttrib3fvARB;
|
||||
extern PFNGLVERTEXATTRIB3DVARBPROC nglVertexAttrib3dvARB;
|
||||
extern PFNGLVERTEXATTRIB4BVARBPROC nglVertexAttrib4bvARB;
|
||||
extern PFNGLVERTEXATTRIB4SVARBPROC nglVertexAttrib4svARB;
|
||||
extern PFNGLVERTEXATTRIB4IVARBPROC nglVertexAttrib4ivARB;
|
||||
extern PFNGLVERTEXATTRIB4UBVARBPROC nglVertexAttrib4ubvARB;
|
||||
extern PFNGLVERTEXATTRIB4USVARBPROC nglVertexAttrib4usvARB;
|
||||
extern PFNGLVERTEXATTRIB4UIVARBPROC nglVertexAttrib4uivARB;
|
||||
extern PFNGLVERTEXATTRIB4FVARBPROC nglVertexAttrib4fvARB;
|
||||
extern PFNGLVERTEXATTRIB4DVARBPROC nglVertexAttrib4dvARB;
|
||||
extern PFNGLVERTEXATTRIB4NBVARBPROC nglVertexAttrib4NbvARB;
|
||||
extern PFNGLVERTEXATTRIB4NSVARBPROC nglVertexAttrib4NsvARB;
|
||||
extern PFNGLVERTEXATTRIB4NIVARBPROC nglVertexAttrib4NivARB;
|
||||
extern PFNGLVERTEXATTRIB4NUBVARBPROC nglVertexAttrib4NubvARB;
|
||||
extern PFNGLVERTEXATTRIB4NUSVARBPROC nglVertexAttrib4NusvARB;
|
||||
extern PFNGLVERTEXATTRIB4NUIVARBPROC nglVertexAttrib4NuivARB;
|
||||
extern PFNGLVERTEXATTRIBPOINTERARBPROC nglVertexAttribPointerARB;
|
||||
extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC nglEnableVertexAttribArrayARB;
|
||||
extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC nglDisableVertexAttribArrayARB;
|
||||
extern PFNGLPROGRAMSTRINGARBPROC nglProgramStringARB;
|
||||
extern PFNGLBINDPROGRAMARBPROC nglBindProgramARB;
|
||||
extern PFNGLDELETEPROGRAMSARBPROC nglDeleteProgramsARB;
|
||||
extern PFNGLGENPROGRAMSARBPROC nglGenProgramsARB;
|
||||
extern PFNGLPROGRAMENVPARAMETER4FARBPROC nglProgramEnvParameter4fARB;
|
||||
extern PFNGLPROGRAMENVPARAMETER4DARBPROC nglProgramEnvParameter4dARB;
|
||||
extern PFNGLPROGRAMENVPARAMETER4FVARBPROC nglProgramEnvParameter4fvARB;
|
||||
extern PFNGLPROGRAMENVPARAMETER4DVARBPROC nglProgramEnvParameter4dvARB;
|
||||
extern PFNGLPROGRAMLOCALPARAMETER4FARBPROC nglProgramLocalParameter4fARB;
|
||||
extern PFNGLPROGRAMLOCALPARAMETER4DARBPROC nglProgramLocalParameter4dARB;
|
||||
extern PFNGLPROGRAMLOCALPARAMETER4FVARBPROC nglProgramLocalParameter4fvARB;
|
||||
extern PFNGLPROGRAMLOCALPARAMETER4DVARBPROC nglProgramLocalParameter4dvARB;
|
||||
extern PFNGLGETPROGRAMENVPARAMETERFVARBPROC nglGetProgramEnvParameterfvARB;
|
||||
extern PFNGLGETPROGRAMENVPARAMETERDVARBPROC nglGetProgramEnvParameterdvARB;
|
||||
extern PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC nglGetProgramLocalParameterfvARB;
|
||||
extern PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC nglGetProgramLocalParameterdvARB;
|
||||
extern PFNGLGETPROGRAMIVARBPROC nglGetProgramivARB;
|
||||
extern PFNGLGETPROGRAMSTRINGARBPROC nglGetProgramStringARB;
|
||||
extern PFNGLGETVERTEXATTRIBDVARBPROC nglGetVertexAttribdvARB;
|
||||
extern PFNGLGETVERTEXATTRIBFVARBPROC nglGetVertexAttribfvARB;
|
||||
extern PFNGLGETVERTEXATTRIBIVARBPROC nglGetVertexAttribivARB;
|
||||
extern PFNGLGETVERTEXATTRIBPOINTERVARBPROC nglGetVertexAttribPointervARB;
|
||||
extern PFNGLISPROGRAMARBPROC nglIsProgramARB;
|
||||
|
||||
// GL_ARB_Shader_Object
|
||||
extern PFNGLATTACHSHADERPROC nglAttachShader;
|
||||
extern PFNGLCOMPILESHADERPROC nglCompileShader;
|
||||
extern PFNGLCREATEPROGRAMPROC nglCreateProgram;
|
||||
extern PFNGLCREATESHADERPROC nglCreateShader;
|
||||
extern PFNGLDELETEPROGRAMPROC nglDeleteProgram;
|
||||
extern PFNGLDELETESHADERPROC nglDeleteShader;
|
||||
extern PFNGLDETACHSHADERPROC nglDetachShader;
|
||||
extern PFNGLDISABLEVERTEXATTRIBARRAYPROC nglDisableVertexAttribArray;
|
||||
extern PFNGLENABLEVERTEXATTRIBARRAYPROC nglEnableVertexAttribArray;
|
||||
extern PFNGLGETATTACHEDSHADERSPROC nglGetAttachedShaders;
|
||||
extern PFNGLGETPROGRAMIVPROC nglGetProgramiv;
|
||||
extern PFNGLGETPROGRAMINFOLOGPROC nglGetProgramInfoLog;
|
||||
extern PFNGLGETSHADERIVPROC nglGetShaderiv;
|
||||
extern PFNGLGETSHADERINFOLOGPROC nglGetShaderInfoLog;
|
||||
extern PFNGLGETUNIFORMLOCATIONPROC nglGetUniformLocation;
|
||||
extern PFNGLISPROGRAMPROC nglIsProgram;
|
||||
extern PFNGLISSHADERPROC nglIsShader;
|
||||
extern PFNGLLINKPROGRAMPROC nglLinkProgram;
|
||||
extern PFNGLSHADERSOURCEPROC nglShaderSource;
|
||||
extern PFNGLUSEPROGRAMPROC nglUseProgram;
|
||||
extern PFNGLVALIDATEPROGRAMPROC nglValidateProgram;
|
||||
extern PFNGLUNIFORM1FPROC nglUniform1f;
|
||||
extern PFNGLUNIFORM2FPROC nglUniform2f;
|
||||
extern PFNGLUNIFORM3FPROC nglUniform3f;
|
||||
extern PFNGLUNIFORM4FPROC nglUniform4f;
|
||||
extern PFNGLUNIFORM1IPROC nglUniform1i;
|
||||
extern PFNGLUNIFORM2IPROC nglUniform2i;
|
||||
extern PFNGLUNIFORM3IPROC nglUniform3i;
|
||||
extern PFNGLUNIFORM4IPROC nglUniform4i;
|
||||
extern PFNGLUNIFORM1FVPROC nglUniform1fv;
|
||||
extern PFNGLUNIFORM2FVPROC nglUniform2fv;
|
||||
extern PFNGLUNIFORM3FVPROC nglUniform3fv;
|
||||
extern PFNGLUNIFORM4FVPROC nglUniform4fv;
|
||||
extern PFNGLUNIFORM1IVPROC nglUniform1iv;
|
||||
extern PFNGLUNIFORM2IVPROC nglUniform2iv;
|
||||
extern PFNGLUNIFORM3IVPROC nglUniform3iv;
|
||||
extern PFNGLUNIFORM4IVPROC nglUniform4iv;
|
||||
extern PFNGLUNIFORMMATRIX2FVPROC nglUniformMatrix2fv;
|
||||
extern PFNGLUNIFORMMATRIX3FVPROC nglUniformMatrix3fv;
|
||||
extern PFNGLUNIFORMMATRIX4FVPROC nglUniformMatrix4fv;
|
||||
extern PFNGLVERTEXATTRIBPOINTERPROC nglVertexAttribPointer;
|
||||
extern PFNGLUNIFORM1UIPROC nglUniform1ui;
|
||||
extern PFNGLUNIFORM2UIPROC nglUniform2ui;
|
||||
extern PFNGLUNIFORM3UIPROC nglUniform3ui;
|
||||
extern PFNGLUNIFORM4UIPROC nglUniform4ui;
|
||||
extern PFNGLUNIFORM1UIVPROC nglUniform1uiv;
|
||||
extern PFNGLUNIFORM2UIVPROC nglUniform2uiv;
|
||||
extern PFNGLUNIFORM3UIVPROC nglUniform3uiv;
|
||||
extern PFNGLUNIFORM4UIVPROC nglUniform4uiv;
|
||||
|
||||
// GL_ARB_separate_shader_objects
|
||||
extern PFNGLUSEPROGRAMSTAGESPROC nglUseProgramStages;
|
||||
extern PFNGLACTIVESHADERPROGRAMPROC nglActiveShaderProgram;
|
||||
extern PFNGLCREATESHADERPROGRAMVPROC nglCreateShaderProgramv;
|
||||
extern PFNGLBINDPROGRAMPIPELINEPROC nglBindProgramPipeline;
|
||||
extern PFNGLDELETEPROGRAMPIPELINESPROC nglDeleteProgramPipelines;
|
||||
extern PFNGLGENPROGRAMPIPELINESPROC nglGenProgramPipelines;
|
||||
extern PFNGLISPROGRAMPIPELINEPROC nglIsProgramPipeline;
|
||||
extern PFNGLGETPROGRAMPIPELINEIVPROC nglGetProgramPipelineiv;
|
||||
extern PFNGLPROGRAMUNIFORM1IPROC nglProgramUniform1i;
|
||||
extern PFNGLPROGRAMUNIFORM1IVPROC nglProgramUniform1iv;
|
||||
extern PFNGLPROGRAMUNIFORM1FPROC nglProgramUniform1f;
|
||||
extern PFNGLPROGRAMUNIFORM1FVPROC nglProgramUniform1fv;
|
||||
extern PFNGLPROGRAMUNIFORM1DPROC nglProgramUniform1d;
|
||||
extern PFNGLPROGRAMUNIFORM1DVPROC nglProgramUniform1dv;
|
||||
extern PFNGLPROGRAMUNIFORM1UIPROC nglProgramUniform1ui;
|
||||
extern PFNGLPROGRAMUNIFORM1UIVPROC nglProgramUniform1uiv;
|
||||
extern PFNGLPROGRAMUNIFORM2IPROC nglProgramUniform2i;
|
||||
extern PFNGLPROGRAMUNIFORM2IVPROC nglProgramUniform2iv;
|
||||
extern PFNGLPROGRAMUNIFORM2FPROC nglProgramUniform2f;
|
||||
extern PFNGLPROGRAMUNIFORM2FVPROC nglProgramUniform2fv;
|
||||
extern PFNGLPROGRAMUNIFORM2DPROC nglProgramUniform2d;
|
||||
extern PFNGLPROGRAMUNIFORM2DVPROC nglProgramUniform2dv;
|
||||
extern PFNGLPROGRAMUNIFORM2UIPROC nglProgramUniform2ui;
|
||||
extern PFNGLPROGRAMUNIFORM2UIVPROC nglProgramUniform2uiv;
|
||||
extern PFNGLPROGRAMUNIFORM3IPROC nglProgramUniform3i;
|
||||
extern PFNGLPROGRAMUNIFORM3IVPROC nglProgramUniform3iv;
|
||||
extern PFNGLPROGRAMUNIFORM3FPROC nglProgramUniform3f;
|
||||
extern PFNGLPROGRAMUNIFORM3FVPROC nglProgramUniform3fv;
|
||||
extern PFNGLPROGRAMUNIFORM3DPROC nglProgramUniform3d;
|
||||
extern PFNGLPROGRAMUNIFORM3DVPROC nglProgramUniform3dv;
|
||||
extern PFNGLPROGRAMUNIFORM3UIPROC nglProgramUniform3ui;
|
||||
extern PFNGLPROGRAMUNIFORM3UIVPROC nglProgramUniform3uiv;
|
||||
extern PFNGLPROGRAMUNIFORM4IPROC nglProgramUniform4i;
|
||||
extern PFNGLPROGRAMUNIFORM4IVPROC nglProgramUniform4iv;
|
||||
extern PFNGLPROGRAMUNIFORM4FPROC nglProgramUniform4f;
|
||||
extern PFNGLPROGRAMUNIFORM4FVPROC nglProgramUniform4fv;
|
||||
extern PFNGLPROGRAMUNIFORM4DPROC nglProgramUniform4d;
|
||||
extern PFNGLPROGRAMUNIFORM4DVPROC nglProgramUniform4dv;
|
||||
extern PFNGLPROGRAMUNIFORM4UIPROC nglProgramUniform4ui;
|
||||
extern PFNGLPROGRAMUNIFORM4UIVPROC nglProgramUniform4uiv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX2FVPROC nglProgramUniformMatrix2fv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX3FVPROC nglProgramUniformMatrix3fv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX4FVPROC nglProgramUniformMatrix4fv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX2DVPROC nglProgramUniformMatrix2dv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX3DVPROC nglProgramUniformMatrix3dv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX4DVPROC nglProgramUniformMatrix4dv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC nglProgramUniformMatrix2x3fv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC nglProgramUniformMatrix3x2fv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC nglProgramUniformMatrix2x4fv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC nglProgramUniformMatrix4x2fv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC nglProgramUniformMatrix3x4fv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC nglProgramUniformMatrix4x3fv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC nglProgramUniformMatrix2x3dv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC nglProgramUniformMatrix3x2dv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC nglProgramUniformMatrix2x4dv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC nglProgramUniformMatrix4x2dv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC nglProgramUniformMatrix3x4dv;
|
||||
extern PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC nglProgramUniformMatrix4x3dv;
|
||||
extern PFNGLVALIDATEPROGRAMPIPELINEPROC nglValidateProgramPipeline;
|
||||
extern PFNGLGETPROGRAMPIPELINEINFOLOGPROC nglGetProgramPipelineInfoLog;
|
||||
|
||||
// GL_NV_occlusion_query
|
||||
//==================================
|
||||
extern NEL_PFNGLGENOCCLUSIONQUERIESNVPROC nglGenOcclusionQueriesNV;
|
||||
extern NEL_PFNGLDELETEOCCLUSIONQUERIESNVPROC nglDeleteOcclusionQueriesNV;
|
||||
extern NEL_PFNGLISOCCLUSIONQUERYNVPROC nglIsOcclusionQueryNV;
|
||||
extern NEL_PFNGLBEGINOCCLUSIONQUERYNVPROC nglBeginOcclusionQueryNV;
|
||||
extern NEL_PFNGLENDOCCLUSIONQUERYNVPROC nglEndOcclusionQueryNV;
|
||||
extern NEL_PFNGLGETOCCLUSIONQUERYIVNVPROC nglGetOcclusionQueryivNV;
|
||||
extern NEL_PFNGLGETOCCLUSIONQUERYUIVNVPROC nglGetOcclusionQueryuivNV;
|
||||
|
||||
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
||||
// Pbuffer extension
|
||||
//==================
|
||||
extern PFNWGLCREATEPBUFFERARBPROC nwglCreatePbufferARB;
|
||||
extern PFNWGLGETPBUFFERDCARBPROC nwglGetPbufferDCARB;
|
||||
extern PFNWGLRELEASEPBUFFERDCARBPROC nwglReleasePbufferDCARB;
|
||||
extern PFNWGLDESTROYPBUFFERARBPROC nwglDestroyPbufferARB;
|
||||
extern PFNWGLQUERYPBUFFERARBPROC nwglQueryPbufferARB;
|
||||
|
||||
|
||||
// Get Pixel format extension
|
||||
//===========================
|
||||
extern PFNWGLGETPIXELFORMATATTRIBIVARBPROC nwglGetPixelFormatAttribivARB;
|
||||
extern PFNWGLGETPIXELFORMATATTRIBFVARBPROC nwglGetPixelFormatAttribfvARB;
|
||||
extern PFNWGLCHOOSEPIXELFORMATARBPROC nwglChoosePixelFormatARB;
|
||||
|
||||
|
||||
// Swap control extension
|
||||
//===========================
|
||||
extern PFNWGLSWAPINTERVALEXTPROC nwglSwapIntervalEXT;
|
||||
extern PFNWGLGETSWAPINTERVALEXTPROC nwglGetSwapIntervalEXT;
|
||||
|
||||
|
||||
// WGL_ARB_extensions_string
|
||||
extern PFNWGLGETEXTENSIONSSTRINGARBPROC nwglGetExtensionsStringARB;
|
||||
|
||||
#elif defined(NL_OS_MAC)
|
||||
#elif defined(NL_OS_UNIX)
|
||||
|
||||
// Swap control extensions
|
||||
//===========================
|
||||
extern NEL_PFNGLXSWAPINTERVALEXTPROC nglXSwapIntervalEXT;
|
||||
|
||||
extern PFNGLXSWAPINTERVALSGIPROC nglXSwapIntervalSGI;
|
||||
|
||||
extern NEL_PFNGLXSWAPINTERVALMESAPROC nglXSwapIntervalMESA;
|
||||
extern NEL_PFNGLXGETSWAPINTERVALMESAPROC nglXGetSwapIntervalMESA;
|
||||
|
||||
#endif
|
||||
|
||||
// GL_EXT_framebuffer_object
|
||||
extern NEL_PFNGLISRENDERBUFFEREXTPROC nglIsRenderbufferEXT;
|
||||
extern NEL_PFNGLISFRAMEBUFFEREXTPROC nglIsFramebufferEXT;
|
||||
extern NEL_PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC nglCheckFramebufferStatusEXT;
|
||||
extern NEL_PFNGLGENFRAMEBUFFERSEXTPROC nglGenFramebuffersEXT;
|
||||
extern NEL_PFNGLBINDFRAMEBUFFEREXTPROC nglBindFramebufferEXT;
|
||||
extern NEL_PFNGLFRAMEBUFFERTEXTURE2DEXTPROC nglFramebufferTexture2DEXT;
|
||||
extern NEL_PFNGLGENRENDERBUFFERSEXTPROC nglGenRenderbuffersEXT;
|
||||
extern NEL_PFNGLBINDRENDERBUFFEREXTPROC nglBindRenderbufferEXT;
|
||||
extern NEL_PFNGLRENDERBUFFERSTORAGEEXTPROC nglRenderbufferStorageEXT;
|
||||
extern NEL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC nglFramebufferRenderbufferEXT;
|
||||
extern NEL_PFNGLDELETERENDERBUFFERSEXTPROC nglDeleteRenderbuffersEXT;
|
||||
extern NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC nglDeleteFramebuffersEXT;
|
||||
extern NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC nglGetRenderbufferParameterivEXT;
|
||||
extern NEL_PFNGENERATEMIPMAPEXTPROC nglGenerateMipmapEXT;
|
||||
|
||||
// GL_EXT_framebuffer_blit
|
||||
extern NEL_PFNGLBLITFRAMEBUFFEREXTPROC nglBlitFramebufferEXT;
|
||||
|
||||
// GL_EXT_framebuffer_multisample
|
||||
extern NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC nglRenderbufferStorageMultisampleEXT;
|
||||
|
||||
// GL_ARB_multisample
|
||||
extern NEL_PFNGLSAMPLECOVERAGEARBPROC nglSampleCoverageARB;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // NL_OPENGL_EXTENSION_H
|
||||
|
@ -0,0 +1,254 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef NL_OPENGL_EXTENSION_DEF_H
|
||||
#define NL_OPENGL_EXTENSION_DEF_H
|
||||
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// The NEL Functions Typedefs.
|
||||
// Must do it for compatibilities with futures version of gl.h
|
||||
// eg: version 1.2 does not define PFNGLACTIVETEXTUREARBPROC. Hence, do it now, with our special name
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
||||
#define WGL_COVERAGE_SAMPLES_NV 0x2042
|
||||
#define WGL_COLOR_SAMPLES_NV 0x20B9
|
||||
|
||||
// ARB_multitexture
|
||||
//=================
|
||||
typedef void (APIENTRY * NEL_PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
|
||||
typedef void (APIENTRY * NEL_PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
|
||||
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
|
||||
|
||||
|
||||
// ARB_TextureCompression.
|
||||
//========================
|
||||
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRY * NEL_PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, void *img);
|
||||
|
||||
|
||||
// VertexWeighting.
|
||||
//==================
|
||||
typedef void (APIENTRY * NEL_PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight);
|
||||
typedef void (APIENTRY * NEL_PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight);
|
||||
typedef void (APIENTRY * NEL_PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
|
||||
|
||||
// SecondaryColor extension
|
||||
//========================
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v);
|
||||
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);
|
||||
|
||||
|
||||
// BlendColor extension
|
||||
//========================
|
||||
typedef void (APIENTRY * NEL_PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
|
||||
|
||||
// GL_ATI_fragment_shader extension
|
||||
//==================================
|
||||
typedef GLuint (APIENTRY *NEL_PFNGLGENFRAGMENTSHADERSATIPROC)(GLuint range);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLBINDFRAGMENTSHADERATIPROC)(GLuint id);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLDELETEFRAGMENTSHADERATIPROC)(GLuint id);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLBEGINFRAGMENTSHADERATIPROC)();
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLENDFRAGMENTSHADERATIPROC)();
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLPASSTEXCOORDATIPROC)(GLuint dst, GLuint coord, GLenum swizzle);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLSAMPLEMAPATIPROC)(GLuint dst, GLuint interp, GLenum swizzle);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLCOLORFRAGMENTOP1ATIPROC)(GLenum op, GLuint dst, GLuint dstMask,
|
||||
GLuint dstMod, GLuint arg1, GLuint arg1Rep,
|
||||
GLuint arg1Mod);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLCOLORFRAGMENTOP2ATIPROC)(GLenum op, GLuint dst, GLuint dstMask,
|
||||
GLuint dstMod, GLuint arg1, GLuint arg1Rep,
|
||||
GLuint arg1Mod, GLuint arg2, GLuint arg2Rep,
|
||||
GLuint arg2Mod);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLCOLORFRAGMENTOP3ATIPROC)(GLenum op, GLuint dst, GLuint dstMask,
|
||||
GLuint dstMod, GLuint arg1, GLuint arg1Rep,
|
||||
GLuint arg1Mod, GLuint arg2, GLuint arg2Rep,
|
||||
GLuint arg2Mod, GLuint arg3, GLuint arg3Rep,
|
||||
GLuint arg3Mod);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLALPHAFRAGMENTOP1ATIPROC)(GLenum op, GLuint dst, GLuint dstMod,
|
||||
GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLALPHAFRAGMENTOP2ATIPROC)(GLenum op, GLuint dst, GLuint dstMod,
|
||||
GLuint arg1, GLuint arg1Rep, GLuint arg1Mod,
|
||||
GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLALPHAFRAGMENTOP3ATIPROC)(GLenum op, GLuint dst, GLuint dstMod,
|
||||
GLuint arg1, GLuint arg1Rep, GLuint arg1Mod,
|
||||
GLuint arg2, GLuint arg2Rep, GLuint arg2Mod,
|
||||
GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLSETFRAGMENTSHADERCONSTANTATIPROC)(GLuint dst, const GLfloat *value);
|
||||
|
||||
|
||||
|
||||
// GL_ARB_fragment_program
|
||||
//==================================
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMSTRINGARBPROC)(GLenum target, GLenum format, GLsizei len,const GLvoid *string);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLBINDPROGRAMARBPROC)(GLenum target, GLuint program);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLDELETEPROGRAMSARBPROC)(GLsizei n, const GLuint *programs);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLGENPROGRAMSARBPROC)(GLsizei n, GLuint *programs);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMENVPARAMETER4DARBPROC)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMENVPARAMETER4DVARBPROC)(GLenum target, GLuint index, const GLdouble *params);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMENVPARAMETER4FARBPROC)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMENVPARAMETER4FVARBPROC)(GLenum target, GLuint index, const GLfloat *params);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMLOCALPARAMETER4DARBPROC)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMLOCALPARAMETER4DVARBPROC)(GLenum target, GLuint index, const GLdouble *params);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMLOCALPARAMETER4FARBPROC)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMLOCALPARAMETER4FVARBPROC)(GLenum target, GLuint index, const GLfloat *params);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMENVPARAMETERDVARBPROC)(GLenum target, GLuint index, GLdouble *params);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMENVPARAMETERFVARBPROC)(GLenum target, GLuint index, GLfloat *params);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC)(GLenum target, GLuint index, GLdouble *params);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC)(GLenum target, GLuint index, GLfloat *params);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMIVARBPROC)(GLenum target, GLenum pname, int *params);
|
||||
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMSTRINGARBPROC)(GLenum target, GLenum pname, GLvoid *string);
|
||||
typedef GLboolean (APIENTRY *NEL_PFNGLISPROGRAMARBPROC)(GLuint program);
|
||||
|
||||
|
||||
typedef GLboolean (APIENTRY * NEL_PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);
|
||||
typedef GLboolean (APIENTRY * NEL_PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer);
|
||||
typedef GLenum (APIENTRY * NEL_PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum pname);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGENERATEMIPMAPEXTPROC) (GLenum target);
|
||||
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
|
||||
#ifndef NL_GL_NV_occlusion_query
|
||||
#define NL_GL_NV_occlusion_query 1
|
||||
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids);
|
||||
typedef GLboolean (APIENTRY * NEL_PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLENDOCCLUSIONQUERYNVPROC) ();
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params);
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params);
|
||||
|
||||
#endif /* GL_NV_occlusion_query */
|
||||
|
||||
#ifndef NL_GL_ARB_multisample
|
||||
#define NL_GL_ARB_multisample 1
|
||||
typedef GLvoid (APIENTRY * NEL_PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert);
|
||||
#endif
|
||||
|
||||
#if defined(NL_OS_MAC)
|
||||
|
||||
// Mac GL extensions
|
||||
|
||||
#elif defined(NL_OS_UNIX)
|
||||
|
||||
// GLX extensions
|
||||
#ifndef NL_GLX_EXT_swap_control
|
||||
#define NL_GLX_EXT_swap_control 1
|
||||
|
||||
#ifndef GLX_EXT_swap_control
|
||||
#define GLX_SWAP_INTERVAL_EXT 0x20F1
|
||||
#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2
|
||||
#endif
|
||||
|
||||
typedef GLint (APIENTRY * NEL_PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, GLint interval);
|
||||
|
||||
#endif // NL_GLX_EXT_swap_control
|
||||
|
||||
#ifndef NL_GLX_MESA_swap_control
|
||||
#define NL_GLX_MESA_swap_control 1
|
||||
|
||||
typedef GLint (APIENTRY * NEL_PFNGLXSWAPINTERVALMESAPROC) (GLuint interval);
|
||||
typedef GLint (APIENTRY * NEL_PFNGLXGETSWAPINTERVALMESAPROC) ();
|
||||
|
||||
#endif // NL_GLX_MESA_swap_control
|
||||
|
||||
#ifndef NL_GLX_NV_vertex_array_range
|
||||
#define NL_GLX_NV_vertex_array_range 1
|
||||
typedef void* (APIENTRY * NEL_PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
typedef void (APIENTRY * NEL_PFNGLXFREEMEMORYNVPROC) (void *pointer);
|
||||
#endif // NL_GLX_NV_vertex_array_range
|
||||
|
||||
#endif // NL_OS_MAC
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NL_OPENGL_EXTENSION_DEF_H
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,214 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdopengl.h"
|
||||
|
||||
#include "driver_opengl.h"
|
||||
#include "nel/3d/light.h"
|
||||
|
||||
namespace NL3D {
|
||||
|
||||
#ifdef NL_STATIC
|
||||
namespace NLDRIVERGL3 {
|
||||
#endif
|
||||
|
||||
// ***************************************************************************
|
||||
uint CDriverGL3::getMaxLight () const
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_getMaxLight )
|
||||
// return min(maxLight supported by openGL, MaxLight=8).
|
||||
return _MaxDriverLight;
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL3::setLight (uint8 num, const CLight& light)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_setLight )
|
||||
// bkup real light, for lightmap dynamic lighting purpose
|
||||
if(num==0)
|
||||
{
|
||||
_UserLight0= light;
|
||||
// because the GL setup change, must dirt lightmap rendering
|
||||
_LightMapDynamicLightDirty= true;
|
||||
}
|
||||
|
||||
setLightInternal(num, light);
|
||||
}
|
||||
|
||||
|
||||
CLight CDriverGL3::getLight (uint8 num)
|
||||
{
|
||||
return _UserLight[ num ];
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL3::setLightInternal(uint8 num, const CLight& light)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_setLightInternal)
|
||||
// Check light count is good
|
||||
// nlassert (num<_MaxDriverLight);
|
||||
|
||||
// Set the light
|
||||
if (num<_MaxDriverLight)
|
||||
{
|
||||
// GL light number
|
||||
GLenum lightNum=(GLenum)(GL_LIGHT0+num);
|
||||
|
||||
// Get light mode
|
||||
CLight::TLightMode mode=light.getMode ();
|
||||
|
||||
// Copy the mode
|
||||
_LightMode[num]=mode;
|
||||
|
||||
_UserLight[num] = light;
|
||||
|
||||
// Set the position
|
||||
if ((mode==CLight::DirectionalLight)||(mode==CLight::SpotLight))
|
||||
{
|
||||
// Get the direction of the light
|
||||
_WorldLightDirection[num]=light.getDirection ();
|
||||
}
|
||||
|
||||
if (mode!=CLight::DirectionalLight)
|
||||
{
|
||||
// Get the position of the light
|
||||
_WorldLightPos[num]=light.getPosition ();
|
||||
}
|
||||
|
||||
if (mode==CLight::SpotLight)
|
||||
{
|
||||
// Get the exponent of the spot
|
||||
float exponent=light.getExponent ();
|
||||
|
||||
// Get the cutoff of the spot
|
||||
float cutoff=180.f*(light.getCutoff ()/(float)NLMISC::Pi);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL3::enableLight (uint8 num, bool enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_enableLight )
|
||||
|
||||
// enable the light in GL
|
||||
enableLightInternal(num, enable);
|
||||
|
||||
// because the GL setup has changed, must dirt lightmap rendering
|
||||
_LightMapDynamicLightDirty= true;
|
||||
}
|
||||
|
||||
bool CDriverGL3::isLightEnabled (uint8 num)
|
||||
{
|
||||
if(num<_MaxDriverLight)
|
||||
return _UserLightEnable[num];
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL3::enableLightInternal(uint8 num, bool enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_enableLightInternal)
|
||||
// Check light count is good
|
||||
// nlassert (num<_MaxDriverLight);
|
||||
|
||||
// Enable glLight
|
||||
if (num<_MaxDriverLight)
|
||||
{
|
||||
_DriverGLStates.enableLight(num, enable);
|
||||
_UserLightEnable[ num ] = enable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void CDriverGL3::setAmbientColor (CRGBA color)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_setAmbientColor )
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL3::setLightMapDynamicLight (bool enable, const CLight& light)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_setLightMapDynamicLight )
|
||||
// just store, for future setup in lightmap material rendering
|
||||
_LightMapDynamicLightEnabled= enable;
|
||||
_LightMapDynamicLight= light;
|
||||
_LightMapDynamicLightDirty= true;
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL3::setupLightMapDynamicLighting(bool enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_setupLightMapDynamicLighting)
|
||||
// start lightmap dynamic lighting
|
||||
if(enable)
|
||||
{
|
||||
// disable all lights but the 0th.
|
||||
for(uint i=1;i<_MaxDriverLight;i++)
|
||||
enableLightInternal(i, false);
|
||||
|
||||
// if the dynamic light is really enabled
|
||||
if(_LightMapDynamicLightEnabled)
|
||||
{
|
||||
// then setup and enable
|
||||
setLightInternal(0, _LightMapDynamicLight);
|
||||
enableLightInternal(0, true);
|
||||
}
|
||||
// else just disable also the light 0
|
||||
else
|
||||
{
|
||||
enableLightInternal(0, false);
|
||||
}
|
||||
|
||||
// ok it has been setup
|
||||
_LightMapDynamicLightDirty= false;
|
||||
}
|
||||
// restore old lighting
|
||||
else
|
||||
{
|
||||
// restore the light 0
|
||||
setLightInternal(0, _UserLight0);
|
||||
|
||||
// restore all standard light enable states
|
||||
for(uint i=0;i<_MaxDriverLight;i++)
|
||||
enableLightInternal(i, _UserLightEnable[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void CDriverGL3::disableAllLights()
|
||||
{
|
||||
for( int i = 0; i < MaxLight; i++ )
|
||||
{
|
||||
_UserLightEnable[ i ] = false;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NL_STATIC
|
||||
} // NLDRIVERGL/ES
|
||||
#endif
|
||||
|
||||
} // NL3D
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,134 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdopengl.h"
|
||||
#include "driver_opengl.h"
|
||||
|
||||
namespace NL3D {
|
||||
|
||||
#ifdef NL_STATIC
|
||||
namespace NLDRIVERGL3 {
|
||||
#endif
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL3::setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_setFrustum);
|
||||
|
||||
if( perspective )
|
||||
_GLProjMat.frustum( left, right, bottom, top, znear, zfar );
|
||||
else
|
||||
_GLProjMat.ortho( left, right, bottom, top, znear, zfar );
|
||||
|
||||
_OODeltaZ = 1 / ( zfar - znear );
|
||||
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void CDriverGL3::setFrustumMatrix(CMatrix &frustumMatrix)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_setFrustum)
|
||||
|
||||
_GLProjMat = frustumMatrix;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
CMatrix CDriverGL3::getFrustumMatrix()
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_getFrustum)
|
||||
|
||||
return _GLProjMat;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL3::setupViewMatrixEx(const CMatrix& mtx, const CVector &cameraPos)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_setupViewMatrixEx)
|
||||
_UserViewMtx= mtx;
|
||||
|
||||
// Setup the matrix to transform the CScene basis in openGL basis.
|
||||
CMatrix changeBasis;
|
||||
CVector I(1,0,0);
|
||||
CVector J(0,0,-1);
|
||||
CVector K(0,1,0);
|
||||
|
||||
changeBasis.identity();
|
||||
changeBasis.setRot(I,J,K, true);
|
||||
_ViewMtx=changeBasis*mtx;
|
||||
// Reset the viewMtx position.
|
||||
_ViewMtx.setPos(CVector::Null);
|
||||
_PZBCameraPos= cameraPos;
|
||||
|
||||
_SpecularTexMtx = _ViewMtx;
|
||||
_SpecularTexMtx.setPos(CVector(0.0f,0.0f,0.0f));
|
||||
_SpecularTexMtx.invert();
|
||||
_SpecularTexMtx = changeBasis * _SpecularTexMtx;
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL3::setupViewMatrix(const CMatrix& mtx)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_setupViewMatrix)
|
||||
_UserViewMtx= mtx;
|
||||
|
||||
// Setup the matrix to transform the CScene basis in openGL basis.
|
||||
CMatrix changeBasis;
|
||||
CVector I(1,0,0);
|
||||
CVector J(0,0,-1);
|
||||
CVector K(0,1,0);
|
||||
|
||||
changeBasis.identity();
|
||||
changeBasis.setRot(I,J,K, true);
|
||||
_ViewMtx=changeBasis*mtx;
|
||||
// Just set the PZBCameraPos to 0.
|
||||
_PZBCameraPos= CVector::Null;
|
||||
|
||||
_SpecularTexMtx = _ViewMtx;
|
||||
_SpecularTexMtx.setPos(CVector(0.0f,0.0f,0.0f));
|
||||
_SpecularTexMtx.invert();
|
||||
_SpecularTexMtx = changeBasis * _SpecularTexMtx;
|
||||
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
CMatrix CDriverGL3::getViewMatrix(void) const
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_getViewMatrix)
|
||||
return _UserViewMtx;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL3::setupModelMatrix(const CMatrix& mtx)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_setupModelMatrix)
|
||||
// profiling
|
||||
_NbSetupModelMatrixCall++;
|
||||
|
||||
// Put the matrix in the opengl eye space, and store it.
|
||||
CMatrix mat= mtx;
|
||||
// remove first the _PZBCameraPos
|
||||
mat.setPos(mtx.getPos() - _PZBCameraPos);
|
||||
_ModelViewMatrix= _ViewMtx*mat;
|
||||
}
|
||||
|
||||
#ifdef NL_STATIC
|
||||
} // NLDRIVERGL/ES
|
||||
#endif
|
||||
|
||||
} // NL3D
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,415 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdopengl.h"
|
||||
|
||||
#include "driver_opengl.h"
|
||||
#include "nel/3d/index_buffer.h"
|
||||
#include "driver_opengl_vertex_buffer_hard.h"
|
||||
|
||||
namespace NL3D {
|
||||
|
||||
#ifdef NL_STATIC
|
||||
namespace NLDRIVERGL3 {
|
||||
#endif
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CDriverGL3::renderLines(CMaterial& mat, uint32 firstIndex, uint32 nlines)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_renderLines)
|
||||
|
||||
// setup material
|
||||
if ( !setupMaterial(mat) || _LastIB._Values == NULL )
|
||||
return false;
|
||||
|
||||
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true;
|
||||
// render primitives.
|
||||
//==============================
|
||||
// start multipass.
|
||||
uint nPass;
|
||||
nPass= beginMultiPass();
|
||||
// draw all passes.
|
||||
for(uint pass=0;pass<nPass; pass++)
|
||||
{
|
||||
// setup the pass.
|
||||
if( !setupPass(pass) )
|
||||
return false;
|
||||
|
||||
// draw the primitives.
|
||||
if(nlines)
|
||||
{
|
||||
if (_LastIB._Format == CIndexBuffer::Indices16)
|
||||
{
|
||||
glDrawElements(GL_LINES,2*nlines,GL_UNSIGNED_SHORT,((uint16 *) _LastIB._Values)+firstIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
nlassert(_LastIB._Format == CIndexBuffer::Indices32);
|
||||
glDrawElements(GL_LINES,2*nlines,GL_UNSIGNED_INT,((uint32 *) _LastIB._Values)+firstIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
// end multipass.
|
||||
endMultiPass();
|
||||
|
||||
// Profiling.
|
||||
_PrimitiveProfileIn.NLines+= nlines;
|
||||
_PrimitiveProfileOut.NLines+= nlines;
|
||||
|
||||
nullPrograms();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CDriverGL3::renderTriangles(CMaterial& mat, uint32 firstIndex, uint32 ntris)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_renderTriangles);
|
||||
|
||||
// setup material
|
||||
if ( !setupMaterial(mat) || _LastIB._Values == NULL )
|
||||
return false;
|
||||
|
||||
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true;
|
||||
|
||||
// render primitives.
|
||||
//==============================
|
||||
// start multipass.
|
||||
uint nPass;
|
||||
|
||||
nPass= beginMultiPass();
|
||||
|
||||
// draw all passes.
|
||||
for(uint pass=0;pass<nPass; pass++)
|
||||
{
|
||||
// setup the pass.
|
||||
if( !setupPass(pass) )
|
||||
return false;
|
||||
|
||||
// draw the primitives.
|
||||
if(ntris)
|
||||
{
|
||||
if (_LastIB._Format == CIndexBuffer::Indices16)
|
||||
{
|
||||
glDrawElements(GL_TRIANGLES,3*ntris,GL_UNSIGNED_SHORT, ((uint16 *) _LastIB._Values)+firstIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
nlassert(_LastIB._Format == CIndexBuffer::Indices32);
|
||||
glDrawElements(GL_TRIANGLES,3*ntris,GL_UNSIGNED_INT, ((uint32 *) _LastIB._Values)+firstIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
// end multipass.
|
||||
endMultiPass();
|
||||
|
||||
|
||||
// Profiling.
|
||||
_PrimitiveProfileIn.NTriangles+= ntris;
|
||||
_PrimitiveProfileOut.NTriangles+= ntris * nPass;
|
||||
|
||||
nullPrograms();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CDriverGL3::renderSimpleTriangles(uint32 firstTri, uint32 ntris)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_renderSimpleTriangles);
|
||||
|
||||
nlassert(ntris>0);
|
||||
|
||||
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true;
|
||||
// Don't setup any material here.
|
||||
|
||||
// render primitives.
|
||||
//==============================
|
||||
// NO MULTIPASS HERE!!
|
||||
// draw the primitives. (nb: ntris>0).
|
||||
|
||||
if (_LastIB._Format == CIndexBuffer::Indices16)
|
||||
{
|
||||
glDrawElements(GL_TRIANGLES,3*ntris,GL_UNSIGNED_SHORT, ((uint16 *) _LastIB._Values)+firstTri);
|
||||
}
|
||||
else
|
||||
{
|
||||
nlassert(_LastIB._Format == CIndexBuffer::Indices32);
|
||||
glDrawElements(GL_TRIANGLES,3*ntris,GL_UNSIGNED_INT, ((uint32 *) _LastIB._Values)+firstTri);
|
||||
}
|
||||
|
||||
// Profiling.
|
||||
_PrimitiveProfileIn.NTriangles+= ntris;
|
||||
_PrimitiveProfileOut.NTriangles+= ntris;
|
||||
|
||||
nullPrograms();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CDriverGL3::renderRawPoints(CMaterial& mat, uint32 startIndex, uint32 numPoints)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_renderRawPoints)
|
||||
|
||||
// setup material
|
||||
if ( !setupMaterial(mat) )
|
||||
return false;
|
||||
|
||||
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true;
|
||||
// render primitives.
|
||||
//==============================
|
||||
// start multipass.
|
||||
uint nPass;
|
||||
nPass= beginMultiPass();
|
||||
// draw all passes.
|
||||
for(uint pass=0;pass<nPass; pass++)
|
||||
{
|
||||
// setup the pass.
|
||||
if( !setupPass(pass) )
|
||||
return false;
|
||||
|
||||
// draw the primitives.
|
||||
if(numPoints)
|
||||
glDrawArrays(GL_POINTS, startIndex, numPoints);
|
||||
}
|
||||
// end multipass.
|
||||
endMultiPass();
|
||||
|
||||
|
||||
// Profiling.
|
||||
_PrimitiveProfileIn.NPoints+= numPoints;
|
||||
_PrimitiveProfileOut.NPoints+= numPoints * nPass;
|
||||
|
||||
nullPrograms();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CDriverGL3::renderRawLines(CMaterial& mat, uint32 startIndex, uint32 numLines)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_renderRawLines)
|
||||
|
||||
// setup material
|
||||
if ( !setupMaterial(mat) )
|
||||
return false;
|
||||
|
||||
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true;
|
||||
// render primitives.
|
||||
//==============================
|
||||
// start multipass.
|
||||
uint nPass;
|
||||
nPass= beginMultiPass();
|
||||
// draw all passes.
|
||||
for(uint pass=0;pass<nPass; pass++)
|
||||
{
|
||||
// setup the pass.
|
||||
if( !setupPass(pass) )
|
||||
return false;
|
||||
|
||||
// draw the primitives.
|
||||
if(numLines)
|
||||
glDrawArrays(GL_LINES, startIndex << 1, numLines << 1);
|
||||
}
|
||||
// end multipass.
|
||||
endMultiPass();
|
||||
|
||||
|
||||
// Profiling.
|
||||
_PrimitiveProfileIn.NLines += numLines ;
|
||||
_PrimitiveProfileOut.NLines += numLines * nPass;
|
||||
|
||||
nullPrograms();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CDriverGL3::renderRawTriangles(CMaterial& mat, uint32 startIndex, uint32 numTris)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_renderRawTriangles)
|
||||
|
||||
// setup material
|
||||
if ( !setupMaterial(mat) )
|
||||
return false;
|
||||
|
||||
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true;
|
||||
// render primitives.
|
||||
//==============================
|
||||
// start multipass.
|
||||
uint nPass;
|
||||
nPass= beginMultiPass();
|
||||
// draw all passes.
|
||||
for(uint pass=0;pass<nPass; pass++)
|
||||
{
|
||||
// setup the pass.
|
||||
if( !setupPass(pass) )
|
||||
return false;
|
||||
|
||||
// draw the primitives.
|
||||
if(numTris)
|
||||
{
|
||||
glDrawArrays(GL_TRIANGLES, startIndex*3, numTris*3);
|
||||
}
|
||||
}
|
||||
// end multipass.
|
||||
endMultiPass();
|
||||
|
||||
|
||||
// Profiling.
|
||||
_PrimitiveProfileIn.NTriangles += numTris ;
|
||||
_PrimitiveProfileOut.NTriangles += numTris * nPass;
|
||||
|
||||
nullPrograms();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CDriverGL3::renderRawQuads(CMaterial& mat, uint32 startIndex, uint32 numQuads)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_renderRawQuads)
|
||||
if (!numQuads) return true;
|
||||
|
||||
// setup material
|
||||
if ( !setupMaterial(mat) )
|
||||
return false;
|
||||
|
||||
if (_CurrentVertexBufferHard && _CurrentVertexBufferHard->isInvalid()) return true;
|
||||
|
||||
const uint32 QUAD_BATCH_SIZE = 2048;
|
||||
static GLshort defaultIndices[QUAD_BATCH_SIZE * 6];
|
||||
static bool init = false;
|
||||
if (!init)
|
||||
{
|
||||
// setup the base index buffer
|
||||
for(uint k = 0; k < QUAD_BATCH_SIZE; ++k)
|
||||
{
|
||||
// first tri
|
||||
defaultIndices[k * 6] = (GLshort) (k * 4);
|
||||
defaultIndices[k * 6 + 1] = (GLshort) (k * 4 + 1);
|
||||
defaultIndices[k * 6 + 2] = (GLshort) (k * 4 + 2);
|
||||
// second tri
|
||||
defaultIndices[k * 6 + 3] = (GLshort) (k * 4);
|
||||
defaultIndices[k * 6 + 4] = (GLshort) (k * 4 + 2);
|
||||
defaultIndices[k * 6 + 5] = (GLshort) (k * 4 + 3);
|
||||
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
|
||||
// render primitives.
|
||||
//==============================
|
||||
// start multipass.
|
||||
uint nPass;
|
||||
nPass= beginMultiPass();
|
||||
// draw all passes.
|
||||
for(uint pass=0;pass<nPass; pass++)
|
||||
{
|
||||
// setup the pass.
|
||||
if( !setupPass(pass) )
|
||||
return false;
|
||||
|
||||
uint32 currIndex = startIndex;
|
||||
uint32 numLeftQuads = numQuads;
|
||||
|
||||
// draw first batch of quads using the static setupped array
|
||||
if (startIndex < QUAD_BATCH_SIZE)
|
||||
{
|
||||
// draw first quads (as pair of tri to have guaranteed orientation)
|
||||
uint numQuadsToDraw = std::min(QUAD_BATCH_SIZE - startIndex, numQuads);
|
||||
glDrawElements(GL_TRIANGLES, 6 * numQuadsToDraw, GL_UNSIGNED_SHORT, defaultIndices + 6 * startIndex);
|
||||
numLeftQuads -= numQuadsToDraw;
|
||||
currIndex += 4 * numQuadsToDraw;
|
||||
}
|
||||
|
||||
// draw remaining quads
|
||||
while (numLeftQuads)
|
||||
{
|
||||
// TODO : resetting vertex pointer would avoid the need to rebuild indices each times
|
||||
uint32 numQuadsToDraw = std::min(numLeftQuads, QUAD_BATCH_SIZE);
|
||||
// draw all quads
|
||||
if (4 * numQuadsToDraw + currIndex <= (1 << 16))
|
||||
{
|
||||
// indices fits on 16 bits
|
||||
GLshort indices[QUAD_BATCH_SIZE * 6];
|
||||
GLshort *curr = indices;
|
||||
GLshort *end = indices + 6 * numQuadsToDraw;
|
||||
uint16 vertexIndex = (uint16) currIndex;
|
||||
do
|
||||
{
|
||||
*curr++ = vertexIndex;
|
||||
*curr++ = vertexIndex + 1;
|
||||
*curr++ = vertexIndex + 2;
|
||||
*curr++ = vertexIndex;
|
||||
*curr++ = vertexIndex + 2;
|
||||
*curr++ = vertexIndex + 3;
|
||||
vertexIndex += 4;
|
||||
}
|
||||
while(curr != end);
|
||||
glDrawElements(GL_TRIANGLES, 6 * numQuadsToDraw, GL_UNSIGNED_SHORT, indices);
|
||||
}
|
||||
else
|
||||
{
|
||||
// indices fits on 32 bits
|
||||
GLint indices[QUAD_BATCH_SIZE];
|
||||
GLint *curr = indices;
|
||||
GLint *end = indices + 6 * numQuadsToDraw;
|
||||
uint32 vertexIndex = currIndex;
|
||||
do
|
||||
{
|
||||
*curr++ = vertexIndex;
|
||||
*curr++ = vertexIndex + 1;
|
||||
*curr++ = vertexIndex + 2;
|
||||
*curr++ = vertexIndex;
|
||||
*curr++ = vertexIndex + 2;
|
||||
*curr++ = vertexIndex + 3;
|
||||
vertexIndex += 4;
|
||||
}
|
||||
while(curr != end);
|
||||
glDrawElements(GL_TRIANGLES, 6 * numQuadsToDraw, GL_UNSIGNED_INT, indices);
|
||||
}
|
||||
numLeftQuads -= numQuadsToDraw;
|
||||
currIndex += 4 * numQuadsToDraw;
|
||||
}
|
||||
}
|
||||
// end multipass.
|
||||
endMultiPass();
|
||||
|
||||
|
||||
// Profiling.
|
||||
_PrimitiveProfileIn.NQuads += numQuads ;
|
||||
_PrimitiveProfileOut.NQuads += numQuads * nPass;
|
||||
|
||||
nullPrograms();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef NL_STATIC
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "driver_opengl_shader_cache.h"
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
CShaderCache::CShaderCache()
|
||||
{
|
||||
}
|
||||
|
||||
CShaderCache::~CShaderCache()
|
||||
{
|
||||
clearCache();
|
||||
}
|
||||
|
||||
SShaderPair CShaderCache::findShader( const CShaderDesc &desc ) const
|
||||
{
|
||||
for( int i = 0; i < shaders.size(); i++ )
|
||||
{
|
||||
if( shaders[ i ] == desc )
|
||||
return shaders[ i ].getShaders();
|
||||
}
|
||||
|
||||
return SShaderPair();
|
||||
}
|
||||
|
||||
void CShaderCache::cacheShader( CShaderDesc &desc )
|
||||
{
|
||||
shaders.push_back( desc );
|
||||
}
|
||||
|
||||
void CShaderCache::clearCache()
|
||||
{
|
||||
std::vector< CShaderDesc >::iterator itr = shaders.begin();
|
||||
while( itr != shaders.end() )
|
||||
{
|
||||
SShaderPair sp;
|
||||
sp = itr->getShaders();
|
||||
delete sp.vp;
|
||||
delete sp.pp;
|
||||
++itr;
|
||||
}
|
||||
|
||||
shaders.clear();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,50 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef OPENGL_SHADER_CACHE
|
||||
#define OPENGL_SHADER_CACHE
|
||||
|
||||
#include "driver_opengl_shader_desc.h"
|
||||
#include <vector>
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
/// Caches generated shaders, so they don't have to be generated every frame
|
||||
class CShaderCache
|
||||
{
|
||||
public:
|
||||
CShaderCache();
|
||||
~CShaderCache();
|
||||
|
||||
/// Checks if there's a shader cached that was generated from the specified descriptor
|
||||
SShaderPair findShader( const CShaderDesc &desc ) const;
|
||||
|
||||
/// Caches a shader with the specified descriptor as key
|
||||
void cacheShader( CShaderDesc &desc );
|
||||
|
||||
/// Clears the caches, removes the cached shaders
|
||||
void clearCache();
|
||||
|
||||
private:
|
||||
std::vector< CShaderDesc > shaders;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,278 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef SHADER_DESC
|
||||
#define SHADER_DESC
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
|
||||
#define SHADER_MAX_TEXTURES 4
|
||||
#define SHADER_MAX_LIGHTS 8
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
class CVertexProgram;
|
||||
class CPixelProgram;
|
||||
|
||||
struct SShaderPair
|
||||
{
|
||||
SShaderPair()
|
||||
{
|
||||
vp = NULL;
|
||||
pp = NULL;
|
||||
}
|
||||
|
||||
~SShaderPair()
|
||||
{
|
||||
vp = NULL;
|
||||
pp = NULL;
|
||||
}
|
||||
|
||||
bool empty() const{
|
||||
if( ( vp == NULL ) && ( pp == NULL ) )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
CVertexProgram *vp;
|
||||
CPixelProgram *pp;
|
||||
};
|
||||
|
||||
class CShaderDesc
|
||||
{
|
||||
public:
|
||||
|
||||
enum TShaderType
|
||||
{
|
||||
Normal,
|
||||
Bump_unused,
|
||||
UserColor,
|
||||
LightMap,
|
||||
Specular,
|
||||
Caustics_unused,
|
||||
PerPixelLighting,
|
||||
PerPixelNoSpecular,
|
||||
Cloud,
|
||||
Water
|
||||
};
|
||||
|
||||
enum TFogMode
|
||||
{
|
||||
Exponential,
|
||||
Exponential2,
|
||||
Linear
|
||||
};
|
||||
|
||||
enum TLightMode
|
||||
{
|
||||
Nolight,
|
||||
Directional,
|
||||
Point,
|
||||
Spot
|
||||
};
|
||||
|
||||
CShaderDesc(){
|
||||
for( int i = 0; i < SHADER_MAX_TEXTURES; i++ )
|
||||
texEnvMode[ i ] = 0;
|
||||
|
||||
for( int i = 0; i < SHADER_MAX_LIGHTS; i++ )
|
||||
lightMode[ i ] = Nolight;
|
||||
|
||||
for( int i = 0; i < SHADER_MAX_TEXTURES; i++ )
|
||||
useTextureStage[ i ] = false;
|
||||
useFirstTextureCoordSet = false;
|
||||
noTextures = true;
|
||||
|
||||
features = None;
|
||||
shaderType = Normal;
|
||||
vbFlags = 0;
|
||||
nlightmaps = 0;
|
||||
alphaTestTreshold = 0.5f;
|
||||
fogMode = Linear;
|
||||
pointLight = false;
|
||||
}
|
||||
|
||||
~CShaderDesc(){
|
||||
}
|
||||
|
||||
bool operator==( const CShaderDesc &o ) const
|
||||
{
|
||||
if( noTextures != o.noTextures )
|
||||
return false;
|
||||
|
||||
if( shaderType != o.shaderType )
|
||||
return false;
|
||||
|
||||
if( vbFlags != o.vbFlags )
|
||||
return false;
|
||||
|
||||
if( nlightmaps != o.nlightmaps )
|
||||
return false;
|
||||
|
||||
if( features != o.features )
|
||||
return false;
|
||||
|
||||
if( ( features & AlphaTest ) != 0 )
|
||||
{
|
||||
if( alphaTestTreshold > o.alphaTestTreshold + 0.0001f )
|
||||
return false;
|
||||
|
||||
if( alphaTestTreshold < o.alphaTestTreshold - 0.0001f )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( fogEnabled() )
|
||||
{
|
||||
if( fogMode != o.fogMode )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( shaderType == Normal )
|
||||
{
|
||||
if( useFirstTextureCoordSet != o.useFirstTextureCoordSet )
|
||||
return false;
|
||||
|
||||
for( int i = 0; i < SHADER_MAX_TEXTURES; i++ )
|
||||
if( texEnvMode[ i ] != o.texEnvMode[ i ] )
|
||||
return false;
|
||||
|
||||
for( int i = 0; i < SHADER_MAX_TEXTURES; i++ )
|
||||
if( useTextureStage[ i ] != o.useTextureStage[ i ] )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( lightingEnabled() )
|
||||
{
|
||||
for( int i = 0; i < SHADER_MAX_LIGHTS; i++ )
|
||||
if( lightMode[ i ] != o.lightMode[ i ] )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void setTexEnvMode( uint32 index, uint32 mode ){ texEnvMode[ index ] = mode; }
|
||||
|
||||
void setUseFirstTexCoords( bool b ){ useFirstTextureCoordSet = b; }
|
||||
bool getUseFirstTexCoords() const{ return useFirstTextureCoordSet; }
|
||||
|
||||
void setUseTexStage( uint8 stage, bool b ){ useTextureStage[ stage ] = b; }
|
||||
bool getUseTexStage( uint8 stage ) const{ return useTextureStage[ stage ]; }
|
||||
|
||||
void setNoTextures( bool b ){ noTextures = b; }
|
||||
bool useTextures() const{ return !noTextures; }
|
||||
|
||||
void setVBFlags( uint32 flags ){ vbFlags = flags; }
|
||||
bool hasVBFlags( uint32 flags ) const{
|
||||
if( ( vbFlags & flags ) != 0 )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void setShaderType( uint32 type ){ shaderType = type; }
|
||||
void setNLightMaps( uint32 n ){ nlightmaps = n; }
|
||||
|
||||
void setAlphaTest( bool b )
|
||||
{
|
||||
if( b )
|
||||
features |= AlphaTest;
|
||||
else
|
||||
features &= ~AlphaTest;
|
||||
}
|
||||
|
||||
void setAlphaTestThreshold( float t ){ alphaTestTreshold = t; }
|
||||
|
||||
void setFog( bool b )
|
||||
{
|
||||
if( b )
|
||||
features |= Fog;
|
||||
else
|
||||
features &= ~Fog;
|
||||
}
|
||||
|
||||
bool fogEnabled() const
|
||||
{
|
||||
if( ( features & Fog ) != 0 )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void setFogMode( TFogMode mode ){ fogMode = mode; }
|
||||
|
||||
uint32 getFogMode() const{ return fogMode; }
|
||||
|
||||
void setLighting( bool b )
|
||||
{
|
||||
if( b )
|
||||
features |= Lighting;
|
||||
else
|
||||
features &= ~Lighting;
|
||||
}
|
||||
|
||||
bool lightingEnabled() const
|
||||
{
|
||||
if( ( features & Lighting ) != 0 )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void setLight( int idx, TLightMode mode )
|
||||
{
|
||||
lightMode[ idx ] = mode;
|
||||
if( mode == Point )
|
||||
pointLight = true;
|
||||
}
|
||||
|
||||
TLightMode getLight( int idx ) const{ return lightMode[ idx ]; }
|
||||
|
||||
bool hasPointLight() const{ return pointLight; }
|
||||
|
||||
void setShaders( SShaderPair sp ){ shaderPair = sp; }
|
||||
SShaderPair getShaders() const{ return shaderPair; }
|
||||
|
||||
private:
|
||||
|
||||
enum TShaderFeatures
|
||||
{
|
||||
None = 0,
|
||||
AlphaTest = 1,
|
||||
Fog = 2,
|
||||
Lighting = 4
|
||||
};
|
||||
|
||||
uint32 features;
|
||||
uint32 texEnvMode[ SHADER_MAX_TEXTURES ];
|
||||
bool useTextureStage[ SHADER_MAX_TEXTURES ];
|
||||
bool useFirstTextureCoordSet;
|
||||
bool noTextures;
|
||||
uint32 vbFlags;
|
||||
uint32 shaderType;
|
||||
uint32 nlightmaps;
|
||||
float alphaTestTreshold;
|
||||
uint32 fogMode;
|
||||
TLightMode lightMode[ SHADER_MAX_LIGHTS ];
|
||||
bool pointLight;
|
||||
|
||||
SShaderPair shaderPair;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,724 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdopengl.h"
|
||||
|
||||
#include "driver_opengl.h"
|
||||
|
||||
// ***************************************************************************
|
||||
// define it For Debug purpose only. Normal use is to hide this line
|
||||
//#define NL3D_GLSTATE_DISABLE_CACHE
|
||||
|
||||
namespace NL3D {
|
||||
|
||||
#ifdef NL_STATIC
|
||||
namespace NLDRIVERGL3 {
|
||||
#endif
|
||||
|
||||
// ***************************************************************************
|
||||
CDriverGLStates3::CDriverGLStates3()
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_CDriverGLStates)
|
||||
_TextureCubeMapSupported= false;
|
||||
_CurrARBVertexBuffer = 0;
|
||||
_DepthRangeNear = 0.f;
|
||||
_DepthRangeFar = 1.f;
|
||||
_ZBias = 0.f;
|
||||
_MaxDriverLight= 0;
|
||||
_CullMode = CCW;
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::init(bool supportTextureCubeMap, bool supportTextureRectangle, uint maxLight)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_init)
|
||||
_TextureCubeMapSupported= supportTextureCubeMap;
|
||||
_TextureRectangleSupported= supportTextureRectangle;
|
||||
_MaxDriverLight= maxLight;
|
||||
_MaxDriverLight= std::min(_MaxDriverLight, uint(MaxLight));
|
||||
|
||||
// By default all arrays are disabled.
|
||||
_VertexArrayEnabled= false;
|
||||
_NormalArrayEnabled= false;
|
||||
_WeightArrayEnabled= false;
|
||||
_ColorArrayEnabled= false;
|
||||
_SecondaryColorArrayEnabled= false;
|
||||
uint i;
|
||||
for(i=0; i<sizeof(_TexCoordArrayEnabled)/sizeof(_TexCoordArrayEnabled[0]); i++)
|
||||
{
|
||||
_TexCoordArrayEnabled[i]= false;
|
||||
}
|
||||
for(i=0; i<CVertexBuffer::NumValue; i++)
|
||||
{
|
||||
_VertexAttribArrayEnabled[i]= false;
|
||||
}
|
||||
_DepthRangeNear = 0.f;
|
||||
_DepthRangeFar = 1.f;
|
||||
_ZBias = 0.f;
|
||||
// by default all lights are disabled (not reseted in forceDefaults)
|
||||
for(i=0; i<MaxLight; i++)
|
||||
{
|
||||
_CurLight[i]= false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::forceDefaults(uint nbStages)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_forceDefaults);
|
||||
|
||||
// Enable / disable.
|
||||
_CurFog= false;
|
||||
_CurBlend= false;
|
||||
_CurCullFace= true;
|
||||
_CurAlphaTest= false;
|
||||
_CurLighting= false;
|
||||
_CurZWrite= true;
|
||||
_CurStencilTest=false;
|
||||
_CurMultisample= false;
|
||||
|
||||
// setup GLStates.
|
||||
glDisable(GL_FOG);
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDepthMask(GL_TRUE);
|
||||
glDisable(GL_MULTISAMPLE_ARB);
|
||||
|
||||
// Func.
|
||||
_CurBlendSrc= GL_SRC_ALPHA;
|
||||
_CurBlendDst= GL_ONE_MINUS_SRC_ALPHA;
|
||||
_CurDepthFunc= GL_LEQUAL;
|
||||
_CurStencilFunc = GL_ALWAYS;
|
||||
_CurStencilRef = 0;
|
||||
_CurStencilMask = std::numeric_limits<GLuint>::max();
|
||||
_CurStencilOpFail = GL_KEEP;
|
||||
_CurStencilOpZFail = GL_KEEP;
|
||||
_CurStencilOpZPass = GL_KEEP;
|
||||
_CurStencilWriteMask = std::numeric_limits<GLuint>::max();
|
||||
_CurAlphaTestThreshold= 0.5f;
|
||||
|
||||
// setup GLStates.
|
||||
glBlendFunc(_CurBlendSrc, _CurBlendDst);
|
||||
glDepthFunc(_CurDepthFunc);
|
||||
glStencilFunc(_CurStencilFunc, _CurStencilRef, _CurStencilMask);
|
||||
glStencilOp(_CurStencilOpFail, _CurStencilOpZFail, _CurStencilOpZPass);
|
||||
glStencilMask(_CurStencilWriteMask);
|
||||
|
||||
// Materials.
|
||||
uint32 packedOne= (CRGBA(255,255,255,255)).getPacked();
|
||||
uint32 packedZero= (CRGBA(0,0,0,255)).getPacked();
|
||||
_CurEmissive= packedZero;
|
||||
_CurAmbient= packedOne;
|
||||
_CurDiffuse= packedOne;
|
||||
_CurSpecular= packedZero;
|
||||
_CurShininess= 1;
|
||||
|
||||
// Lighted vertex color
|
||||
_VertexColorLighted=false;
|
||||
glDisable(GL_COLOR_MATERIAL);
|
||||
|
||||
// setup GLStates.
|
||||
static const GLfloat one[4]= {1,1,1,1};
|
||||
static const GLfloat zero[4]= {0,0,0,1};
|
||||
|
||||
// TexModes
|
||||
uint stage;
|
||||
for(stage=0;stage<nbStages; stage++)
|
||||
{
|
||||
// disable texturing.
|
||||
nglActiveTextureARB(GL_TEXTURE0_ARB+stage);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
if(_TextureCubeMapSupported)
|
||||
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||
|
||||
_TextureMode[stage]= TextureDisabled;
|
||||
|
||||
// Tex gen init
|
||||
_TexGenMode[stage] = 0;
|
||||
|
||||
if(_TextureRectangleSupported)
|
||||
glDisable(GL_TEXTURE_RECTANGLE_NV);
|
||||
|
||||
glDisable(GL_TEXTURE_GEN_S);
|
||||
glDisable(GL_TEXTURE_GEN_T);
|
||||
glDisable(GL_TEXTURE_GEN_R);
|
||||
glDisable(GL_TEXTURE_GEN_Q);
|
||||
}
|
||||
|
||||
// ActiveTexture current texture to 0.
|
||||
nglActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
nglClientActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
|
||||
_CurrentActiveTextureARB= 0;
|
||||
_CurrentClientActiveTextureARB= 0;
|
||||
|
||||
// Depth range
|
||||
_DepthRangeNear = 0.f;
|
||||
_DepthRangeFar = 1.f;
|
||||
_ZBias = 0.f;
|
||||
|
||||
glDepthRange (0, 1);
|
||||
|
||||
// Cull order
|
||||
_CullMode = CCW;
|
||||
glCullFace(GL_BACK);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::enableBlend(uint enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_enableBlend)
|
||||
// If different from current setup, update.
|
||||
bool enabled= (enable!=0);
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( enabled != _CurBlend )
|
||||
#endif
|
||||
{
|
||||
// new state.
|
||||
_CurBlend= enabled;
|
||||
// Setup GLState.
|
||||
if(_CurBlend)
|
||||
glEnable(GL_BLEND);
|
||||
else
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::enableCullFace(uint enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_enableCullFace)
|
||||
// If different from current setup, update.
|
||||
bool enabled= (enable!=0);
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( enabled != _CurCullFace )
|
||||
#endif
|
||||
{
|
||||
// new state.
|
||||
_CurCullFace= enabled;
|
||||
// Setup GLState.
|
||||
if(_CurCullFace)
|
||||
glEnable(GL_CULL_FACE);
|
||||
else
|
||||
glDisable(GL_CULL_FACE);
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::enableAlphaTest(uint enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_enableAlphaTest)
|
||||
// If different from current setup, update.
|
||||
bool enabled= (enable!=0);
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( enabled != _CurAlphaTest )
|
||||
#endif
|
||||
{
|
||||
// new state.
|
||||
_CurAlphaTest= enabled;
|
||||
|
||||
// Setup GLState.
|
||||
if(_CurAlphaTest)
|
||||
{
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::enableLighting(uint enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_enableLighting)
|
||||
// If different from current setup, update.
|
||||
bool enabled= (enable!=0);
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( enabled != _CurLighting )
|
||||
#endif
|
||||
{
|
||||
// new state.
|
||||
_CurLighting= enabled;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::enableLight(uint num, uint enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_enableLight)
|
||||
if(num>=_MaxDriverLight)
|
||||
return;
|
||||
|
||||
// If different from current setup, update.
|
||||
bool enabled= (enable!=0);
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( enabled != _CurLight[num] )
|
||||
#endif
|
||||
{
|
||||
// new state.
|
||||
_CurLight[num]= enabled;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDriverGLStates3::isLightEnabled(uint num) const
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_isLightEnabled)
|
||||
if(num>=_MaxDriverLight)
|
||||
return false;
|
||||
else
|
||||
return _CurLight[num];
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::enableZWrite(uint enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_enableZWrite)
|
||||
// If different from current setup, update.
|
||||
bool enabled= (enable!=0);
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( enabled != _CurZWrite )
|
||||
#endif
|
||||
{
|
||||
// new state.
|
||||
_CurZWrite= enabled;
|
||||
// Setup GLState.
|
||||
if(_CurZWrite)
|
||||
glDepthMask(GL_TRUE);
|
||||
else
|
||||
glDepthMask(GL_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::enableStencilTest(bool enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_enableStencilTest);
|
||||
|
||||
// If different from current setup, update.
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( enable != _CurStencilTest )
|
||||
#endif
|
||||
{
|
||||
// new state.
|
||||
_CurStencilTest= enable;
|
||||
// Setup GLState.
|
||||
if(_CurStencilTest)
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
else
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::enableMultisample(bool enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_enableMultisample);
|
||||
|
||||
// If different from current setup, update.
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( enable != _CurMultisample )
|
||||
#endif
|
||||
{
|
||||
// new state.
|
||||
_CurMultisample= enable;
|
||||
|
||||
// Setup GLState.
|
||||
if(_CurMultisample)
|
||||
glEnable(GL_MULTISAMPLE_ARB);
|
||||
else
|
||||
glDisable(GL_MULTISAMPLE_ARB);
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::blendFunc(GLenum src, GLenum dst)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_blendFunc)
|
||||
// If different from current setup, update.
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( src!= _CurBlendSrc || dst!=_CurBlendDst )
|
||||
#endif
|
||||
{
|
||||
// new state.
|
||||
_CurBlendSrc= src;
|
||||
_CurBlendDst= dst;
|
||||
// Setup GLState.
|
||||
glBlendFunc(_CurBlendSrc, _CurBlendDst);
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::depthFunc(GLenum zcomp)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_depthFunc)
|
||||
// If different from current setup, update.
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( zcomp != _CurDepthFunc )
|
||||
#endif
|
||||
{
|
||||
// new state.
|
||||
_CurDepthFunc= zcomp;
|
||||
// Setup GLState.
|
||||
glDepthFunc(_CurDepthFunc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::alphaFunc(float threshold)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_alphaFunc)
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if(threshold != _CurAlphaTestThreshold)
|
||||
#endif
|
||||
{
|
||||
// new state
|
||||
_CurAlphaTestThreshold= threshold;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::stencilFunc(GLenum func, GLint ref, GLuint mask)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_stencilFunc)
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if((func!=_CurStencilFunc) || (ref!=_CurStencilRef) || (mask!=_CurStencilMask))
|
||||
#endif
|
||||
{
|
||||
// new state
|
||||
_CurStencilFunc = func;
|
||||
_CurStencilRef = ref;
|
||||
_CurStencilMask = mask;
|
||||
|
||||
// setup function.
|
||||
glStencilFunc(_CurStencilFunc, _CurStencilRef, _CurStencilMask);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::stencilOp(GLenum fail, GLenum zfail, GLenum zpass)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_stencilOp)
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if((fail!=_CurStencilOpFail) || (zfail!=_CurStencilOpZFail) || (zpass!=_CurStencilOpZPass))
|
||||
#endif
|
||||
{
|
||||
// new state
|
||||
_CurStencilOpFail = fail;
|
||||
_CurStencilOpZFail = zfail;
|
||||
_CurStencilOpZPass = zpass;
|
||||
|
||||
// setup function.
|
||||
glStencilOp(_CurStencilOpFail, _CurStencilOpZFail, _CurStencilOpZPass);
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::stencilMask(GLuint mask)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_stencilMask)
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if(mask!=_CurStencilWriteMask)
|
||||
#endif
|
||||
{
|
||||
// new state
|
||||
_CurStencilWriteMask = mask;
|
||||
|
||||
// setup function.
|
||||
glStencilMask(_CurStencilWriteMask);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::setEmissive(uint32 packedColor, const GLfloat color[4])
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_setEmissive)
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( packedColor!=_CurEmissive )
|
||||
#endif
|
||||
{
|
||||
_CurEmissive= packedColor;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::setAmbient(uint32 packedColor, const GLfloat color[4])
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_setAmbient)
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( packedColor!=_CurAmbient )
|
||||
#endif
|
||||
{
|
||||
_CurAmbient= packedColor;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::setDiffuse(uint32 packedColor, const GLfloat color[4])
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_setDiffuse)
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( packedColor!=_CurDiffuse )
|
||||
#endif
|
||||
{
|
||||
_CurDiffuse= packedColor;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::setSpecular(uint32 packedColor, const GLfloat color[4])
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_setSpecular)
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( packedColor!=_CurSpecular )
|
||||
#endif
|
||||
{
|
||||
_CurSpecular= packedColor;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::setShininess(float shin)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_setShininess)
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( shin != _CurShininess )
|
||||
#endif
|
||||
{
|
||||
_CurShininess= shin;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
static void convColor(CRGBA col, GLfloat glcol[4])
|
||||
{
|
||||
H_AUTO_OGL(convColor)
|
||||
static const float OO255= 1.0f/255;
|
||||
glcol[0]= col.R*OO255;
|
||||
glcol[1]= col.G*OO255;
|
||||
glcol[2]= col.B*OO255;
|
||||
glcol[3]= col.A*OO255;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::setVertexColorLighted(bool enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_setVertexColorLighted)
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( enable != _VertexColorLighted)
|
||||
#endif
|
||||
{
|
||||
_VertexColorLighted= enable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::updateDepthRange()
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_updateDepthRange);
|
||||
|
||||
float delta = _ZBias * (_DepthRangeFar - _DepthRangeNear);
|
||||
|
||||
glDepthRange(delta + _DepthRangeNear, delta + _DepthRangeFar);
|
||||
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::setZBias(float zbias)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_setZBias)
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if (zbias != _ZBias)
|
||||
#endif
|
||||
{
|
||||
_ZBias = zbias;
|
||||
updateDepthRange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::setDepthRange(float znear, float zfar)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_setDepthRange)
|
||||
nlassert(znear != zfar);
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if (znear != _DepthRangeNear || zfar != _DepthRangeFar)
|
||||
#endif
|
||||
{
|
||||
_DepthRangeNear = znear;
|
||||
_DepthRangeFar = zfar;
|
||||
updateDepthRange();
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::setTexGenMode (uint stage, GLint mode)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_setTexGenMode);
|
||||
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if (mode != _TexGenMode[stage])
|
||||
#endif
|
||||
{
|
||||
_TexGenMode[stage] = mode;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::resetTextureMode()
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_resetTextureMode);
|
||||
|
||||
_TextureMode[_CurrentActiveTextureARB]= TextureDisabled;
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::setTextureMode(TTextureMode texMode)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_setTextureMode)
|
||||
TTextureMode oldTexMode = _TextureMode[_CurrentActiveTextureARB];
|
||||
if(oldTexMode != texMode)
|
||||
{
|
||||
|
||||
// new mode.
|
||||
_TextureMode[_CurrentActiveTextureARB]= texMode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::activeTextureARB(uint stage)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_activeTextureARB);
|
||||
|
||||
if( _CurrentActiveTextureARB != stage )
|
||||
{
|
||||
nglActiveTextureARB(GL_TEXTURE0_ARB+stage);
|
||||
|
||||
_CurrentActiveTextureARB= stage;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::forceActiveTextureARB(uint stage)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_forceActiveTextureARB);
|
||||
|
||||
nglActiveTextureARB(GL_TEXTURE0_ARB+stage);
|
||||
|
||||
_CurrentActiveTextureARB= stage;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::enableVertexAttribArrayARB(uint glIndex,bool enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_enableVertexAttribArrayARB);
|
||||
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if(_VertexAttribArrayEnabled[glIndex] != enable)
|
||||
#endif
|
||||
{
|
||||
if( enable )
|
||||
nglEnableVertexAttribArray(glIndex);
|
||||
else
|
||||
nglDisableVertexAttribArray(glIndex);
|
||||
|
||||
_VertexAttribArrayEnabled[glIndex]= enable;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::enableFog(uint enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_enableFog)
|
||||
// If different from current setup, update.
|
||||
bool enabled= (enable!=0);
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if( enabled != _CurFog )
|
||||
#endif
|
||||
{
|
||||
// new state.
|
||||
_CurFog= enabled;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::forceBindARBVertexBuffer(uint objectID)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_forceBindARBVertexBuffer)
|
||||
|
||||
nglBindBuffer(GL_ARRAY_BUFFER, objectID);
|
||||
|
||||
_CurrARBVertexBuffer = objectID;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::bindARBVertexBuffer(uint objectID)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_bindARBVertexBuffer)
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if (objectID != _CurrARBVertexBuffer)
|
||||
#endif
|
||||
{
|
||||
forceBindARBVertexBuffer(objectID);
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates3::setCullMode(TCullMode cullMode)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_setCullMode)
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if (cullMode != _CullMode)
|
||||
#endif
|
||||
{
|
||||
glCullFace(cullMode == CCW ? GL_BACK : GL_FRONT);
|
||||
_CullMode = cullMode;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
CDriverGLStates3::TCullMode CDriverGLStates3::getCullMode() const
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates3_CDriverGLStates)
|
||||
return _CullMode;
|
||||
}
|
||||
|
||||
#ifdef NL_STATIC
|
||||
} // NLDRIVERGL/ES
|
||||
#endif
|
||||
|
||||
} // NL3D
|
@ -0,0 +1,240 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef NL_DRIVER_OPENGL_STATES_H
|
||||
#define NL_DRIVER_OPENGL_STATES_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/3d/vertex_buffer.h"
|
||||
|
||||
namespace NL3D {
|
||||
|
||||
#ifdef NL_STATIC
|
||||
namespace NLDRIVERGL3 {
|
||||
#endif
|
||||
|
||||
// ***************************************************************************
|
||||
/**
|
||||
* Class for optimizing calls to openGL states, by caching old ones.
|
||||
* All following call with OpenGL must be done with only one instance of this class:
|
||||
- glEnable() glDisable() with:
|
||||
- GL_BLEND
|
||||
- GL_CULL_FACE
|
||||
- GL_ALPHA_TEST
|
||||
- GL_LIGHTING
|
||||
- GL_LIGHT0 + i .....
|
||||
- GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP_ARB/OES.
|
||||
- GL_TEXTURE_GEN_S, GL_TEXTURE_GEN_T, GL_TEXTURE_GEN_R
|
||||
- GL_COLOR_MATERIAL
|
||||
- GL_FOG
|
||||
- GL_MULTISAMPLE_ARB
|
||||
- glActiveTextureARB()
|
||||
- glClientActiveTextureARB()
|
||||
- glEnableClientState() glDisableClientState() with:
|
||||
- GL_VERTEX_ARRAY
|
||||
- GL_NORMAL_ARRAY
|
||||
- GL_VERTEX_WEIGHTING_EXT
|
||||
- GL_COLOR_ARRAY
|
||||
- GL_SECONDARY_COLOR_ARRAY_EXT
|
||||
- GL_TEXTURE_COORD_ARRAY
|
||||
- GL_VERTEX_ATTRIB_ARRAY0_NV + i.
|
||||
- glDepthMask()
|
||||
- glAlphaFunc()
|
||||
- glBlendFunc()
|
||||
- glDepthFunc()
|
||||
- glMaterialf() and glMaterialfv() for:
|
||||
- GL_EMISSION
|
||||
- GL_AMBIENT
|
||||
- GL_DIFFUSE
|
||||
- GL_SPECULAR
|
||||
- GL_SHININESS
|
||||
- glDepthRange()
|
||||
- glColorMaterial()
|
||||
- glTexGeni()
|
||||
* \author Lionel Berenguier
|
||||
* \author Nevrax France
|
||||
* \date 2001
|
||||
*/
|
||||
class CDriverGLStates3
|
||||
{
|
||||
public:
|
||||
/// Constructor. no-op.
|
||||
CDriverGLStates3();
|
||||
// init. Do it just after setDisplay()
|
||||
void init(bool supportTextureCubeMap, bool supportTextureRectangle, uint maxLight);
|
||||
|
||||
/// Reset all OpenGL states of interest to default, and update caching. This don't apply to light.
|
||||
void forceDefaults(uint nbTextureStages);
|
||||
|
||||
/// \name enable if !0
|
||||
// @{
|
||||
void enableBlend(uint enable);
|
||||
void enableFog(uint enable);
|
||||
void enableCullFace(uint enable);
|
||||
/// enable and set good AlphaFunc.
|
||||
void enableAlphaTest(uint enable);
|
||||
void enableZWrite(uint enable);
|
||||
// overall lighting enabled
|
||||
void enableLighting(uint enable);
|
||||
bool isLightingEnabled() const { return _CurLighting; }
|
||||
/// enable/disable specific light. num must be < "maxLight" param set in init()
|
||||
void enableLight(uint num, uint enable);
|
||||
bool isLightEnabled(uint num) const;
|
||||
/// enable/disable stencil test
|
||||
void enableStencilTest(bool enable);
|
||||
bool isStencilTestEnabled() const { return _CurStencilTest; }
|
||||
/// enable/disable multisample
|
||||
void enableMultisample(bool enable);
|
||||
bool isMultisampleEnabled() const { return _CurMultisample; }
|
||||
// @}
|
||||
|
||||
/// glBlendFunc.
|
||||
void blendFunc(GLenum src, GLenum dst);
|
||||
/// glDepthFunc.
|
||||
void depthFunc(GLenum zcomp);
|
||||
/// glAlphaFunc
|
||||
void alphaFunc(float threshold);
|
||||
/// glStencilFunc
|
||||
void stencilFunc(GLenum stencilFunc, GLint ref, GLuint mask);
|
||||
/// glStencilOp
|
||||
void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
|
||||
/// glStencilMask
|
||||
void stencilMask(uint mask);
|
||||
|
||||
/// \name Material setting.
|
||||
/// Each f() get an uint32 for fast comparison, and OpenGL colors.
|
||||
// @{
|
||||
void setEmissive(uint32 packedColor, const GLfloat color[4]);
|
||||
void setAmbient(uint32 packedColor, const GLfloat color[4]);
|
||||
void setDiffuse(uint32 packedColor, const GLfloat color[4]);
|
||||
void setSpecular(uint32 packedColor, const GLfloat color[4]);
|
||||
void setShininess(float shin);
|
||||
void setVertexColorLighted(bool enable);
|
||||
void setDepthRange (float znear, float zfar);
|
||||
void getDepthRange(float &znear, float &zfar) const { znear = _DepthRangeNear; zfar = _DepthRangeFar; }
|
||||
/** Set z-bias
|
||||
* NB : this is done in window coordinate, not in world coordinate as with CMaterial
|
||||
*/
|
||||
void setZBias(float zbias);
|
||||
// NB: set 0 to reset TexGen.
|
||||
void setTexGenMode (uint stage, GLint mode);
|
||||
// @}
|
||||
|
||||
|
||||
|
||||
/// \name Texture Mode setting.
|
||||
// @{
|
||||
enum TTextureMode {TextureDisabled, Texture2D, TextureRect, TextureCubeMap, TextureModeCount};
|
||||
/// same as glActiveTextureARB(). useful for setTextureMode.
|
||||
void activeTextureARB(uint stage);
|
||||
/// same as active texture arb, but with no cache check
|
||||
void forceActiveTextureARB(uint stage);
|
||||
/// get active texture
|
||||
uint getActiveTextureARB() const { return _CurrentActiveTextureARB; }
|
||||
/** change if needed the texture mode of the current active Texture ARB.
|
||||
* NB: if CubeMap extension not supported, TextureCubeMap <=> TextureDisabled.
|
||||
*/
|
||||
void setTextureMode(TTextureMode texMode);
|
||||
TTextureMode getTextureMode() const { return _TextureMode[_CurrentActiveTextureARB]; }
|
||||
// reset texture mode to the default (disabled) for the current stage. It forces the state (useful after texture shaders)
|
||||
void resetTextureMode();
|
||||
// @}
|
||||
|
||||
// special version for ARB_vertex_program used with ARB_vertex_buffer or ATI_vertex_attrib_array_object
|
||||
void enableVertexAttribArrayARB(uint glIndex, bool enable);
|
||||
|
||||
|
||||
// ARB_vertex_buffer_object buffer binding
|
||||
void bindARBVertexBuffer(uint objectID);
|
||||
void forceBindARBVertexBuffer(uint objectID);
|
||||
uint getCurrBoundARBVertexBuffer() const { return _CurrARBVertexBuffer; }
|
||||
|
||||
enum TCullMode { CCW = 0, CW };
|
||||
void setCullMode(TCullMode cullMode);
|
||||
TCullMode getCullMode() const;
|
||||
|
||||
private:
|
||||
bool _CurBlend;
|
||||
bool _CurFog;
|
||||
bool _CurCullFace;
|
||||
bool _CurAlphaTest;
|
||||
bool _CurLighting;
|
||||
bool _CurZWrite;
|
||||
bool _CurStencilTest;
|
||||
bool _CurMultisample;
|
||||
|
||||
GLenum _CurBlendSrc;
|
||||
GLenum _CurBlendDst;
|
||||
GLenum _CurDepthFunc;
|
||||
GLenum _CurStencilFunc;
|
||||
GLint _CurStencilRef;
|
||||
GLuint _CurStencilMask;
|
||||
GLenum _CurStencilOpFail;
|
||||
GLenum _CurStencilOpZFail;
|
||||
GLenum _CurStencilOpZPass;
|
||||
GLuint _CurStencilWriteMask;
|
||||
float _CurAlphaTestThreshold;
|
||||
|
||||
uint32 _CurEmissive;
|
||||
uint32 _CurAmbient;
|
||||
uint32 _CurDiffuse;
|
||||
uint32 _CurSpecular;
|
||||
float _CurShininess;
|
||||
bool _VertexColorLighted;
|
||||
|
||||
bool _TextureCubeMapSupported;
|
||||
bool _TextureRectangleSupported;
|
||||
uint _CurrentActiveTextureARB;
|
||||
TTextureMode _TextureMode[8];
|
||||
|
||||
bool _VertexArrayEnabled;
|
||||
bool _NormalArrayEnabled;
|
||||
bool _WeightArrayEnabled;
|
||||
bool _ColorArrayEnabled;
|
||||
bool _SecondaryColorArrayEnabled;
|
||||
uint _CurrentClientActiveTextureARB;
|
||||
bool _TexCoordArrayEnabled[8];
|
||||
bool _VertexAttribArrayEnabled[CVertexBuffer::NumValue];
|
||||
|
||||
GLint _TexGenMode[8];
|
||||
|
||||
uint _CurrARBVertexBuffer;
|
||||
|
||||
float _DepthRangeNear;
|
||||
float _DepthRangeFar;
|
||||
float _ZBias; // NB : zbias is in window coordinates
|
||||
|
||||
TCullMode _CullMode;
|
||||
|
||||
private:
|
||||
void updateDepthRange();
|
||||
|
||||
// Mirror of glEnable() and GL_LIGHT0+i
|
||||
enum {MaxLight=8};
|
||||
uint _MaxDriverLight;
|
||||
bool _CurLight[MaxLight];
|
||||
};
|
||||
|
||||
#ifdef NL_STATIC
|
||||
} // NLDRIVERGL/ES
|
||||
#endif
|
||||
|
||||
} // NL3D
|
||||
|
||||
|
||||
#endif // NL_DRIVER_OPENGL_STATES_H
|
||||
|
||||
/* End of driver_opengl_states.h */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,518 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdopengl.h"
|
||||
|
||||
#include "driver_opengl.h"
|
||||
#include "nel/3d/index_buffer.h"
|
||||
#include "driver_opengl_vertex_buffer_hard.h"
|
||||
|
||||
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
||||
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
// Flags for software vertex skinning.
|
||||
#define NL3D_DRV_SOFTSKIN_VNEEDCOMPUTE 3
|
||||
#define NL3D_DRV_SOFTSKIN_VMUSTCOMPUTE 1
|
||||
#define NL3D_DRV_SOFTSKIN_VCOMPUTED 0
|
||||
// 3 means "vertex may need compute".
|
||||
// 1 means "Primitive say vertex must be computed".
|
||||
// 0 means "vertex is computed".
|
||||
|
||||
|
||||
// 500K min.
|
||||
#define NL3D_DRV_VERTEXARRAY_MINIMUM_SIZE (512*1024)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace NL3D {
|
||||
|
||||
#ifdef NL_STATIC
|
||||
namespace NLDRIVERGL3 {
|
||||
#endif
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
CVBDrvInfosGL3::CVBDrvInfosGL3(CDriverGL3 *drv, ItVBDrvInfoPtrList it, CVertexBuffer *vb) : IVBDrvInfos(drv, it, vb)
|
||||
{
|
||||
H_AUTO_OGL(CVBDrvInfosGL_CVBDrvInfosGL)
|
||||
_DriverGL = drv;
|
||||
_VBHard = NULL;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
CVBDrvInfosGL3::~CVBDrvInfosGL3()
|
||||
{
|
||||
H_AUTO_OGL(CVBDrvInfosGL_CVBDrvInfosGLDtor)
|
||||
// Restaure non resident memory
|
||||
if (VertexBufferPtr)
|
||||
{
|
||||
VertexBufferPtr->setLocation(CVertexBuffer::NotResident);
|
||||
VertexBufferPtr = NULL;
|
||||
}
|
||||
|
||||
if (_VBHard)
|
||||
{
|
||||
_VBHard->disable();
|
||||
_DriverGL->_VertexBufferHardSet.erase(_VBHard);
|
||||
}
|
||||
|
||||
_VBHard = NULL;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
uint8 *CVBDrvInfosGL3::lock (uint /* first */, uint /* last */, bool /* readOnly */)
|
||||
{
|
||||
H_AUTO_OGL(CVBDrvInfosGL_lock)
|
||||
return (uint8*)_VBHard->lock ();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CVBDrvInfosGL3::unlock (uint first, uint last)
|
||||
{
|
||||
H_AUTO_OGL(CVBDrvInfosGL_unlock)
|
||||
_VBHard->unlock(first, last);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDriverGL3::setupVertexBuffer(CVertexBuffer& VB)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_setupVertexBuffer)
|
||||
// 2. If necessary, do modifications.
|
||||
//==================================
|
||||
const bool touched = (VB.getTouchFlags() & (CVertexBuffer::TouchedReserve|CVertexBuffer::TouchedVertexFormat)) != 0;
|
||||
if( touched || (VB.DrvInfos == NULL))
|
||||
{
|
||||
// delete first
|
||||
if(VB.DrvInfos)
|
||||
delete VB.DrvInfos;
|
||||
VB.DrvInfos = NULL;
|
||||
|
||||
// create only if some vertices
|
||||
if(VB.getNumVertices())
|
||||
{
|
||||
// 1. Retrieve/Create driver shader.
|
||||
//==================================
|
||||
// insert into driver list. (so it is deleted when driver is deleted).
|
||||
ItVBDrvInfoPtrList it= _VBDrvInfos.insert(_VBDrvInfos.end(), (NL3D::IVBDrvInfos*)NULL);
|
||||
// create and set iterator, for future deletion.
|
||||
CVBDrvInfosGL3 *info = new CVBDrvInfosGL3(this, it, &VB);
|
||||
*it= VB.DrvInfos = info;
|
||||
|
||||
// Preferred memory
|
||||
CVertexBuffer::TPreferredMemory preferred = VB.getPreferredMemory ();
|
||||
if ((preferred == CVertexBuffer::RAMVolatile) ||
|
||||
(preferred == CVertexBuffer::AGPVolatile) ||
|
||||
(preferred == CVertexBuffer::RAMPreferred ) )
|
||||
preferred = CVertexBuffer::AGPPreferred;
|
||||
|
||||
const uint size = VB.capacity()*VB.getVertexSize();
|
||||
|
||||
// Vertex buffer hard
|
||||
info->_VBHard = createVertexBufferHard(size, VB.capacity(), preferred, &VB);
|
||||
|
||||
// Upload the data
|
||||
VB.setLocation ((CVertexBuffer::TLocation)preferred);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDriverGL3::activeVertexBuffer(CVertexBuffer& VB)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_activeVertexBuffer)
|
||||
// NB: must duplicate changes in activeVertexBufferHard()
|
||||
uint32 flags;
|
||||
|
||||
// setup
|
||||
if (!setupVertexBuffer(VB))
|
||||
return false;
|
||||
|
||||
if (VB.getNumVertices()==0)
|
||||
return true;
|
||||
|
||||
// Fill the buffer if in local memory
|
||||
VB.fillBuffer ();
|
||||
|
||||
// Get VB flags, to setup matrixes and arrays.
|
||||
flags=VB.getVertexFormat();
|
||||
|
||||
|
||||
// 2. Setup Arrays.
|
||||
//===================
|
||||
// For MultiPass Material.
|
||||
CVBDrvInfosGL3 *info= safe_cast<CVBDrvInfosGL3*>((IVBDrvInfos*)VB.DrvInfos);
|
||||
if (!info->_VBHard || (info->_VBHard && !info->_VBHard->isInvalid()))
|
||||
_LastVB.setupVertexBuffer(VB);
|
||||
|
||||
if (info->_VBHard == NULL)
|
||||
{
|
||||
// Disable the current vertexBufferHard if setuped.
|
||||
if(_CurrentVertexBufferHard)
|
||||
_CurrentVertexBufferHard->disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 2. Setup Arrays.
|
||||
//===================
|
||||
|
||||
// Enable the vertexArrayRange of this array.
|
||||
info->_VBHard->enable();
|
||||
}
|
||||
if (!info->_VBHard || (info->_VBHard && !info->_VBHard->isInvalid()))
|
||||
{
|
||||
setupGlArrays(_LastVB);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDriverGL3::activeIndexBuffer(CIndexBuffer& IB)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_activeIndexBuffer)
|
||||
_LastIB.setupIndexBuffer(IB);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// VertexBufferHard
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDriverGL3::supportVolatileVertexBuffer() const
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_supportVolatileVertexBuffer)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDriverGL3::slowUnlockVertexBufferHard() const
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_slowUnlockVertexBufferHard)
|
||||
return _SlowUnlockVBHard;
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
uint CDriverGL3::getMaxVerticesByVertexBufferHard() const
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_getMaxVerticesByVertexBufferHard)
|
||||
return std::numeric_limits<uint32>::max();
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
IVertexBufferHardGL *CDriverGL3::createVertexBufferHard(uint size, uint numVertices, CVertexBuffer::TPreferredMemory vbType, CVertexBuffer *vb)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_createVertexBufferHard)
|
||||
// choose the VertexArrayRange of good type
|
||||
IVertexArrayRange *vertexArrayRange= NULL;
|
||||
switch(vbType)
|
||||
{
|
||||
case CVertexBuffer::AGPPreferred:
|
||||
vertexArrayRange= _AGPVertexArrayRange;
|
||||
break;
|
||||
case CVertexBuffer::StaticPreferred:
|
||||
if (getStaticMemoryToVRAM())
|
||||
vertexArrayRange= _VRAMVertexArrayRange;
|
||||
else
|
||||
vertexArrayRange= _AGPVertexArrayRange;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// If this one at least created (an extension support it).
|
||||
if( !vertexArrayRange )
|
||||
return NULL;
|
||||
else
|
||||
{
|
||||
// Create a CVertexBufferHardGL
|
||||
IVertexBufferHardGL *vbHard = NULL;
|
||||
// let the VAR create the vbhard.
|
||||
vbHard= vertexArrayRange->createVBHardGL(size, vb);
|
||||
// if fails
|
||||
if(!vbHard)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// insert in list.
|
||||
return _VertexBufferHardSet.insert(vbHard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
const uint CDriverGL3::NumCoordinatesType[CVertexBuffer::NumType]=
|
||||
{
|
||||
1, // Double1
|
||||
1, // Float1
|
||||
1, // Short1
|
||||
2, // Double2
|
||||
2, // Float2
|
||||
2, // Short2
|
||||
3, // Double3
|
||||
3, // Float3
|
||||
3, // Short3
|
||||
4, // Double4
|
||||
4, // Float4
|
||||
4, // Short4
|
||||
4 // UChar4
|
||||
};
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
const uint CDriverGL3::GLType[CVertexBuffer::NumType]=
|
||||
{
|
||||
GL_DOUBLE, // Double1
|
||||
GL_FLOAT, // Float1
|
||||
GL_SHORT, // Short1
|
||||
GL_DOUBLE, // Double2
|
||||
GL_FLOAT, // Float2
|
||||
GL_SHORT, // Short2
|
||||
GL_DOUBLE, // Double3
|
||||
GL_FLOAT, // Float3
|
||||
GL_SHORT, // Short3
|
||||
GL_DOUBLE, // Double4
|
||||
GL_FLOAT, // Float4
|
||||
GL_SHORT, // Short4
|
||||
GL_UNSIGNED_BYTE // UChar4
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
const bool CDriverGL3::GLTypeIsIntegral[CVertexBuffer::NumType] =
|
||||
{
|
||||
false, // Double1
|
||||
false, // Float1
|
||||
true, // Short1
|
||||
false, // Double2
|
||||
false, // Float2
|
||||
true, // Short2
|
||||
false, // Double3
|
||||
false, // Float3
|
||||
true, // Short3
|
||||
false, // Double4
|
||||
false, // Float4
|
||||
true, // Short4
|
||||
true // UChar4
|
||||
};
|
||||
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
const uint CDriverGL3::GLVertexAttribIndex[CVertexBuffer::NumValue]=
|
||||
{
|
||||
0, // Position
|
||||
2, // Normal
|
||||
8, // TexCoord0
|
||||
9, // TexCoord1
|
||||
10, // TexCoord2
|
||||
11, // TexCoord3
|
||||
12, // TexCoord4
|
||||
13, // TexCoord5
|
||||
14, // TexCoord6
|
||||
15, // TexCoord7
|
||||
3, // PrimaryColor
|
||||
4, // SecondaryColor
|
||||
1, // Weight
|
||||
6, // Empty (PaletteSkin)
|
||||
5, // Fog
|
||||
7, // Empty
|
||||
};
|
||||
|
||||
// tells for each vertex argument if it must be normalized when it is an integral type
|
||||
static const GLboolean ARBVertexProgramMustNormalizeAttrib[] =
|
||||
{
|
||||
GL_FALSE, // Position
|
||||
GL_TRUE, // Normal
|
||||
GL_FALSE, // TexCoord0
|
||||
GL_FALSE, // TexCoord1
|
||||
GL_FALSE, // TexCoord2
|
||||
GL_FALSE, // TexCoord3
|
||||
GL_FALSE, // TexCoord4
|
||||
GL_FALSE, // TexCoord5
|
||||
GL_FALSE, // TexCoord6
|
||||
GL_FALSE, // TexCoord7
|
||||
GL_TRUE, // PrimaryColor
|
||||
GL_TRUE, // SecondaryColor
|
||||
GL_TRUE, // Weight
|
||||
GL_FALSE, // PaletteSkin
|
||||
GL_FALSE, // Fog
|
||||
GL_FALSE, // Empty
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL3::setupGlArrays(CVertexBufferInfo &vb)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_setupGlArrays)
|
||||
|
||||
uint32 flags= vb.VertexFormat;
|
||||
|
||||
nlctassert(CVertexBuffer::NumValue == sizeof(ARBVertexProgramMustNormalizeAttrib) / sizeof(ARBVertexProgramMustNormalizeAttrib[0]));
|
||||
_DriverGLStates.bindARBVertexBuffer(vb.VertexObjectId);
|
||||
|
||||
{
|
||||
// For each value
|
||||
for (uint value=0; value<CVertexBuffer::NumValue; value++)
|
||||
{
|
||||
// Flag
|
||||
uint16 flag=1<<value;
|
||||
|
||||
// Type
|
||||
CVertexBuffer::TType type=vb.Type[value];
|
||||
{
|
||||
// Index
|
||||
uint glIndex=GLVertexAttribIndex[value];
|
||||
// Not setuped value and used
|
||||
if (flags & flag)
|
||||
{
|
||||
_DriverGLStates.enableVertexAttribArrayARB(glIndex, true);
|
||||
GLboolean mustNormalize = GL_FALSE;
|
||||
if (GLTypeIsIntegral[type])
|
||||
{
|
||||
mustNormalize = ARBVertexProgramMustNormalizeAttrib[value];
|
||||
}
|
||||
nglVertexAttribPointer( glIndex, NumCoordinatesType[type], GLType[ type ], mustNormalize, vb.VertexSize, vb.ValuePtr[value] );
|
||||
}
|
||||
else
|
||||
{
|
||||
_DriverGLStates.enableVertexAttribArrayARB(glIndex, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CVertexBufferInfo::setupVertexBuffer(CVertexBuffer &vb)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_setupVertexBuffer)
|
||||
sint i;
|
||||
VertexFormat= vb.getVertexFormat();
|
||||
VertexSize= vb.getVertexSize();
|
||||
NumVertices= vb.getNumVertices();
|
||||
|
||||
// Lock the buffer
|
||||
CVertexBufferReadWrite access;
|
||||
uint8 *ptr;
|
||||
CVBDrvInfosGL3 *info= safe_cast<CVBDrvInfosGL3*>((IVBDrvInfos*)vb.DrvInfos);
|
||||
nlassert (info);
|
||||
|
||||
ptr = (uint8*)info->_VBHard->getPointer();
|
||||
info->_VBHard->setupVBInfos(*this);
|
||||
|
||||
// Get value pointer
|
||||
for (i=0; i<CVertexBuffer::NumValue; i++)
|
||||
{
|
||||
// Value used ?
|
||||
if (VertexFormat&(1<<i))
|
||||
{
|
||||
// Get the pointer
|
||||
ValuePtr[i]= ptr+vb.getValueOffEx((CVertexBuffer::TValue)i);
|
||||
|
||||
// Type of the value
|
||||
Type[i]=vb.getValueType (i);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy the UVRouting table
|
||||
const uint8 *uvRouting = vb.getUVRouting();
|
||||
for (i=0; i<CVertexBuffer::MaxStage; i++)
|
||||
{
|
||||
UVRouting[i] = uvRouting[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL3::resetVertexArrayRange()
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_resetVertexArrayRange)
|
||||
if(_CurrentVertexBufferHard)
|
||||
{
|
||||
// Must ensure it has ended any drawing
|
||||
_CurrentVertexBufferHard->lock();
|
||||
_CurrentVertexBufferHard->unlock();
|
||||
// disable it
|
||||
_CurrentVertexBufferHard->disable();
|
||||
}
|
||||
// Clear any VertexBufferHard created.
|
||||
_VertexBufferHardSet.clear();
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDriverGL3::initVertexBufferHard(uint agpMem, uint vramMem)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL3_initVertexBufferHard)
|
||||
|
||||
// must be supported
|
||||
if(!_AGPVertexArrayRange || !_VRAMVertexArrayRange)
|
||||
return false;
|
||||
|
||||
// First, reset any VBHard created.
|
||||
resetVertexArrayRange();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
CIndexBufferInfo::CIndexBufferInfo()
|
||||
{
|
||||
H_AUTO_OGL(CIndexBufferInfo_CIndexBufferInfo)
|
||||
_Values = NULL;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void CIndexBufferInfo::setupIndexBuffer(CIndexBuffer &ib)
|
||||
{
|
||||
H_AUTO_OGL(CIndexBufferInfo_setupIndexBuffer)
|
||||
CIndexBufferReadWrite access;
|
||||
ib.lock (access);
|
||||
_Values = access.getPtr();
|
||||
_Format = access.getFormat();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
#ifdef NL_STATIC
|
||||
} // NLDRIVERGL/ES
|
||||
#endif
|
||||
|
||||
} // NL3D
|
@ -0,0 +1,434 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdopengl.h"
|
||||
|
||||
#include "driver_opengl.h"
|
||||
#include "driver_opengl_vertex_buffer_hard.h"
|
||||
|
||||
#include "nel/3d/vertex_buffer.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
||||
namespace NL3D {
|
||||
|
||||
#ifdef NL_STATIC
|
||||
namespace NLDRIVERGL3 {
|
||||
#endif
|
||||
|
||||
// ***************************************************************************
|
||||
IVertexArrayRange::IVertexArrayRange(CDriverGL3 *drv)
|
||||
{
|
||||
H_AUTO_OGL(IVertexArrayRange_IVertexArrayRange)
|
||||
_Driver= drv;
|
||||
}
|
||||
// ***************************************************************************
|
||||
IVertexArrayRange::~IVertexArrayRange()
|
||||
{
|
||||
H_AUTO_OGL(IVertexArrayRange_IVertexArrayRangeDtor)
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
IVertexBufferHardGL::IVertexBufferHardGL(CDriverGL3 *drv, CVertexBuffer *vb) : VB (vb)
|
||||
{
|
||||
H_AUTO_OGL(IVertexBufferHardGL_IVertexBufferHardGL)
|
||||
_Driver= drv;
|
||||
_Invalid = false;
|
||||
}
|
||||
// ***************************************************************************
|
||||
IVertexBufferHardGL::~IVertexBufferHardGL()
|
||||
{
|
||||
H_AUTO_OGL(IVertexBufferHardGL_IVertexBufferHardGLDtor)
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
// CVertexArrayRangeARB
|
||||
// ***************************************************************************
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
CVertexArrayRange::CVertexArrayRange(CDriverGL3 *drv) : IVertexArrayRange(drv),
|
||||
_VBType(CVertexBuffer::AGPPreferred)
|
||||
{
|
||||
H_AUTO_OGL(CVertexArrayRangeARB_CVertexArrayRangeARB)
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
IVertexBufferHardGL *CVertexArrayRange::createVBHardGL(uint size, CVertexBuffer *vb)
|
||||
{
|
||||
H_AUTO_OGL(CVertexArrayRange_createVBHardGL)
|
||||
|
||||
// create a ARB VBHard
|
||||
GLuint vertexBufferID;
|
||||
glGetError();
|
||||
|
||||
nglGenBuffers(1, &vertexBufferID);
|
||||
|
||||
if (glGetError() != GL_NO_ERROR) return NULL;
|
||||
_Driver->_DriverGLStates.forceBindARBVertexBuffer(vertexBufferID);
|
||||
switch(_VBType)
|
||||
{
|
||||
case CVertexBuffer::AGPPreferred:
|
||||
nglBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
|
||||
break;
|
||||
case CVertexBuffer::StaticPreferred:
|
||||
if (_Driver->getStaticMemoryToVRAM())
|
||||
nglBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STATIC_DRAW);
|
||||
else
|
||||
nglBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
|
||||
break;
|
||||
default:
|
||||
nlassert(0);
|
||||
break;
|
||||
}
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
nglDeleteBuffers(1, &vertexBufferID);
|
||||
return NULL;
|
||||
}
|
||||
CVertexBufferHard *newVbHard= new CVertexBufferHard(_Driver, vb);
|
||||
newVbHard->initGL(vertexBufferID, this, _VBType);
|
||||
_Driver->_DriverGLStates.forceBindARBVertexBuffer(0);
|
||||
return newVbHard;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CVertexArrayRange::enable()
|
||||
{
|
||||
H_AUTO_OGL(CVertexArrayRangeARB_enable)
|
||||
if(_Driver->_CurrentVertexArrayRange != this)
|
||||
{
|
||||
_Driver->_CurrentVertexArrayRange= this;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CVertexArrayRange::disable()
|
||||
{
|
||||
H_AUTO_OGL(CVertexArrayRangeARB_disbale)
|
||||
if(_Driver->_CurrentVertexBufferHard != NULL)
|
||||
{
|
||||
_Driver->_CurrentVertexBufferHard= NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CVertexArrayRange::updateLostBuffers()
|
||||
{
|
||||
H_AUTO_OGL(CVertexArrayRangeARB_updateLostBuffers)
|
||||
// Put all vb that have been lost in the NotResident state so that they will be recomputed
|
||||
// We do this only if the app is active, because if vb were lost, it is likely that there are no resources available.
|
||||
nlassert(_Driver);
|
||||
if (_Driver->isWndActive())
|
||||
{
|
||||
for(std::list<CVertexBufferHard *>::iterator it = _LostVBList.begin(); it != _LostVBList.end(); ++it)
|
||||
{
|
||||
nlassert((*it)->_VertexObjectId);
|
||||
GLuint id = (GLuint) (*it)->_VertexObjectId;
|
||||
nlassert(nglIsBuffer(id));
|
||||
nglDeleteBuffers(1, &id);
|
||||
(*it)->_VertexObjectId = 0;
|
||||
(*it)->VB->setLocation(CVertexBuffer::NotResident);
|
||||
}
|
||||
_LostVBList.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
// CVertexBufferHardARB
|
||||
// ***************************************************************************
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
CVertexBufferHard::CVertexBufferHard(CDriverGL3 *drv, CVertexBuffer *vb) : IVertexBufferHardGL(drv, vb),
|
||||
_VertexPtr(NULL),
|
||||
_VertexObjectId(0)
|
||||
|
||||
{
|
||||
H_AUTO_OGL(CVertexBufferHardARB_CVertexBufferHardARB)
|
||||
|
||||
_VertexArrayRange = NULL;
|
||||
#ifdef NL_DEBUG
|
||||
_Unmapping = false;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
CVertexBufferHard::~CVertexBufferHard()
|
||||
{
|
||||
H_AUTO_OGL(CVertexBufferHardARB_CVertexBufferHardARBDtor)
|
||||
if (_Driver && _VertexObjectId)
|
||||
{
|
||||
if (_Driver->_DriverGLStates.getCurrBoundARBVertexBuffer() == _VertexObjectId)
|
||||
{
|
||||
_Driver->_DriverGLStates.forceBindARBVertexBuffer(0);
|
||||
}
|
||||
}
|
||||
if (_VertexObjectId)
|
||||
{
|
||||
GLuint id = (GLuint) _VertexObjectId;
|
||||
nlassert(nglIsBuffer(id));
|
||||
nglDeleteBuffers(1, &id);
|
||||
}
|
||||
if (_VertexArrayRange)
|
||||
{
|
||||
if (_Invalid)
|
||||
{
|
||||
if (VB->getLocation() != CVertexBuffer::NotResident)
|
||||
{
|
||||
// when the vb is put in tthe NotResident state, it is removed from that list
|
||||
_VertexArrayRange->_LostVBList.erase(_IteratorInLostVBList);
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef NL_DEBUG
|
||||
if (_VertexPtr)
|
||||
{
|
||||
_VertexArrayRange->_MappedVBList.erase(_IteratorInMappedVBList);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void *CVertexBufferHard::lock()
|
||||
{
|
||||
H_AUTO_OGL(CVertexBufferHardARB_lock);
|
||||
|
||||
if (_VertexPtr) return _VertexPtr; // already locked
|
||||
if (_Invalid)
|
||||
{
|
||||
if (VB->getLocation() != CVertexBuffer::NotResident)
|
||||
{
|
||||
nlassert(!_DummyVB.empty());
|
||||
return &_DummyVB[0];
|
||||
}
|
||||
// recreate a vb
|
||||
GLuint vertexBufferID;
|
||||
|
||||
nglGenBuffers(1, &vertexBufferID);
|
||||
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
_Driver->incrementResetCounter();
|
||||
return &_DummyVB[0];
|
||||
}
|
||||
const uint size = VB->getNumVertices() * VB->getVertexSize();
|
||||
_Driver->_DriverGLStates.forceBindARBVertexBuffer(vertexBufferID);
|
||||
switch(_MemType)
|
||||
{
|
||||
case CVertexBuffer::AGPPreferred:
|
||||
nglBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
|
||||
break;
|
||||
case CVertexBuffer::StaticPreferred:
|
||||
if (_Driver->getStaticMemoryToVRAM())
|
||||
nglBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STATIC_DRAW);
|
||||
else
|
||||
nglBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
|
||||
break;
|
||||
default:
|
||||
nlassert(0);
|
||||
break;
|
||||
}
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
_Driver->incrementResetCounter();
|
||||
nglDeleteBuffers(1, &vertexBufferID);
|
||||
return &_DummyVB[0];;
|
||||
}
|
||||
_VertexObjectId = vertexBufferID;
|
||||
NLMISC::contReset(_DummyVB); // free vector memory for real
|
||||
nlassert(_VertexObjectId);
|
||||
_Invalid = false;
|
||||
_VertexArrayRange->_LostVBList.erase(_IteratorInLostVBList);
|
||||
// continue to standard mapping code below ..
|
||||
}
|
||||
TTicks beforeLock = 0;
|
||||
if(_Driver->_VBHardProfiling)
|
||||
{
|
||||
beforeLock= CTime::getPerformanceTime();
|
||||
}
|
||||
_Driver->_DriverGLStates.bindARBVertexBuffer(_VertexObjectId);
|
||||
|
||||
|
||||
_VertexPtr = nglMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
if (!_VertexPtr)
|
||||
{
|
||||
nglUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
nlassert(nglIsBuffer((GLuint) _VertexObjectId));
|
||||
invalidate();
|
||||
return &_DummyVB[0];
|
||||
}
|
||||
|
||||
#ifdef NL_DEBUG
|
||||
_VertexArrayRange->_MappedVBList.push_front(this);
|
||||
_IteratorInMappedVBList = _VertexArrayRange->_MappedVBList.begin();
|
||||
#endif
|
||||
_Driver->_DriverGLStates.forceBindARBVertexBuffer(0);
|
||||
// Lock Profile?
|
||||
if(_Driver->_VBHardProfiling)
|
||||
{
|
||||
TTicks afterLock;
|
||||
afterLock= CTime::getPerformanceTime();
|
||||
_Driver->appendVBHardLockProfile(afterLock-beforeLock, VB);
|
||||
}
|
||||
return _VertexPtr;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CVertexBufferHard::unlock()
|
||||
{
|
||||
H_AUTO_OGL(CVertexBufferHardARB_unlock);
|
||||
|
||||
_VertexPtr = NULL;
|
||||
if (_Invalid) return;
|
||||
if (!_VertexObjectId) return;
|
||||
TTicks beforeLock = 0;
|
||||
if(_Driver->_VBHardProfiling)
|
||||
{
|
||||
beforeLock= CTime::getPerformanceTime();
|
||||
}
|
||||
_Driver->_DriverGLStates.bindARBVertexBuffer(_VertexObjectId);
|
||||
// double start = CTime::ticksToSecond(CTime::getPerformanceTime());
|
||||
#ifdef NL_DEBUG
|
||||
_Unmapping = true;
|
||||
#endif
|
||||
GLboolean unmapOk = GL_FALSE;
|
||||
|
||||
unmapOk = nglUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
|
||||
#ifdef NL_DEBUG
|
||||
_Unmapping = false;
|
||||
#endif
|
||||
// Lock Profile?
|
||||
if(_Driver->_VBHardProfiling)
|
||||
{
|
||||
TTicks afterLock;
|
||||
afterLock= CTime::getPerformanceTime();
|
||||
_Driver->appendVBHardLockProfile(afterLock-beforeLock, VB);
|
||||
}
|
||||
#ifdef NL_DEBUG
|
||||
_VertexArrayRange->_MappedVBList.erase(_IteratorInMappedVBList);
|
||||
#endif
|
||||
_Driver->_DriverGLStates.forceBindARBVertexBuffer(0);
|
||||
if (!unmapOk)
|
||||
{
|
||||
invalidate();
|
||||
}
|
||||
/* double end = CTime::ticksToSecond(CTime::getPerformanceTime());
|
||||
nlinfo("3D: Unlock = %f ms", (float) ((end - start) * 1000)); */
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void *CVertexBufferHard::getPointer()
|
||||
{
|
||||
H_AUTO_OGL(CVertexBufferHardARB_getPointer)
|
||||
return _VertexPtr;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CVertexBufferHard::unlock(uint /* startVert */,uint /* endVert */)
|
||||
{
|
||||
H_AUTO_OGL(CVertexBufferHardARB_unlock)
|
||||
unlock(); // can't do a lock on a range of the vb..
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CVertexBufferHard::enable()
|
||||
{
|
||||
H_AUTO_OGL(CVertexBufferHardARB_enable)
|
||||
if(_Driver->_CurrentVertexBufferHard != this)
|
||||
{
|
||||
/* nlassert(_VertexArrayRange);
|
||||
_VertexArrayRange->enable(); */
|
||||
_Driver->_CurrentVertexBufferHard= this;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CVertexBufferHard::disable()
|
||||
{
|
||||
H_AUTO_OGL(CVertexBufferHardARB_disable)
|
||||
if(_Driver->_CurrentVertexBufferHard != NULL)
|
||||
{
|
||||
/* nlassert(_VertexArrayRange);
|
||||
_VertexArrayRange->disable(); */
|
||||
_Driver->_CurrentVertexBufferHard= NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CVertexBufferHard::initGL(uint vertexObjectID, CVertexArrayRange *var, CVertexBuffer::TPreferredMemory memType)
|
||||
{
|
||||
H_AUTO_OGL(CVertexBufferHardARB_initGL)
|
||||
_VertexObjectId = vertexObjectID;
|
||||
_MemType = memType;
|
||||
_VertexArrayRange = var;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CVertexBufferHard::lockHintStatic(bool /* staticLock */)
|
||||
{
|
||||
H_AUTO_OGL(CVertexBufferHardARB_lockHintStatic)
|
||||
// no op.
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CVertexBufferHard::setupVBInfos(CVertexBufferInfo &vb)
|
||||
{
|
||||
H_AUTO_OGL(CVertexBufferHardARB_setupVBInfos)
|
||||
vb.VertexObjectId = _VertexObjectId;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CVertexBufferHard::invalidate()
|
||||
{
|
||||
H_AUTO_OGL(CVertexBufferHardARB_invalidate)
|
||||
nlassert(!_Invalid);
|
||||
// Buffer is lost (maybe there was a alt-tab or fullscrren / windowed change)
|
||||
// Buffer is deleted at end of frame only
|
||||
_Invalid = true;
|
||||
_Driver->incrementResetCounter();
|
||||
_DummyVB.resize(VB->getNumVertices() * VB->getVertexSize(), 0);
|
||||
// insert in lost vb list
|
||||
_VertexArrayRange->_LostVBList.push_front(this);
|
||||
_IteratorInLostVBList = _VertexArrayRange->_LostVBList.begin();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
#ifdef NL_DEBUG
|
||||
void CVertexArrayRange::dumpMappedBuffers()
|
||||
{
|
||||
nlwarning("*****************************************************");
|
||||
nlwarning("Mapped buffers :");
|
||||
for(std::list<CVertexBufferHard *>::iterator it = _MappedVBList.begin(); it != _MappedVBList.end(); ++it)
|
||||
{
|
||||
CVertexBufferHard &vbarb = **it;
|
||||
nlwarning("Buffer id = %u, size = %u, address = %p", vbarb._VertexObjectId, vbarb.VB->getVertexSize() * vbarb.VB->getNumVertices(), vbarb.getPointer());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NL_STATIC
|
||||
} // NLDRIVERGL/ES
|
||||
#endif
|
||||
|
||||
} // NL3D
|
||||
|
@ -0,0 +1,191 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef NL_DRIVER_OPENGL_VERTEX_BUFFER_HARD_H
|
||||
#define NL_DRIVER_OPENGL_VERTEX_BUFFER_HARD_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
|
||||
|
||||
namespace NL3D {
|
||||
|
||||
#ifdef NL_STATIC
|
||||
namespace NLDRIVERGL3 {
|
||||
#endif
|
||||
|
||||
class CDriverGL;
|
||||
class IVertexBufferHardGL;
|
||||
class CVertexBufferInfo;
|
||||
class CVertexBufferHard;
|
||||
|
||||
// ***************************************************************************
|
||||
/** Interface to a Big block of video memory
|
||||
*/
|
||||
class IVertexArrayRange
|
||||
{
|
||||
public:
|
||||
IVertexArrayRange(CDriverGL3 *drv);
|
||||
virtual ~IVertexArrayRange();
|
||||
|
||||
/// create a IVertexBufferHardGL
|
||||
virtual IVertexBufferHardGL *createVBHardGL(uint size, CVertexBuffer *vb) =0;
|
||||
// Check & invalidate lost buffers. Default assume they can't be lost
|
||||
virtual void updateLostBuffers() {}
|
||||
// Get driver
|
||||
CDriverGL3* getDriver() const { return _Driver; }
|
||||
// tmp, for debug
|
||||
#ifdef NL_DEBUG
|
||||
virtual void dumpMappedBuffers() {}
|
||||
#endif
|
||||
protected:
|
||||
CDriverGL3 *_Driver;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class IVertexBufferHardGL
|
||||
{
|
||||
public:
|
||||
|
||||
IVertexBufferHardGL(CDriverGL3 *drv, CVertexBuffer *vb);
|
||||
virtual ~IVertexBufferHardGL();
|
||||
virtual void *lock() = 0;
|
||||
virtual void unlock() = 0;
|
||||
virtual void unlock(uint start, uint end) = 0;
|
||||
virtual void *getPointer() = 0;
|
||||
virtual void enable() =0;
|
||||
virtual void disable() =0;
|
||||
virtual void setupVBInfos(CVertexBufferInfo &vb) = 0;
|
||||
|
||||
// test if buffer content is invalid. If so, no rendering should occurs (rendering should silently fail)
|
||||
bool isInvalid() { return _Invalid; }
|
||||
|
||||
public:
|
||||
|
||||
CVertexBuffer *VB;
|
||||
|
||||
protected:
|
||||
CDriverGL3 *_Driver;
|
||||
bool _Invalid;
|
||||
};
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// ARB_vertex_buffer_object implementation
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
class CVertexArrayRange : public IVertexArrayRange
|
||||
{
|
||||
public:
|
||||
CVertexArrayRange(CDriverGL3 *drv);
|
||||
|
||||
virtual IVertexBufferHardGL *createVBHardGL(uint size, CVertexBuffer *vb);
|
||||
|
||||
// Those methods read/write in _Driver->_CurrentVertexArrayRange.
|
||||
/** active this VertexArrayRange as the current vertex array range used. no-op if already setup.
|
||||
* NB: no-op for ARB, but ensure correct _Driver->_CurrentVertexArrayRange value.
|
||||
*/
|
||||
void enable();
|
||||
/** disable this VertexArrayRange. _Driver->_CurrentVertexArrayRange= NULL;
|
||||
* NB: no-op for ARB, but ensure correct _Driver->_CurrentVertexArrayRange value.
|
||||
*/
|
||||
void disable();
|
||||
// check & invalidate lost buffers
|
||||
void updateLostBuffers();
|
||||
//
|
||||
#ifdef NL_DEBUG
|
||||
virtual void dumpMappedBuffers();
|
||||
#endif
|
||||
// *************************
|
||||
private:
|
||||
CVertexBuffer::TPreferredMemory _VBType;
|
||||
// for use by CVertexBufferHardARB
|
||||
public:
|
||||
std::list<CVertexBufferHard*> _LostVBList;
|
||||
#ifdef NL_DEBUG
|
||||
std::list<CVertexBufferHard*> _MappedVBList;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/** vb hard using the ARB_vertex_buffer_object extension. Buffer are kept separate rather than managed in a heap
|
||||
*/
|
||||
class CVertexBufferHard : public IVertexBufferHardGL
|
||||
{
|
||||
public:
|
||||
|
||||
CVertexBufferHard(CDriverGL3 *drv, CVertexBuffer *vb);
|
||||
virtual ~CVertexBufferHard();
|
||||
|
||||
|
||||
/// \name Implementation
|
||||
// @{
|
||||
virtual void *lock();
|
||||
virtual void unlock();
|
||||
virtual void unlock(uint startVert, uint endVert);
|
||||
virtual void *getPointer();
|
||||
virtual void enable();
|
||||
virtual void disable();
|
||||
virtual void lockHintStatic(bool staticLock);
|
||||
virtual void setupVBInfos(CVertexBufferInfo &vb);
|
||||
// @}
|
||||
|
||||
/** setup ptrs allocated by createVBHard()
|
||||
*/
|
||||
void initGL(uint vertexObjectID, CVertexArrayRange *var, CVertexBuffer::TPreferredMemory memType);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/// get Handle of the ARB buffer.
|
||||
uint getARBVertexObjectId() const { return _VertexObjectId;}
|
||||
|
||||
// Invalidate the buffer (when it is lost, or when a lock fails)
|
||||
void invalidate();
|
||||
|
||||
// tmp
|
||||
void checkMappedVBList();
|
||||
|
||||
// *************************
|
||||
private:
|
||||
CVertexArrayRange *_VertexArrayRange;
|
||||
CVertexBuffer::TPreferredMemory _MemType;
|
||||
void *_VertexPtr; // pointer on current datas. Null if not locked
|
||||
|
||||
// if buffer has been invalidated, returns a dummy memory block and silently fails rendering
|
||||
std::vector<uint8> _DummyVB;
|
||||
// for use by CVertexArrayRange
|
||||
std::list<CVertexBufferHard*>::iterator _IteratorInLostVBList;
|
||||
public:
|
||||
uint _VertexObjectId;
|
||||
// tmp for debug
|
||||
#ifdef NL_DEBUG
|
||||
bool _Unmapping;
|
||||
std::list<CVertexBufferHard*>::iterator _IteratorInMappedVBList;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef NL_STATIC
|
||||
} // NLDRIVERGL/ES
|
||||
#endif
|
||||
|
||||
} // NL3D
|
||||
|
||||
|
||||
#endif // NL_DRIVER_OPENGL_VERTEX_BUFFER_HARD_H
|
||||
|
||||
/* End of driver_opengl_vertex_buffer_hard.h */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,40 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#ifdef NL_STATIC
|
||||
#ifdef USE_OPENGLES
|
||||
using NL3D::NLDRIVERGLES::CDriverGL;
|
||||
#else
|
||||
using NL3D::NLDRIVERGL::CDriverGL;
|
||||
#endif
|
||||
#else
|
||||
using NL3D::CDriverGL;
|
||||
#endif
|
||||
|
||||
@interface CocoaApplicationDelegate : NSObject
|
||||
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||
<NSApplicationDelegate>
|
||||
#endif
|
||||
{
|
||||
CDriverGL* _driver;
|
||||
}
|
||||
|
||||
-(id)initWithDriver:(CDriverGL*)driver;
|
||||
-(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
|
||||
|
||||
@end
|
@ -0,0 +1,60 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "../stdopengl.h"
|
||||
#include "../driver_opengl.h"
|
||||
|
||||
#include "cocoa_application_delegate.h"
|
||||
#include "cocoa_event_emitter.h"
|
||||
|
||||
static NSApplicationTerminateReply applicationShouldTerminate(CDriverGL* driver)
|
||||
{
|
||||
// cancel if there is a driver and a custom exit handler set up
|
||||
if(driver && driver->ExitFunc)
|
||||
{
|
||||
driver->ExitFunc();
|
||||
return NSTerminateCancel;
|
||||
}
|
||||
|
||||
NLMISC::CCocoaEventEmitter* eventEmitter =
|
||||
NLMISC::safe_cast<NLMISC::CCocoaEventEmitter*>(&(driver->_EventEmitter));
|
||||
|
||||
// cancel if there is a driver and cocoa event emitter handles the quit
|
||||
if(driver && eventEmitter && eventEmitter->handleQuitRequest())
|
||||
return NSTerminateCancel;
|
||||
|
||||
// just let the app terminate if no custom quit handling worked
|
||||
return NSTerminateNow;
|
||||
}
|
||||
|
||||
@implementation CocoaApplicationDelegate
|
||||
|
||||
-(id)initWithDriver:(CDriverGL*)driver
|
||||
{
|
||||
if((self = [super init]))
|
||||
{
|
||||
_driver = driver;
|
||||
return self;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender
|
||||
{
|
||||
return applicationShouldTerminate(_driver);
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,508 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "cocoa_event_emitter.h"
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
||||
/// map from virtual key code to nel internal key code
|
||||
static NLMISC::TKey virtualKeycodeToNelKey(unsigned short keycode)
|
||||
{
|
||||
switch(keycode)
|
||||
{
|
||||
case kVK_ANSI_0: return NLMISC::Key0;
|
||||
case kVK_ANSI_1: return NLMISC::Key1;
|
||||
case kVK_ANSI_2: return NLMISC::Key2;
|
||||
case kVK_ANSI_3: return NLMISC::Key3;
|
||||
case kVK_ANSI_4: return NLMISC::Key4;
|
||||
case kVK_ANSI_5: return NLMISC::Key5;
|
||||
case kVK_ANSI_6: return NLMISC::Key6;
|
||||
case kVK_ANSI_7: return NLMISC::Key7;
|
||||
case kVK_ANSI_8: return NLMISC::Key8;
|
||||
case kVK_ANSI_9: return NLMISC::Key9;
|
||||
case kVK_ANSI_A: return NLMISC::KeyA;
|
||||
case kVK_ANSI_B: return NLMISC::KeyB;
|
||||
case kVK_ANSI_C: return NLMISC::KeyC;
|
||||
case kVK_ANSI_D: return NLMISC::KeyD;
|
||||
case kVK_ANSI_E: return NLMISC::KeyE;
|
||||
case kVK_ANSI_F: return NLMISC::KeyF;
|
||||
case kVK_ANSI_G: return NLMISC::KeyG;
|
||||
case kVK_ANSI_H: return NLMISC::KeyH;
|
||||
case kVK_ANSI_I: return NLMISC::KeyI;
|
||||
case kVK_ANSI_J: return NLMISC::KeyJ;
|
||||
case kVK_ANSI_K: return NLMISC::KeyK;
|
||||
case kVK_ANSI_L: return NLMISC::KeyL;
|
||||
case kVK_ANSI_M: return NLMISC::KeyM;
|
||||
case kVK_ANSI_N: return NLMISC::KeyN;
|
||||
case kVK_ANSI_O: return NLMISC::KeyO;
|
||||
case kVK_ANSI_P: return NLMISC::KeyP;
|
||||
case kVK_ANSI_Q: return NLMISC::KeyQ;
|
||||
case kVK_ANSI_R: return NLMISC::KeyR;
|
||||
case kVK_ANSI_S: return NLMISC::KeyS;
|
||||
case kVK_ANSI_T: return NLMISC::KeyT;
|
||||
case kVK_ANSI_U: return NLMISC::KeyU;
|
||||
case kVK_ANSI_V: return NLMISC::KeyV;
|
||||
case kVK_ANSI_W: return NLMISC::KeyW;
|
||||
case kVK_ANSI_X: return NLMISC::KeyX;
|
||||
case kVK_ANSI_Y: return NLMISC::KeyY;
|
||||
case kVK_ANSI_Z: return NLMISC::KeyZ;
|
||||
case kVK_ANSI_Equal: return NLMISC::KeyEQUALS;
|
||||
case kVK_ANSI_Minus: return NLMISC::KeySUBTRACT;
|
||||
case kVK_ANSI_RightBracket: return NLMISC::KeyRBRACKET;
|
||||
case kVK_ANSI_LeftBracket: return NLMISC::KeyLBRACKET;
|
||||
case kVK_ANSI_Quote: return NLMISC::KeyAPOSTROPHE;
|
||||
case kVK_ANSI_Grave: return NLMISC::KeyPARAGRAPH;
|
||||
case kVK_ANSI_Slash: return NLMISC::KeySLASH;
|
||||
case kVK_ANSI_Backslash: return NLMISC::KeyBACKSLASH;
|
||||
case kVK_ANSI_Comma: return NLMISC::KeyCOMMA;
|
||||
case kVK_ANSI_Period: return NLMISC::KeyPERIOD;
|
||||
case kVK_ANSI_Semicolon: return NLMISC::KeySEMICOLON;
|
||||
case kVK_ANSI_KeypadDecimal: return NLMISC::KeyDECIMAL;
|
||||
case kVK_ANSI_KeypadMultiply: return NLMISC::KeyMULTIPLY;
|
||||
case kVK_ANSI_KeypadPlus: return NLMISC::KeyADD;
|
||||
case kVK_ANSI_KeypadClear: return NLMISC::KeyDELETE;
|
||||
case kVK_ANSI_KeypadDivide: return NLMISC::KeyDIVIDE;
|
||||
case kVK_ANSI_KeypadEnter: return NLMISC::KeyRETURN;
|
||||
case kVK_ANSI_KeypadMinus: return NLMISC::KeySUBTRACT;
|
||||
case kVK_ANSI_KeypadEquals: return NLMISC::KeySEPARATOR;
|
||||
case kVK_ANSI_Keypad0: return NLMISC::KeyNUMPAD0;
|
||||
case kVK_ANSI_Keypad1: return NLMISC::KeyNUMPAD1;
|
||||
case kVK_ANSI_Keypad2: return NLMISC::KeyNUMPAD2;
|
||||
case kVK_ANSI_Keypad3: return NLMISC::KeyNUMPAD3;
|
||||
case kVK_ANSI_Keypad4: return NLMISC::KeyNUMPAD4;
|
||||
case kVK_ANSI_Keypad5: return NLMISC::KeyNUMPAD5;
|
||||
case kVK_ANSI_Keypad6: return NLMISC::KeyNUMPAD6;
|
||||
case kVK_ANSI_Keypad7: return NLMISC::KeyNUMPAD7;
|
||||
case kVK_ANSI_Keypad8: return NLMISC::KeyNUMPAD8;
|
||||
case kVK_ANSI_Keypad9: return NLMISC::KeyNUMPAD9;
|
||||
case kVK_Return: return NLMISC::KeyRETURN;
|
||||
case kVK_Tab: return NLMISC::KeyTAB;
|
||||
case kVK_Space: return NLMISC::KeySPACE;
|
||||
case kVK_Delete: return NLMISC::KeyBACK;
|
||||
case kVK_ForwardDelete: return NLMISC::KeyDELETE;
|
||||
case kVK_Escape: return NLMISC::KeyESCAPE;
|
||||
case kVK_Shift: return NLMISC::KeySHIFT;
|
||||
case kVK_RightShift: return NLMISC::KeyRSHIFT;
|
||||
case kVK_CapsLock: return NLMISC::KeyCAPITAL;
|
||||
case kVK_Control: return NLMISC::KeyCONTROL;
|
||||
case kVK_RightControl: return NLMISC::KeyRCONTROL;
|
||||
case kVK_F1: return NLMISC::KeyF1;
|
||||
case kVK_F2: return NLMISC::KeyF2;
|
||||
case kVK_F3: return NLMISC::KeyF3;
|
||||
case kVK_F4: return NLMISC::KeyF4;
|
||||
case kVK_F5: return NLMISC::KeyF5;
|
||||
case kVK_F6: return NLMISC::KeyF6;
|
||||
case kVK_F7: return NLMISC::KeyF7;
|
||||
case kVK_F8: return NLMISC::KeyF8;
|
||||
case kVK_F9: return NLMISC::KeyF9;
|
||||
case kVK_F11: return NLMISC::KeyF11;
|
||||
case kVK_F13: return NLMISC::KeyF13;
|
||||
case kVK_F16: return NLMISC::KeyF16;
|
||||
case kVK_F14: return NLMISC::KeyF14;
|
||||
case kVK_F10: return NLMISC::KeyF10;
|
||||
case kVK_F12: return NLMISC::KeyF12;
|
||||
case kVK_F15: return NLMISC::KeyF15;
|
||||
case kVK_F17: return NLMISC::KeyF17;
|
||||
case kVK_F18: return NLMISC::KeyF18;
|
||||
case kVK_F19: return NLMISC::KeyF19;
|
||||
case kVK_F20: return NLMISC::KeyF20;
|
||||
case kVK_Home: return NLMISC::KeyHOME;
|
||||
case kVK_End: return NLMISC::KeyEND;
|
||||
case kVK_PageUp: return NLMISC::KeyPRIOR;
|
||||
case kVK_PageDown: return NLMISC::KeyNEXT;
|
||||
case kVK_LeftArrow: return NLMISC::KeyLEFT;
|
||||
case kVK_RightArrow: return NLMISC::KeyRIGHT;
|
||||
case kVK_DownArrow: return NLMISC::KeyDOWN;
|
||||
case kVK_UpArrow: return NLMISC::KeyUP;
|
||||
case kVK_Command:break;
|
||||
case kVK_Option:break;
|
||||
case kVK_RightOption:break;
|
||||
case kVK_Function:break;
|
||||
case kVK_VolumeUp:break;
|
||||
case kVK_VolumeDown:break;
|
||||
case kVK_Mute:break;
|
||||
case kVK_Help:break;
|
||||
case kVK_ISO_Section:break;
|
||||
case kVK_JIS_Yen:break;
|
||||
case kVK_JIS_Underscore:break;
|
||||
case kVK_JIS_KeypadComma:break;
|
||||
case kVK_JIS_Eisu:break;
|
||||
case kVK_JIS_Kana:break;
|
||||
default:break;
|
||||
}
|
||||
return NLMISC::KeyNOKEY;
|
||||
}
|
||||
|
||||
bool CCocoaEventEmitter::pasteTextFromClipboard(ucstring &text)
|
||||
{
|
||||
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
||||
NSArray *classArray = [NSArray arrayWithObject:[NSString class]];
|
||||
NSDictionary *options = [NSDictionary dictionary];
|
||||
|
||||
BOOL ok = [pasteboard canReadObjectForClasses:classArray options:options];
|
||||
if (ok)
|
||||
{
|
||||
NSArray *objectsToPaste = [pasteboard readObjectsForClasses:classArray options:options];
|
||||
NSString *nstext = [objectsToPaste objectAtIndex:0];
|
||||
text.fromUtf8([nstext UTF8String]);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CCocoaEventEmitter::copyTextToClipboard(const ucstring &text)
|
||||
{
|
||||
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
||||
[pasteboard clearContents];
|
||||
NSArray *copiedObjects = [NSArray arrayWithObject:[NSString stringWithUTF8String:text.toUtf8().c_str()]];
|
||||
[pasteboard writeObjects:copiedObjects];
|
||||
return true;
|
||||
}
|
||||
|
||||
/// convert modifier key state to nel internal modifier key state
|
||||
static NLMISC::TKeyButton modifierFlagsToNelKeyButton(unsigned int modifierFlags)
|
||||
{
|
||||
unsigned int buttons = 0;
|
||||
if (modifierFlags & NSControlKeyMask) buttons |= NLMISC::ctrlKeyButton;
|
||||
if (modifierFlags & NSShiftKeyMask) buttons |= NLMISC::shiftKeyButton;
|
||||
if (modifierFlags & NSAlternateKeyMask) buttons |= NLMISC::altKeyButton;
|
||||
return (NLMISC::TKeyButton)buttons;
|
||||
}
|
||||
|
||||
/// check whether a given event represents input text
|
||||
static bool isTextKeyEvent(NSEvent* event)
|
||||
{
|
||||
// if there are no characters provided with this event, it is not a text event
|
||||
if([[event characters] length] == 0)
|
||||
return false;
|
||||
|
||||
NLMISC::TKey nelKey = virtualKeycodeToNelKey([event keyCode]);
|
||||
|
||||
// ryzom ui wants to have "escape key string" to leave text box
|
||||
if(nelKey == NLMISC::KeyESCAPE)
|
||||
return true;
|
||||
|
||||
// ryzom ui wants to have "return key string" to submit text box (send chat)
|
||||
if(nelKey == NLMISC::KeyRETURN)
|
||||
return true;
|
||||
|
||||
// get the character reported by cocoa
|
||||
unsigned int character = [[event characters] characterAtIndex:0];
|
||||
|
||||
// printable ascii characters
|
||||
if(isprint(character))
|
||||
return true;
|
||||
|
||||
/*
|
||||
TODO check why iswprint(character) does not solve it.
|
||||
it always returns false, even for non-ASCII characters
|
||||
*/
|
||||
// characters > 127 but not printable
|
||||
if( nelKey == NLMISC::KeyF1 || nelKey == NLMISC::KeyF2 ||
|
||||
nelKey == NLMISC::KeyF3 || nelKey == NLMISC::KeyF4 ||
|
||||
nelKey == NLMISC::KeyF5 || nelKey == NLMISC::KeyF6 ||
|
||||
nelKey == NLMISC::KeyF7 || nelKey == NLMISC::KeyF8 ||
|
||||
nelKey == NLMISC::KeyF9 || nelKey == NLMISC::KeyF10 ||
|
||||
nelKey == NLMISC::KeyF11 || nelKey == NLMISC::KeyF12 ||
|
||||
nelKey == NLMISC::KeyF13 || nelKey == NLMISC::KeyF14 ||
|
||||
nelKey == NLMISC::KeyF15 || nelKey == NLMISC::KeyF16 ||
|
||||
nelKey == NLMISC::KeyF17 || nelKey == NLMISC::KeyF18 ||
|
||||
nelKey == NLMISC::KeyF19 || nelKey == NLMISC::KeyF20 ||
|
||||
nelKey == NLMISC::KeyUP || nelKey == NLMISC::KeyDOWN ||
|
||||
nelKey == NLMISC::KeyLEFT || nelKey == NLMISC::KeyRIGHT ||
|
||||
nelKey == NLMISC::KeyHOME || nelKey == NLMISC::KeyEND ||
|
||||
nelKey == NLMISC::KeyPRIOR || nelKey == NLMISC::KeyNEXT ||
|
||||
nelKey == NLMISC::KeyDELETE)
|
||||
return false;
|
||||
|
||||
// all the fancy wide characters
|
||||
if(character > 127)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CCocoaEventEmitter::init(
|
||||
NL3D::IDriver* driver, CocoaOpenGLView* glView, bool eventLoop)
|
||||
{
|
||||
_driver = driver;
|
||||
_glView = glView;
|
||||
_eventLoop = eventLoop;
|
||||
}
|
||||
|
||||
bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
||||
{
|
||||
if(!server && !_server)
|
||||
{
|
||||
// nlerror("no server to post events to");
|
||||
nldebug("no server to post events to");
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!server)
|
||||
server = _server;
|
||||
|
||||
NSRect viewRect = [_glView frame];
|
||||
NSPoint mousePos = [_glView convertPoint:event.locationInWindow fromView:nil];
|
||||
|
||||
mousePos.x /= (float)viewRect.size.width;
|
||||
mousePos.y /= (float)viewRect.size.height;
|
||||
|
||||
// if the mouse event was placed outside the view, don't tell NeL :)
|
||||
if((mousePos.x < 0.0 || mousePos.x > 1.0 ||
|
||||
mousePos.y < 0.0 || mousePos.y > 1.0) &&
|
||||
event.type != NSKeyDown && event.type != NSKeyUp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// first event about mouse movement after setting to emulateRawMode
|
||||
if(_setToEmulateRawMode &&
|
||||
(event.type == NSMouseMoved ||
|
||||
event.type == NSLeftMouseDragged ||
|
||||
event.type == NSRightMouseDragged))
|
||||
{
|
||||
// do not report because it reflects wrapping pointer to 0.5/0.5
|
||||
_setToEmulateRawMode = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// convert the modifiers for nel to pass them with the events
|
||||
NLMISC::TKeyButton modifiers =
|
||||
modifierFlagsToNelKeyButton([event modifierFlags]);
|
||||
|
||||
switch(event.type)
|
||||
{
|
||||
case NSLeftMouseDown:
|
||||
{
|
||||
server->postEvent(new NLMISC::CEventMouseDown(
|
||||
mousePos.x, mousePos.y,
|
||||
(NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this));
|
||||
}
|
||||
break;
|
||||
case NSLeftMouseUp:
|
||||
{
|
||||
server->postEvent(new NLMISC::CEventMouseUp(
|
||||
mousePos.x, mousePos.y,
|
||||
(NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this));
|
||||
break;
|
||||
}
|
||||
case NSRightMouseDown:
|
||||
{
|
||||
server->postEvent(new NLMISC::CEventMouseDown(
|
||||
mousePos.x, mousePos.y,
|
||||
(NLMISC::TMouseButton)(NLMISC::rightButton | modifiers), this));
|
||||
break;
|
||||
}
|
||||
case NSRightMouseUp:
|
||||
{
|
||||
server->postEvent(new NLMISC::CEventMouseUp(
|
||||
mousePos.x, mousePos.y,
|
||||
(NLMISC::TMouseButton)(NLMISC::rightButton | modifiers), this));
|
||||
break;
|
||||
}
|
||||
case NSMouseMoved:
|
||||
{
|
||||
NLMISC::CEvent* nelEvent;
|
||||
|
||||
// when emulating raw mode, send the delta in a CGDMouseMove event
|
||||
if(_emulateRawMode)
|
||||
nelEvent = new NLMISC::CGDMouseMove(
|
||||
this, NULL /* no mouse device */, event.deltaX, -event.deltaY);
|
||||
|
||||
// normally send position in a CEventMouseMove
|
||||
else
|
||||
nelEvent = new NLMISC::CEventMouseMove(
|
||||
mousePos.x, mousePos.y, (NLMISC::TMouseButton)modifiers, this);
|
||||
|
||||
server->postEvent(nelEvent);
|
||||
break;
|
||||
}
|
||||
case NSLeftMouseDragged:
|
||||
{
|
||||
NLMISC::CEvent* nelEvent;
|
||||
|
||||
// when emulating raw mode, send the delta in a CGDMouseMove event
|
||||
if(_emulateRawMode)
|
||||
nelEvent = new NLMISC::CGDMouseMove(
|
||||
this, NULL /* no mouse device */, event.deltaX, -event.deltaY);
|
||||
|
||||
// normally send position in a CEventMouseMove
|
||||
else
|
||||
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y,
|
||||
(NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this);
|
||||
|
||||
server->postEvent(nelEvent);
|
||||
break;
|
||||
}
|
||||
case NSRightMouseDragged:
|
||||
{
|
||||
NLMISC::CEvent* nelEvent;
|
||||
|
||||
// when emulating raw mode, send the delta in a CGDMouseMove event
|
||||
if(_emulateRawMode)
|
||||
nelEvent = new NLMISC::CGDMouseMove(
|
||||
this, NULL /* no mouse device */, event.deltaX, -event.deltaY);
|
||||
|
||||
// normally send position in a CEventMouseMove
|
||||
else
|
||||
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y,
|
||||
(NLMISC::TMouseButton)(NLMISC::rightButton | modifiers), this);
|
||||
|
||||
server->postEvent(nelEvent);
|
||||
break;
|
||||
}
|
||||
case NSMouseEntered:break;
|
||||
case NSMouseExited:break;
|
||||
case NSKeyDown:
|
||||
{
|
||||
// push the key press event to the event server
|
||||
server->postEvent(new NLMISC::CEventKeyDown(
|
||||
virtualKeycodeToNelKey([event keyCode]),
|
||||
modifiers,
|
||||
[event isARepeat] == NO, this));
|
||||
|
||||
// if this was a text event
|
||||
if(isTextKeyEvent(event))
|
||||
{
|
||||
ucstring ucstr;
|
||||
|
||||
// get the string associated with the key press event
|
||||
ucstr.fromUtf8([[event characters] UTF8String]);
|
||||
|
||||
// push the text event to event server as well
|
||||
server->postEvent(new NLMISC::CEventChar(
|
||||
ucstr[0], modifiers, this));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NSKeyUp:
|
||||
{
|
||||
// push the key release event to the event server
|
||||
server->postEvent(new NLMISC::CEventKeyUp(
|
||||
virtualKeycodeToNelKey([event keyCode]),
|
||||
modifiers, this));
|
||||
break;
|
||||
}
|
||||
case NSFlagsChanged:break;
|
||||
case NSAppKitDefined:break;
|
||||
case NSSystemDefined:break;
|
||||
case NSApplicationDefined:break;
|
||||
case NSPeriodic:break;
|
||||
case NSCursorUpdate:break;
|
||||
case NSScrollWheel:
|
||||
{
|
||||
if(fabs(event.deltaY) > 0.1)
|
||||
server->postEvent(new NLMISC::CEventMouseWheel(
|
||||
mousePos.x, mousePos.y, (NLMISC::TMouseButton)modifiers,
|
||||
(event.deltaY > 0), this));
|
||||
|
||||
break;
|
||||
}
|
||||
case NSTabletPoint:break;
|
||||
case NSTabletProximity:break;
|
||||
case NSOtherMouseDown:break;
|
||||
case NSOtherMouseUp:break;
|
||||
case NSOtherMouseDragged:break;
|
||||
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||
case NSEventTypeGesture:break;
|
||||
case NSEventTypeMagnify:break;
|
||||
case NSEventTypeSwipe:break;
|
||||
case NSEventTypeRotate:break;
|
||||
case NSEventTypeBeginGesture:break;
|
||||
case NSEventTypeEndGesture:break;
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
nlwarning("Unknown event type. dropping.");
|
||||
NSLog(@"%@", event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(_emulateRawMode && _driver && (event.type == NSMouseMoved ||
|
||||
event.type == NSLeftMouseDragged || event.type == NSRightMouseDragged))
|
||||
{
|
||||
_driver->setMousePos(0.5, 0.5);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CCocoaEventEmitter::handleQuitRequest()
|
||||
{
|
||||
if(_server)
|
||||
{
|
||||
_server->postEvent(new CEventDestroyWindow(this));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef bool (*cocoaProc)(NL3D::IDriver*, const void* e);
|
||||
|
||||
void CCocoaEventEmitter::submitEvents(CEventServer& server, bool /* allWins */)
|
||||
{
|
||||
// break if there was no event to handle
|
||||
// if running embedded in e.g. qt, _eventLoop will be false
|
||||
while(_eventLoop)
|
||||
{
|
||||
// get the next event to handle
|
||||
NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
|
||||
untilDate:nil /*[NSDate distantFuture]*/
|
||||
inMode:NSDefaultRunLoopMode dequeue:YES];
|
||||
|
||||
// stop, if there was no event
|
||||
if(!event)
|
||||
break;
|
||||
|
||||
// if there is a driver set up, forward event to it's windowProc
|
||||
if(_driver)
|
||||
{
|
||||
cocoaProc proc = (cocoaProc)_driver->getWindowProc();
|
||||
|
||||
if(proc)
|
||||
proc(_driver, [event eventRef]);
|
||||
}
|
||||
// without driver, just process the event
|
||||
else
|
||||
{
|
||||
processMessage(event, &server);
|
||||
}
|
||||
|
||||
// forward the event to the cocoa application
|
||||
[NSApp sendEvent:event];
|
||||
}
|
||||
|
||||
_server = &server;
|
||||
}
|
||||
|
||||
void CCocoaEventEmitter::emulateMouseRawMode(bool enable)
|
||||
{
|
||||
_emulateRawMode = enable;
|
||||
|
||||
if(_emulateRawMode)
|
||||
{
|
||||
_setToEmulateRawMode = true;
|
||||
|
||||
if(_driver)
|
||||
_driver->setMousePos(0.5, 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef NL_COCOA_EVENT_EMITTER_H
|
||||
#define NL_COCOA_EVENT_EMITTER_H
|
||||
|
||||
#include "nel/misc/event_emitter.h"
|
||||
#include "nel/misc/event_server.h"
|
||||
#include "nel/misc/events.h"
|
||||
#include "nel/misc/game_device_events.h"
|
||||
#include "nel/3d/driver.h"
|
||||
#import "cocoa_opengl_view.h"
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
||||
class CCocoaEventEmitter : public IEventEmitter
|
||||
{
|
||||
bool _emulateRawMode;
|
||||
bool _setToEmulateRawMode;
|
||||
bool _eventLoop;
|
||||
NL3D::IDriver* _driver;
|
||||
CocoaOpenGLView* _glView;
|
||||
|
||||
// TODO like internal server in unix event emitter... review!
|
||||
CEventServer* _server;
|
||||
|
||||
public:
|
||||
CCocoaEventEmitter() :
|
||||
_emulateRawMode(false),
|
||||
_setToEmulateRawMode(false),
|
||||
_driver(NULL),
|
||||
_glView(nil),
|
||||
_server(NULL) { }
|
||||
|
||||
void init(NL3D::IDriver*, CocoaOpenGLView*, bool eventLoop);
|
||||
bool processMessage(NSEvent* event, CEventServer* server = NULL);
|
||||
virtual void submitEvents(CEventServer& server, bool allWindows);
|
||||
virtual void emulateMouseRawMode(bool enable);
|
||||
bool handleQuitRequest();
|
||||
|
||||
virtual bool copyTextToClipboard(const ucstring &text);
|
||||
virtual bool pasteTextFromClipboard(ucstring &text);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,61 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
|
||||
#ifdef NL_STATIC
|
||||
#ifdef USE_OPENGLES
|
||||
namespace NLDRIVERGLES {
|
||||
#else
|
||||
namespace NLDRIVERGL {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class CDriverGL;
|
||||
|
||||
#ifdef NL_STATIC
|
||||
} // NLDRIVERGL/ES
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#ifdef NL_STATIC
|
||||
#ifdef USE_OPENGLES
|
||||
using NL3D::NLDRIVERGLES::CDriverGL;
|
||||
#else
|
||||
using NL3D::NLDRIVERGL::CDriverGL;
|
||||
#endif
|
||||
#else
|
||||
using NL3D::CDriverGL;
|
||||
#endif
|
||||
|
||||
@interface CocoaOpenGLView : NSOpenGLView<NSTextInputClient>
|
||||
{
|
||||
NSMutableAttributedString* _characterStorage;
|
||||
NSRange _markedRange;
|
||||
CDriverGL* _driver;
|
||||
}
|
||||
|
||||
-(id)initWithFrame:(NSRect)frame;
|
||||
-(void)dealloc;
|
||||
-(void)keyDown:(NSEvent*)event;
|
||||
-(void)setDriver:(CDriverGL*)driver;
|
||||
-(void)resizeWithOldSuperviewSize:(NSSize)oldBoundsSize;
|
||||
|
||||
@end
|
@ -0,0 +1,152 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "../stdopengl.h"
|
||||
#include "../driver_opengl.h"
|
||||
|
||||
#import "cocoa_opengl_view.h"
|
||||
|
||||
static void viewDidResize(NSView* view, CDriverGL* driver)
|
||||
{
|
||||
NSRect rect = [[view superview] frame];
|
||||
driver->_CurrentMode.Height = rect.size.height;
|
||||
driver->_CurrentMode.Width = rect.size.width;
|
||||
}
|
||||
|
||||
@implementation CocoaOpenGLView
|
||||
|
||||
-(id)initWithFrame:(NSRect)frame
|
||||
{
|
||||
if((self = [super initWithFrame:frame]))
|
||||
{
|
||||
_characterStorage = [[NSMutableAttributedString alloc] initWithString:@""];
|
||||
_driver = nil;
|
||||
return self;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(void)dealloc
|
||||
{
|
||||
[_characterStorage release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(void)keyDown:(NSEvent*)event
|
||||
{
|
||||
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||
[[self inputContext] handleEvent:event];
|
||||
#endif
|
||||
}
|
||||
|
||||
-(void)setDriver:(CDriverGL*)driver
|
||||
{
|
||||
_driver = driver;
|
||||
}
|
||||
|
||||
-(void)resizeWithOldSuperviewSize:(NSSize)oldBoundsSize
|
||||
{
|
||||
[super resizeWithOldSuperviewSize:oldBoundsSize];
|
||||
|
||||
if(!_driver)
|
||||
return;
|
||||
|
||||
viewDidResize(self, _driver);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* NSTextInputClient Protocol */
|
||||
|
||||
-(BOOL)hasMarkedText
|
||||
{
|
||||
return (_markedRange.location == NSNotFound ? NO : YES);
|
||||
}
|
||||
|
||||
-(NSRange)markedRange
|
||||
{
|
||||
return _markedRange;
|
||||
}
|
||||
|
||||
-(NSRange)selectedRange
|
||||
{
|
||||
return NSMakeRange(NSNotFound, 0);
|
||||
}
|
||||
|
||||
-(void)setMarkedText:(id)aString
|
||||
selectedRange:(NSRange)newSelection
|
||||
replacementRange:(NSRange)replacementRange
|
||||
{
|
||||
if(replacementRange.location == NSNotFound)
|
||||
replacementRange = _markedRange;
|
||||
|
||||
if([aString length] == 0)
|
||||
{
|
||||
[_characterStorage deleteCharactersInRange:replacementRange];
|
||||
[self unmarkText];
|
||||
}
|
||||
else
|
||||
{
|
||||
_markedRange = NSMakeRange(replacementRange.location, [aString length]);
|
||||
[_characterStorage replaceCharactersInRange:replacementRange
|
||||
withString:aString];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)unmarkText
|
||||
{
|
||||
_markedRange = NSMakeRange(NSNotFound, 0);
|
||||
[[self inputContext] discardMarkedText];
|
||||
}
|
||||
|
||||
-(NSArray*)validAttributesForMarkedText
|
||||
{
|
||||
return [NSArray arrayWithObjects:
|
||||
NSMarkedClauseSegmentAttributeName, NSGlyphInfoAttributeName, nil];
|
||||
}
|
||||
|
||||
-(NSAttributedString*)attributedSubstringForProposedRange:(NSRange)aRange
|
||||
actualRange:(NSRangePointer)actualRange
|
||||
{
|
||||
return [_characterStorage attributedSubstringFromRange:aRange];
|
||||
}
|
||||
|
||||
-(void)insertText:(id)aString
|
||||
replacementRange:(NSRange)replacementRange
|
||||
{
|
||||
if(replacementRange.location == NSNotFound)
|
||||
replacementRange = _markedRange;
|
||||
|
||||
[_characterStorage replaceCharactersInRange:replacementRange
|
||||
withString:aString];
|
||||
}
|
||||
|
||||
-(NSUInteger)characterIndexForPoint:(NSPoint)aPoint
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
-(NSRect)firstRectForCharacterRange:(NSRange)aRange
|
||||
actualRange:(NSRangePointer)actualRange
|
||||
{
|
||||
return NSMakeRect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
-(void)doCommandBySelector:(SEL)aSelector
|
||||
{
|
||||
[super doCommandBySelector:aSelector];
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,41 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include "AvailabilityMacros.h"
|
||||
|
||||
#ifdef NL_STATIC
|
||||
#ifdef USE_OPENGLES
|
||||
using NL3D::NLDRIVERGLES::CDriverGL;
|
||||
#else
|
||||
using NL3D::NLDRIVERGL::CDriverGL;
|
||||
#endif
|
||||
#else
|
||||
using NL3D::CDriverGL;
|
||||
#endif
|
||||
|
||||
@interface CocoaWindowDelegate : NSObject
|
||||
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||
<NSWindowDelegate>
|
||||
#endif
|
||||
{
|
||||
CDriverGL* _driver;
|
||||
}
|
||||
|
||||
- (id)initWithDriver:(CDriverGL*)driver;
|
||||
- (void)windowDidMove:(NSNotification*)notification;
|
||||
|
||||
@end
|
@ -0,0 +1,59 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "../stdopengl.h"
|
||||
#include "../driver_opengl.h"
|
||||
|
||||
#import "cocoa_window_delegate.h"
|
||||
|
||||
static void windowDidMove(NSWindow* window, CDriverGL* driver)
|
||||
{
|
||||
// get the rect (position, size) of the screen with menu bar
|
||||
NSRect screenRect = [[[NSScreen screens] objectAtIndex:0] frame];
|
||||
|
||||
// get the rect (position, size) of the window
|
||||
NSRect windowRect = [window frame];
|
||||
|
||||
// set x in driver
|
||||
driver->_WindowX = windowRect.origin.x;
|
||||
|
||||
// map y from cocoa to NeL coordinates before setting in driver
|
||||
driver->_WindowY =
|
||||
screenRect.size.height - windowRect.size.height - windowRect.origin.y;
|
||||
}
|
||||
|
||||
@implementation CocoaWindowDelegate
|
||||
|
||||
-(id)initWithDriver:(CDriverGL*)driver
|
||||
{
|
||||
if((self = [super init]))
|
||||
{
|
||||
_driver = driver;
|
||||
return self;
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(void)windowDidMove:(NSNotification *)notification
|
||||
{
|
||||
if(!_driver)
|
||||
return;
|
||||
|
||||
windowDidMove([notification object], _driver);
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,12 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: nel-driverogl
|
||||
Version: @VERSION@
|
||||
Description: NeL @VERSION@
|
||||
Requires:
|
||||
Libs: -L${libdir}
|
||||
Libs.private: @LIBS@ @OPENGL_LIBS@ @XF86VIDMODE_LIBS@ -lXmu
|
||||
Cflags: -I${includedir} @OPENGL_CFLAGS@ @XF86VIDMODE_CFLAGS@
|
@ -0,0 +1,17 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdopengl.h"
|
@ -0,0 +1,64 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <exception>
|
||||
#include <utility>
|
||||
#include <deque>
|
||||
#include <limits>
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# define NOMINMAX
|
||||
# include <windows.h>
|
||||
# include <windowsx.h>
|
||||
#endif
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
#include <GL/gl.h>
|
||||
#include "GL/wglext.h"
|
||||
#elif defined(NL_OS_MAC)
|
||||
#define GL_GLEXT_LEGACY
|
||||
#include <OpenGL/gl.h>
|
||||
#elif defined (NL_OS_UNIX)
|
||||
#define GLX_GLXEXT_PROTOTYPES
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
#include "GL/glxext.h"
|
||||
#endif
|
||||
#include "GL/glext.h"
|
||||
|
||||
#include "nel/misc/common.h"
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
#include "nel/misc/stream.h"
|
||||
#include "nel/misc/mem_stream.h"
|
||||
#include "nel/misc/time_nl.h"
|
||||
#include "nel/misc/command.h"
|
||||
|
||||
#include "nel/3d/driver.h"
|
@ -0,0 +1,869 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//#include "stdopengl.h"
|
||||
#include "unix_event_emitter.h"
|
||||
|
||||
#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
|
||||
typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e);
|
||||
|
||||
static Atom XA_CLIPBOARD = 0;
|
||||
static Atom XA_UTF8_STRING = 0;
|
||||
static Atom XA_TARGETS = 0;
|
||||
static Atom XA_NEL_SEL = 0;
|
||||
static Atom XA_WM_DELETE_WINDOW = 0;
|
||||
|
||||
namespace NLMISC {
|
||||
|
||||
CUnixEventEmitter::CUnixEventEmitter ():_dpy(NULL), _win(0), _emulateRawMode(false), _driver(NULL)
|
||||
{
|
||||
_im = 0;
|
||||
_ic = 0;
|
||||
_SelectionOwned=false;
|
||||
}
|
||||
|
||||
CUnixEventEmitter::~CUnixEventEmitter()
|
||||
{
|
||||
closeIM();
|
||||
}
|
||||
|
||||
void CUnixEventEmitter::init(Display *dpy, Window win, NL3D::IDriver *driver)
|
||||
{
|
||||
_dpy = dpy;
|
||||
_win = win;
|
||||
_driver = driver;
|
||||
|
||||
XSelectInput (_dpy, _win, KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask|PointerMotionMask|StructureNotifyMask|ExposureMask|EnterWindowMask|LeaveWindowMask|FocusChangeMask);
|
||||
|
||||
// define Atoms used by clipboard
|
||||
XA_CLIPBOARD = XInternAtom(dpy, "CLIPBOARD", False);
|
||||
XA_UTF8_STRING = XInternAtom(dpy, "UTF8_STRING", False);
|
||||
XA_TARGETS = XInternAtom(dpy, "TARGETS", False);
|
||||
XA_NEL_SEL = XInternAtom(dpy, "NeL_SEL", False);
|
||||
|
||||
// define Atom used by delete window
|
||||
XA_WM_DELETE_WINDOW = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
|
||||
XSetWMProtocols(dpy, win, &XA_WM_DELETE_WINDOW, 1);
|
||||
|
||||
/*
|
||||
TODO: implements all useful events processing
|
||||
ButtonMotionMask|Button1MotionMask|Button2MotionMask|
|
||||
Button3MotionMask|Button4MotionMask|Button5MotionMask|KeymapStateMask|
|
||||
SubstructureNotifyMask|VisibilityChangeMask|PropertyChangeMask|
|
||||
ColormapChangeMask|OwnerGrabButtonMask
|
||||
*/
|
||||
|
||||
createIM();
|
||||
}
|
||||
|
||||
void CUnixEventEmitter::createIM()
|
||||
{
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
|
||||
XModifierKeymap *g_mod_map = XGetModifierMapping(_dpy);
|
||||
|
||||
char *modifiers = XSetLocaleModifiers(getenv("XMODIFIERS"));
|
||||
|
||||
_im = XOpenIM(_dpy, NULL, NULL, NULL);
|
||||
|
||||
if (_im)
|
||||
{
|
||||
_ic = XCreateIC(_im, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, _win, XNFocusWindow, _win, NULL);
|
||||
// XSetICFocus(_ic);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ic = 0;
|
||||
nlwarning("XCreateIM failed");
|
||||
}
|
||||
|
||||
if (!_ic)
|
||||
{
|
||||
nlwarning("XCreateIC failed");
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void CUnixEventEmitter::closeIM()
|
||||
{
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
if (_ic)
|
||||
{
|
||||
XDestroyIC(_ic);
|
||||
_ic = 0;
|
||||
}
|
||||
|
||||
if (_im)
|
||||
{
|
||||
XCloseIM(_im);
|
||||
_im = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CUnixEventEmitter::submitEvents(CEventServer & server, bool allWindows)
|
||||
{
|
||||
while (XPending(_dpy))
|
||||
{
|
||||
XEvent Event;
|
||||
XNextEvent(_dpy, &Event);
|
||||
if (allWindows || Event.xany.window == _win)
|
||||
{
|
||||
// nlinfo("event: %d", Event.type);
|
||||
if (_driver)
|
||||
{
|
||||
// forward X events to OpenGL driver
|
||||
x11Proc proc = (x11Proc)_driver->getWindowProc();
|
||||
|
||||
if (proc)
|
||||
proc(_driver, &Event);
|
||||
}
|
||||
else
|
||||
{
|
||||
processMessage (Event, &server);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dispatch sent messages
|
||||
_InternalServer.setServer (&server);
|
||||
_InternalServer.pump (allWindows);
|
||||
}
|
||||
|
||||
static Bool isMouseMoveEvent(Display *display, XEvent *event, XPointer arg)
|
||||
{
|
||||
return (event->type == MotionNotify);
|
||||
}
|
||||
|
||||
void CUnixEventEmitter::emulateMouseRawMode(bool enable)
|
||||
{
|
||||
_emulateRawMode = enable;
|
||||
|
||||
if(_emulateRawMode)
|
||||
{
|
||||
XWindowAttributes xwa;
|
||||
XGetWindowAttributes(_dpy, _win, &xwa);
|
||||
XWarpPointer(_dpy, None, _win, None, None, None, None,
|
||||
(xwa.width / 2), (xwa.height / 2));
|
||||
|
||||
// remove all outstanding mouse move events, they happened before the mouse
|
||||
// was pulled back to 0.5 / 0.5, so a wrong movement delta would be
|
||||
// reported otherwise
|
||||
XEvent event;
|
||||
while(XCheckIfEvent(_dpy, &event, &isMouseMoveEvent, NULL)) { };
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef AltMask
|
||||
# ifdef NL_OS_MAC
|
||||
# define AltMask (8192)
|
||||
# else
|
||||
# define AltMask (Mod1Mask)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
TMouseButton getMouseButton (uint32 state)
|
||||
{
|
||||
uint32 button=noButton;
|
||||
if (state&Button1Mask) button|=leftButton;
|
||||
if (state&Button2Mask) button|=middleButton;
|
||||
if (state&Button3Mask) button|=rightButton;
|
||||
if (state&ControlMask) button|=ctrlButton;
|
||||
if (state&ShiftMask) button|=shiftButton;
|
||||
if (state&AltMask) button|=altButton;
|
||||
|
||||
return (TMouseButton)button;
|
||||
}
|
||||
|
||||
TKeyButton getKeyButton (uint32 state)
|
||||
{
|
||||
uint32 button=noKeyButton;
|
||||
if (state&ControlMask) button|=ctrlKeyButton;
|
||||
if (state&ShiftMask) button|=shiftKeyButton;
|
||||
if (state&AltMask) button|=altKeyButton;
|
||||
|
||||
return (TKeyButton)button;
|
||||
}
|
||||
|
||||
TKey getKeyFromKeycode (uint keycode)
|
||||
{
|
||||
// keycodes are depending on system
|
||||
switch (keycode)
|
||||
{
|
||||
#ifdef NL_OS_MAC
|
||||
/*
|
||||
TODO use key mapping from driver/opengl/mac/cocoa_adapter.mm
|
||||
*/
|
||||
case 0x12: return Key1;
|
||||
case 0x13: return Key2;
|
||||
case 0x14: return Key3;
|
||||
case 0x15: return Key4;
|
||||
case 0x16: return Key6;
|
||||
case 0x17: return Key5;
|
||||
case 0x18: return KeyEQUALS;
|
||||
case 0x19: return Key9;
|
||||
case 0x1a: return Key7;
|
||||
case 0x1c: return Key8;
|
||||
case 0x1d: return Key0;
|
||||
case 0x1e: return KeyRBRACKET;
|
||||
case 0x21: return KeyLBRACKET;
|
||||
case 0x27: return KeyAPOSTROPHE;
|
||||
case 0x29: return KeySEMICOLON;
|
||||
case 0x2a: return KeyBACKSLASH;
|
||||
case 0x2b: return KeyCOMMA;
|
||||
case 0x2c: return KeySLASH;
|
||||
case 0x2f: return KeyPERIOD;
|
||||
// case 0x5e: return KeyOEM_102;
|
||||
// case 0x30: return KeyTILDE;
|
||||
// case 0x3d: return KeyPARAGRAPH;
|
||||
#else
|
||||
case 0x0a: return Key1;
|
||||
case 0x0b: return Key2;
|
||||
case 0x0c: return Key3;
|
||||
case 0x0d: return Key4;
|
||||
case 0x0e: return Key5;
|
||||
case 0x0f: return Key6;
|
||||
case 0x10: return Key7;
|
||||
case 0x11: return Key8;
|
||||
case 0x12: return Key9;
|
||||
case 0x13: return Key0;
|
||||
case 0x14: return KeyLBRACKET;
|
||||
case 0x15: return KeyEQUALS;
|
||||
case 0x22: return KeyRBRACKET;
|
||||
case 0x23: return KeySEMICOLON;
|
||||
case 0x2f: return KeyCOMMA;
|
||||
case 0x30: return KeyTILDE;
|
||||
case 0x31: return KeyAPOSTROPHE;
|
||||
case 0x33: return KeyBACKSLASH;
|
||||
case 0x5e: return KeyOEM_102;
|
||||
// case 0x3a: return KeyCOMMA;
|
||||
case 0x3b: return KeyPERIOD;
|
||||
case 0x3c: return KeySLASH;
|
||||
case 0x3d: return KeyPARAGRAPH;
|
||||
// for non-standard keyboards, maps to QWERTY keys
|
||||
case 0x18: return KeyQ;
|
||||
case 0x19: return KeyW;
|
||||
case 0x1a: return KeyE;
|
||||
case 0x1b: return KeyR;
|
||||
case 0x1c: return KeyT;
|
||||
case 0x1d: return KeyY;
|
||||
case 0x1e: return KeyU;
|
||||
case 0x1f: return KeyI;
|
||||
case 0x20: return KeyO;
|
||||
case 0x21: return KeyP;
|
||||
case 0x26: return KeyQ;
|
||||
case 0x27: return KeyS;
|
||||
case 0x28: return KeyD;
|
||||
case 0x29: return KeyF;
|
||||
case 0x2a: return KeyG;
|
||||
case 0x2b: return KeyH;
|
||||
case 0x2c: return KeyJ;
|
||||
case 0x2d: return KeyK;
|
||||
case 0x2e: return KeyL;
|
||||
case 0x34: return KeyZ;
|
||||
case 0x35: return KeyX;
|
||||
case 0x36: return KeyC;
|
||||
case 0x37: return KeyV;
|
||||
case 0x38: return KeyB;
|
||||
case 0x39: return KeyN;
|
||||
case 0x3a: return KeyM;
|
||||
#endif
|
||||
default:
|
||||
// nlwarning("missing keycode 0x%x %d '%c'", keycode, keycode, keycode);
|
||||
break;
|
||||
}
|
||||
|
||||
return KeyNOKEY;
|
||||
}
|
||||
|
||||
TKey getKeyFromKeySym (KeySym keysym)
|
||||
{
|
||||
// nlwarning("0x%x %d '%c'", keysym, keysym, keysym);
|
||||
switch (keysym)
|
||||
{
|
||||
case XK_BackSpace: return KeyBACK;
|
||||
case XK_Tab: return KeyTAB;
|
||||
case XK_Return: return KeyRETURN;
|
||||
case XK_Sys_Req: return KeySNAPSHOT;
|
||||
case XK_Scroll_Lock: return KeySCROLL;
|
||||
case XK_Pause: return KeyPAUSE;
|
||||
case XK_Escape: return KeyESCAPE;
|
||||
case XK_Delete: return KeyDELETE;
|
||||
case XK_Home: return KeyHOME;
|
||||
case XK_Left: return KeyLEFT;
|
||||
case XK_Up: return KeyUP;
|
||||
case XK_Right: return KeyRIGHT;
|
||||
case XK_Down: return KeyDOWN;
|
||||
case XK_Page_Up: return KeyPRIOR;
|
||||
case XK_Page_Down: return KeyNEXT;
|
||||
case XK_End: return KeyEND;
|
||||
case XK_Print: return KeyPRINT;
|
||||
case XK_Insert: return KeyINSERT;
|
||||
case XK_Num_Lock: return KeyNUMLOCK;
|
||||
case XK_KP_0: return KeyNUMPAD0;
|
||||
case XK_KP_1: return KeyNUMPAD1;
|
||||
case XK_KP_2: return KeyNUMPAD2;
|
||||
case XK_KP_3: return KeyNUMPAD3;
|
||||
case XK_KP_4: return KeyNUMPAD4;
|
||||
case XK_KP_5: return KeyNUMPAD5;
|
||||
case XK_KP_6: return KeyNUMPAD6;
|
||||
case XK_KP_7: return KeyNUMPAD7;
|
||||
case XK_KP_8: return KeyNUMPAD8;
|
||||
case XK_KP_9: return KeyNUMPAD9;
|
||||
case XK_KP_Enter: return KeyRETURN;
|
||||
case XK_KP_Home: return KeyHOME;
|
||||
case XK_KP_Left: return KeyLEFT;
|
||||
case XK_KP_Up: return KeyUP;
|
||||
case XK_KP_Right: return KeyRIGHT;
|
||||
case XK_KP_Down: return KeyDOWN;
|
||||
case XK_KP_Page_Up: return KeyPRIOR;
|
||||
case XK_KP_Page_Down: return KeyNEXT;
|
||||
case XK_KP_End: return KeyEND;
|
||||
case XK_KP_Begin: return KeyCANCEL;
|
||||
case XK_KP_Insert: return KeyINSERT;
|
||||
case XK_KP_Delete: return KeyDELETE;
|
||||
case XK_KP_Multiply: return KeyMULTIPLY;
|
||||
case XK_KP_Add: return KeyADD;
|
||||
case XK_KP_Subtract: return KeySUBTRACT;
|
||||
case XK_KP_Decimal: return KeyDECIMAL;
|
||||
// case XK_period: return KeyDECIMAL;
|
||||
case XK_KP_Divide: return KeyDIVIDE;
|
||||
case XK_F1: return KeyF1;
|
||||
case XK_F2: return KeyF2;
|
||||
case XK_F3: return KeyF3;
|
||||
case XK_F4: return KeyF4;
|
||||
case XK_F5: return KeyF5;
|
||||
case XK_F6: return KeyF6;
|
||||
case XK_F7: return KeyF7;
|
||||
case XK_F8: return KeyF8;
|
||||
case XK_F9: return KeyF9;
|
||||
case XK_F10: return KeyF10;
|
||||
case XK_F11: return KeyF11;
|
||||
case XK_F12: return KeyF12;
|
||||
case XK_Shift_L: return KeySHIFT;
|
||||
case XK_Shift_R: return KeySHIFT;
|
||||
case XK_Control_L: return KeyCONTROL;
|
||||
case XK_Control_R: return KeyCONTROL;
|
||||
case XK_Caps_Lock: return KeyCAPITAL;
|
||||
case XK_Super_L: return KeyLWIN;
|
||||
case XK_Super_R: return KeyRWIN;
|
||||
case XK_Mode_switch: return KeyMENU;
|
||||
case XK_ISO_Level3_Shift: return KeyMENU;
|
||||
case XK_Menu: return KeyAPPS;
|
||||
case XK_Alt_L: return KeyMENU;
|
||||
case XK_Alt_R: return KeyMENU;
|
||||
case XK_space: return KeySPACE;
|
||||
case XK_A:
|
||||
case XK_a: return KeyA;
|
||||
case XK_B:
|
||||
case XK_b: return KeyB;
|
||||
case XK_C:
|
||||
case XK_c: return KeyC;
|
||||
case XK_D:
|
||||
case XK_d: return KeyD;
|
||||
case XK_E:
|
||||
case XK_e: return KeyE;
|
||||
case XK_F:
|
||||
case XK_f: return KeyF;
|
||||
case XK_G:
|
||||
case XK_g: return KeyG;
|
||||
case XK_H:
|
||||
case XK_h: return KeyH;
|
||||
case XK_I:
|
||||
case XK_i: return KeyI;
|
||||
case XK_J:
|
||||
case XK_j: return KeyJ;
|
||||
case XK_K:
|
||||
case XK_k: return KeyK;
|
||||
case XK_L:
|
||||
case XK_l: return KeyL;
|
||||
case XK_M:
|
||||
case XK_m: return KeyM;
|
||||
case XK_N:
|
||||
case XK_n: return KeyN;
|
||||
case XK_O:
|
||||
case XK_o: return KeyO;
|
||||
case XK_P:
|
||||
case XK_p: return KeyP;
|
||||
case XK_Q:
|
||||
case XK_q: return KeyQ;
|
||||
case XK_R:
|
||||
case XK_r: return KeyR;
|
||||
case XK_S:
|
||||
case XK_s: return KeyS;
|
||||
case XK_T:
|
||||
case XK_t: return KeyT;
|
||||
case XK_U:
|
||||
case XK_u: return KeyU;
|
||||
case XK_V:
|
||||
case XK_v: return KeyV;
|
||||
case XK_W:
|
||||
case XK_w: return KeyW;
|
||||
case XK_X:
|
||||
case XK_x: return KeyX;
|
||||
case XK_Y:
|
||||
case XK_y: return KeyY;
|
||||
case XK_Z:
|
||||
case XK_z: return KeyZ;
|
||||
default:
|
||||
// other keys don't need to be processed here
|
||||
break;
|
||||
}
|
||||
return KeyNOKEY;
|
||||
}
|
||||
|
||||
// check if the next pressed key is the same
|
||||
static bool keyRepeat(Display *display, XEvent *event)
|
||||
{
|
||||
XEvent peekevent;
|
||||
|
||||
if (XPending(display))
|
||||
{
|
||||
XPeekEvent(display, &peekevent);
|
||||
|
||||
if ((peekevent.type == KeyPress) &&
|
||||
(peekevent.xkey.keycode == event->xkey.keycode) &&
|
||||
((peekevent.xkey.time-event->xkey.time) < 2))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server)
|
||||
{
|
||||
if (!server)
|
||||
server=&_InternalServer;
|
||||
|
||||
XWindowAttributes xwa;
|
||||
XGetWindowAttributes (_dpy, _win, &xwa);
|
||||
|
||||
switch (event.type)
|
||||
{
|
||||
case ButtonPress:
|
||||
{
|
||||
//nlinfo("%d %d %d", event.xbutton.button, event.xbutton.x, event.xbutton.y);
|
||||
float fX = (float) event.xbutton.x / (float) xwa.width;
|
||||
float fY = 1.0f - (float) event.xbutton.y / (float) xwa.height;
|
||||
TMouseButton button=getMouseButton(event.xbutton.state);
|
||||
switch(event.xbutton.button)
|
||||
{
|
||||
case Button1:
|
||||
server->postEvent(new CEventMouseDown(fX, fY, (TMouseButton)(leftButton|(button&~(leftButton|middleButton|rightButton))), this));
|
||||
break;
|
||||
case Button2:
|
||||
server->postEvent(new CEventMouseDown(fX, fY, (TMouseButton)(middleButton|(button&~(leftButton|middleButton|rightButton))), this));
|
||||
break;
|
||||
case Button3:
|
||||
server->postEvent(new CEventMouseDown(fX, fY, (TMouseButton)(rightButton|(button&~(leftButton|middleButton|rightButton))), this));
|
||||
break;
|
||||
case Button4:
|
||||
server->postEvent(new CEventMouseWheel(fX, fY, button, true, this));
|
||||
break;
|
||||
case Button5:
|
||||
server->postEvent(new CEventMouseWheel(fX, fY, button, false, this));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ButtonRelease:
|
||||
{
|
||||
//nlinfo("%d %d %d", event.xbutton.button, event.xbutton.x, event.xbutton.y);
|
||||
float fX = (float) event.xbutton.x / (float) xwa.width;
|
||||
float fY = 1.0f - (float) event.xbutton.y / (float) xwa.height;
|
||||
switch(event.xbutton.button)
|
||||
{
|
||||
case Button1:
|
||||
server->postEvent(new CEventMouseUp(fX, fY, leftButton, this));
|
||||
break;
|
||||
case Button2:
|
||||
server->postEvent(new CEventMouseUp(fX, fY, middleButton, this));
|
||||
break;
|
||||
case Button3:
|
||||
server->postEvent(new CEventMouseUp(fX, fY, rightButton, this));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MotionNotify:
|
||||
{
|
||||
TMouseButton button=getMouseButton (event.xbutton.state);
|
||||
|
||||
// if raw mode should be emulated
|
||||
if(_emulateRawMode)
|
||||
{
|
||||
// when we just wrapped back the pointer to 0.5 / 0.5, ignore event
|
||||
if(event.xbutton.x == xwa.width / 2 && event.xbutton.y == xwa.height / 2)
|
||||
break;
|
||||
|
||||
// post a CGDMouseMove with the movement delta to the event server
|
||||
server->postEvent(
|
||||
new CGDMouseMove(this, NULL /* no mouse device */,
|
||||
event.xbutton.x - (xwa.width / 2),
|
||||
(xwa.height / 2) - event.xbutton.y));
|
||||
|
||||
// move the pointer back to the center of the window
|
||||
XWarpPointer(_dpy, None, _win, None, None, None, None,
|
||||
(xwa.width / 2), (xwa.height / 2));
|
||||
}
|
||||
// if in normal mouse mode
|
||||
else
|
||||
{
|
||||
// get the relative mouse position
|
||||
float fX = (float) event.xbutton.x / (float) xwa.width;
|
||||
float fY = 1.0f - (float) event.xbutton.y / (float) xwa.height;
|
||||
|
||||
// post a normal mouse move event to the event server
|
||||
server->postEvent (new CEventMouseMove (fX, fY, button, this));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KeyPress:
|
||||
{
|
||||
// save keycode because XFilterEvent could set it to 0
|
||||
uint keyCode = event.xkey.keycode;
|
||||
KeySym k;
|
||||
static char Text[256];
|
||||
int c = 0;
|
||||
|
||||
// check if event is filtered
|
||||
bool filtered = XFilterEvent(&event, _win);
|
||||
|
||||
// if key event is filtered, we shouldn't use XLookupString to retrieve KeySym
|
||||
if (!filtered)
|
||||
{
|
||||
Status status = XLookupNone;
|
||||
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
if (_ic)
|
||||
c = Xutf8LookupString(_ic, &event.xkey, Text, sizeof(Text), &k, &status);
|
||||
#endif
|
||||
|
||||
if (status == XLookupNone)
|
||||
c = XLookupString(&event.xkey, Text, sizeof(Text), &k, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
k = XKeycodeToKeysym(_dpy, keyCode, 0);
|
||||
}
|
||||
|
||||
// send CEventKeyDown event only if keyCode is defined
|
||||
if (keyCode)
|
||||
{
|
||||
TKey key = getKeyFromKeySym(k);
|
||||
if(key == KeyNOKEY)
|
||||
key = getKeyFromKeycode(keyCode);
|
||||
|
||||
// search for key in map
|
||||
std::map<TKey, bool>::const_iterator it = _PressedKeys.find(key);
|
||||
|
||||
// if key is not found or value is false, that's the first time
|
||||
bool firstTime = (it == _PressedKeys.end()) || !it->second;
|
||||
|
||||
server->postEvent (new CEventKeyDown (key, getKeyButton(event.xbutton.state), firstTime, this));
|
||||
_PressedKeys[key] = true;
|
||||
|
||||
// don't send a control character when deleting
|
||||
if (key == KeyDELETE)
|
||||
c = 0;
|
||||
}
|
||||
|
||||
Text[c] = '\0';
|
||||
if(c>0)
|
||||
{
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
ucstring ucstr;
|
||||
ucstr.fromUtf8(Text);
|
||||
|
||||
CEventChar *charEvent = new CEventChar (ucstr[0], getKeyButton(event.xbutton.state), this);
|
||||
|
||||
// raw if not processed by IME
|
||||
charEvent->setRaw(keyCode != 0);
|
||||
|
||||
server->postEvent (charEvent);
|
||||
#else
|
||||
for (int i = 0; i < c; i++)
|
||||
{
|
||||
CEventChar *charEvent = new CEventChar ((ucchar)(unsigned char)Text[i], getKeyButton(event.xbutton.state), this);
|
||||
|
||||
// raw if not processed by IME
|
||||
charEvent->setRaw(keyCode != 0);
|
||||
|
||||
server->postEvent (charEvent);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KeyRelease:
|
||||
{
|
||||
if (!keyRepeat(_dpy, &event))
|
||||
{
|
||||
KeySym k;
|
||||
// only need to get correct KeySym
|
||||
int c = XLookupString(&event.xkey, NULL, 0, &k, NULL);
|
||||
|
||||
TKey key = getKeyFromKeySym(k);
|
||||
if(key == KeyNOKEY)
|
||||
key = getKeyFromKeycode(event.xkey.keycode);
|
||||
|
||||
server->postEvent (new CEventKeyUp (key, getKeyButton(event.xbutton.state), this));
|
||||
_PressedKeys[key] = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SelectionRequest:
|
||||
{
|
||||
XEvent respond;
|
||||
XSelectionRequestEvent req = event.xselectionrequest;
|
||||
|
||||
respond.xselection.type= SelectionNotify;
|
||||
respond.xselection.display= req.display;
|
||||
respond.xselection.requestor= req.requestor;
|
||||
respond.xselection.selection=req.selection;
|
||||
respond.xselection.target= req.target;
|
||||
respond.xselection.time = req.time;
|
||||
respond.xselection.property = req.property;
|
||||
|
||||
if (req.property == None)
|
||||
{
|
||||
respond.xselection.property = req.target;
|
||||
}
|
||||
if (req.target == XA_TARGETS)
|
||||
{
|
||||
Atom targets[] =
|
||||
{
|
||||
XA_TARGETS,
|
||||
XA_STRING,
|
||||
XA_UTF8_STRING
|
||||
};
|
||||
|
||||
respond.xselection.property = req.property;
|
||||
|
||||
XChangeProperty(req.display, req.requestor, req.property, XA_ATOM, 32, PropModeReplace, (unsigned char *)targets, 3 /* number of element */);
|
||||
}
|
||||
else if (req.target == XA_STRING)
|
||||
{
|
||||
respond.xselection.property = req.property;
|
||||
std::string str = _CopiedString.toString();
|
||||
XChangeProperty(req.display, req.requestor, req.property, XA_STRING, 8, PropModeReplace, (const unsigned char*)str.c_str(), str.length());
|
||||
}
|
||||
else if (req.target == XA_UTF8_STRING)
|
||||
{
|
||||
respond.xselection.property = req.property;
|
||||
std::string str = _CopiedString.toUtf8();
|
||||
XChangeProperty(req.display, req.requestor, respond.xselection.property, XA_UTF8_STRING, 8, PropModeReplace, (const unsigned char*)str.c_str(), str.length());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Note: Calling XGetAtomName with arbitrary value crash the client, maybe req.target have been sanitized by X11 server
|
||||
respond.xselection.property = None;
|
||||
}
|
||||
|
||||
XSendEvent (_dpy, req.requestor, 0, 0, &respond);
|
||||
|
||||
break;
|
||||
}
|
||||
case SelectionClear:
|
||||
_SelectionOwned = false;
|
||||
_CopiedString = "";
|
||||
break;
|
||||
case SelectionNotify:
|
||||
{
|
||||
Atom target = event.xselection.target;
|
||||
|
||||
Atom actualType = 0;
|
||||
int actualFormat = 0;
|
||||
unsigned long nitems = 0, bytesLeft = 0;
|
||||
|
||||
// some applications are sending ATOM and other TARGETS
|
||||
if (target == XA_TARGETS || target == XA_ATOM)
|
||||
{
|
||||
Atom *supportedTargets = NULL;
|
||||
|
||||
// list NeL selection properties
|
||||
if (XGetWindowProperty(_dpy, _win, XA_NEL_SEL, 0, XMaxRequestSize(_dpy), False, AnyPropertyType, &actualType, &actualFormat, &nitems, &bytesLeft, (unsigned char**)&supportedTargets) != Success)
|
||||
return false;
|
||||
|
||||
if (bytesLeft > 0)
|
||||
{
|
||||
nlwarning("Paste: Supported TARGETS list too long.");
|
||||
}
|
||||
|
||||
Atom bestTarget = 0;
|
||||
sint bestTargetElect = 0;
|
||||
|
||||
// Elect best type
|
||||
for (uint i=0; i < nitems; i++)
|
||||
{
|
||||
// nlwarning(" - Type=%s (%u)", XGetAtomName(_dpy, supportedTargets[i]), (uint)supportedTargets[i]);
|
||||
if (supportedTargets[i] == XA_UTF8_STRING )
|
||||
{
|
||||
if (bestTargetElect < 2)
|
||||
{
|
||||
bestTarget = XA_UTF8_STRING;
|
||||
bestTargetElect = 2;
|
||||
}
|
||||
}
|
||||
else if (supportedTargets[i] == XA_STRING )
|
||||
{
|
||||
if (bestTargetElect < 1)
|
||||
{
|
||||
bestTarget = XA_STRING;
|
||||
bestTargetElect = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XFree(supportedTargets);
|
||||
|
||||
if (!bestTargetElect)
|
||||
{
|
||||
nlwarning("Paste buffer is not a text buffer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// request string conversion
|
||||
XConvertSelection(_dpy, XA_CLIPBOARD, bestTarget, XA_NEL_SEL, _win, CurrentTime);
|
||||
}
|
||||
else if (target == XA_UTF8_STRING || target == XA_STRING)
|
||||
{
|
||||
uint8 *data = NULL;
|
||||
|
||||
// get selection
|
||||
if (XGetWindowProperty(_dpy, _win, XA_NEL_SEL, 0, XMaxRequestSize(_dpy), False, AnyPropertyType, &actualType, &actualFormat, &nitems, &bytesLeft, (unsigned char**)&data) != Success)
|
||||
return false;
|
||||
|
||||
ucstring text;
|
||||
std::string tmpData = (const char*)data;
|
||||
XFree(data);
|
||||
|
||||
// convert buffer to ucstring
|
||||
if (target == XA_UTF8_STRING)
|
||||
{
|
||||
text = ucstring::makeFromUtf8(tmpData);
|
||||
}
|
||||
else if (target == XA_STRING)
|
||||
{
|
||||
text = tmpData;
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning("Unknow format %u", (uint)target);
|
||||
}
|
||||
|
||||
// sent string event to event server
|
||||
server->postEvent (new CEventString (text, this));
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning("Unknow target %u", (uint)target);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case FocusIn:
|
||||
// keyboard focus
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
if (_ic) XSetICFocus(_ic);
|
||||
#endif
|
||||
server->postEvent (new CEventSetFocus (true, this));
|
||||
// server->postEvent(new CEventActivate(true, this));
|
||||
break;
|
||||
case FocusOut:
|
||||
// keyboard focus
|
||||
#ifdef X_HAVE_UTF8_STRING
|
||||
if (_ic) XUnsetICFocus(_ic);
|
||||
#endif
|
||||
server->postEvent (new CEventSetFocus (false, this));
|
||||
// server->postEvent(new CEventActivate(false, this));
|
||||
break;
|
||||
case KeymapNotify:
|
||||
break;
|
||||
case MappingNotify:
|
||||
// update keymap
|
||||
XRefreshKeyboardMapping((XMappingEvent *)&event);
|
||||
break;
|
||||
case DestroyNotify:
|
||||
// XIM server has crashed
|
||||
createIM();
|
||||
break;
|
||||
case ClientMessage:
|
||||
if ((event.xclient.format == 32) && ((Atom)event.xclient.data.l[0] == XA_WM_DELETE_WINDOW))
|
||||
{
|
||||
server->postEvent(new CEventDestroyWindow(this));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// nlinfo("UnknownEvent");
|
||||
// XtDispatchEvent(&event);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CUnixEventEmitter::copyTextToClipboard(const ucstring &text)
|
||||
{
|
||||
_CopiedString = text;
|
||||
|
||||
// NeL window is the owner of clipboard
|
||||
XSetSelectionOwner(_dpy, XA_CLIPBOARD, _win, CurrentTime);
|
||||
|
||||
// check we are owning the clipboard
|
||||
if (XGetSelectionOwner(_dpy, XA_CLIPBOARD) != _win)
|
||||
{
|
||||
nlwarning("Can't aquire selection");
|
||||
return false;
|
||||
}
|
||||
|
||||
_SelectionOwned = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CUnixEventEmitter::pasteTextFromClipboard(ucstring &text)
|
||||
{
|
||||
// check if we own the selection
|
||||
if (_SelectionOwned)
|
||||
{
|
||||
text = _CopiedString;
|
||||
return true;
|
||||
}
|
||||
|
||||
// check if there is a data in clipboard
|
||||
if (XGetSelectionOwner(_dpy, XA_CLIPBOARD) == None)
|
||||
return false;
|
||||
|
||||
// request supported methods
|
||||
XConvertSelection(_dpy, XA_CLIPBOARD, XA_TARGETS, XA_NEL_SEL, _win, CurrentTime);
|
||||
|
||||
// don't return result now
|
||||
return false;
|
||||
}
|
||||
|
||||
} // NLMISC
|
||||
|
||||
#endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
@ -0,0 +1,123 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef NL_UNIX_EVENT_EMITTER_H
|
||||
#define NL_UNIX_EVENT_EMITTER_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/misc/event_emitter.h"
|
||||
#include "nel/misc/events.h"
|
||||
#include "nel/misc/game_device_events.h"
|
||||
|
||||
#include "nel/3d/driver.h"
|
||||
|
||||
#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
namespace NLMISC {
|
||||
|
||||
|
||||
/**
|
||||
* CEventEmitter UNIX implementation
|
||||
* \author Vianney Lecroart
|
||||
* \author Nevrax France
|
||||
* \date 2000
|
||||
*/
|
||||
class CUnixEventEmitter : public IEventEmitter
|
||||
{
|
||||
public:
|
||||
|
||||
/// Constructor
|
||||
CUnixEventEmitter();
|
||||
virtual ~CUnixEventEmitter();
|
||||
|
||||
/**
|
||||
* initialize CUnixEventEmitter
|
||||
*/
|
||||
void init(Display *dpy, Window win, NL3D::IDriver *driver = NULL);
|
||||
|
||||
/**
|
||||
* sends all events to server
|
||||
* (should call CEventServer method postEvent() )
|
||||
*/
|
||||
virtual void submitEvents(CEventServer & server, bool allWindows);
|
||||
|
||||
/**
|
||||
* enable or disable mouse raw mode
|
||||
*/
|
||||
virtual void emulateMouseRawMode(bool emulate);
|
||||
|
||||
/**
|
||||
* process input-related events (mouse and keyboard)
|
||||
*/
|
||||
bool processMessage(XEvent &event, CEventServer *server = NULL);
|
||||
|
||||
/**
|
||||
* Copy a string to system clipboard.
|
||||
*/
|
||||
virtual bool copyTextToClipboard(const ucstring &text);
|
||||
|
||||
/*
|
||||
* Paste a string from system clipboard.
|
||||
*/
|
||||
virtual bool pasteTextFromClipboard(ucstring &text);
|
||||
|
||||
void createIM();
|
||||
void closeIM();
|
||||
|
||||
private:
|
||||
|
||||
// Private internal server message
|
||||
class CUnixEventServer : CEventServer
|
||||
{
|
||||
friend class CUnixEventEmitter;
|
||||
public:
|
||||
void setServer (CEventServer *server)
|
||||
{
|
||||
_Server=server;
|
||||
}
|
||||
private:
|
||||
virtual bool pumpEvent(CEvent* event)
|
||||
{
|
||||
CEventServer::pumpEvent(event);
|
||||
_Server->postEvent (event);
|
||||
return false;
|
||||
}
|
||||
private:
|
||||
CEventServer *_Server;
|
||||
};
|
||||
|
||||
Display* _dpy;
|
||||
Window _win;
|
||||
std::map<TKey, bool> _PressedKeys;
|
||||
XIM _im;
|
||||
XIC _ic;
|
||||
bool _emulateRawMode;
|
||||
NL3D::IDriver* _driver;
|
||||
CUnixEventServer _InternalServer;
|
||||
ucstring _CopiedString;
|
||||
bool _SelectionOwned;
|
||||
};
|
||||
|
||||
|
||||
} // NLMISC
|
||||
|
||||
#endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
||||
|
||||
#endif // NL_UNIX_EVENT_EMITTER_H
|
||||
|
||||
/* End of unix_event_emitter.h */
|
@ -0,0 +1,61 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "nel/3d/dyn_mat_loader.h"
|
||||
#include "nel/3d/dynamic_material.h"
|
||||
#include "nel/misc/file.h"
|
||||
#include "nel/misc/i_xml.h"
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
CDynMatLoader::CDynMatLoader()
|
||||
{
|
||||
mat = NULL;
|
||||
}
|
||||
|
||||
CDynMatLoader::~CDynMatLoader()
|
||||
{
|
||||
mat = NULL;
|
||||
}
|
||||
|
||||
bool CDynMatLoader::loadFrom( const std::string &fileName )
|
||||
{
|
||||
NLMISC::CIFile ifile;
|
||||
if( !ifile.open( fileName, true ) )
|
||||
{
|
||||
nlinfo( "Error opening file %s", fileName.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
NLMISC::CIXml xml;
|
||||
if( !xml.init( ifile ) )
|
||||
{
|
||||
ifile.close();
|
||||
nlinfo( "Error initializing XML stream for file %s", fileName.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
mat = new CDynMaterial();
|
||||
mat->serial( xml );
|
||||
|
||||
ifile.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,383 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "nel/3d/dynamic_material.h"
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
void SDynMaterialProp::serial( NLMISC::IStream &f )
|
||||
{
|
||||
f.xmlPush( "property" );
|
||||
|
||||
f.xmlPush( "id" );
|
||||
f.serial( prop );
|
||||
f.xmlPop();
|
||||
|
||||
f.xmlPush( "label" );
|
||||
f.serial( label );
|
||||
f.xmlPop();
|
||||
|
||||
f.xmlPush( "type" );
|
||||
f.serial( type );
|
||||
f.xmlPop();
|
||||
|
||||
f.xmlPush( "value" );
|
||||
f.serial( value );
|
||||
f.xmlPop();
|
||||
|
||||
f.xmlPop();
|
||||
}
|
||||
|
||||
void SRenderPass::serial( NLMISC::IStream &f )
|
||||
{
|
||||
f.xmlPush( "pass" );
|
||||
|
||||
f.xmlPush( "name" );
|
||||
f.serial( name );
|
||||
f.xmlPop();
|
||||
|
||||
f.xmlPush( "shader" );
|
||||
f.serial( shaderRef );
|
||||
f.xmlPop();
|
||||
|
||||
f.xmlPush( "properties" );
|
||||
|
||||
if( !f.isReading() )
|
||||
{
|
||||
uint32 n = properties.size();
|
||||
f.xmlPush( "count" );
|
||||
f.serial( n );
|
||||
f.xmlPop();
|
||||
|
||||
std::vector< SDynMaterialProp >::iterator itr = properties.begin();
|
||||
while( itr != properties.end() )
|
||||
{
|
||||
itr->serial( f );
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 n;
|
||||
f.xmlPush( "count" );
|
||||
f.serial( n );
|
||||
f.xmlPop();
|
||||
|
||||
for( uint32 i = 0; i < n; i++ )
|
||||
{
|
||||
SDynMaterialProp prop;
|
||||
prop.serial( f );
|
||||
properties.push_back( prop );
|
||||
}
|
||||
}
|
||||
|
||||
f.xmlPop();
|
||||
|
||||
f.xmlPop();
|
||||
}
|
||||
|
||||
void SRenderPass::addProperty( const SDynMaterialProp &prop )
|
||||
{
|
||||
std::vector< SDynMaterialProp >::const_iterator itr = properties.begin();
|
||||
while( itr != properties.end() )
|
||||
{
|
||||
if( itr->prop == prop.prop )
|
||||
break;
|
||||
++itr;
|
||||
}
|
||||
if( itr != properties.end() )
|
||||
return;
|
||||
|
||||
properties.push_back( prop );
|
||||
}
|
||||
|
||||
void SRenderPass::removeProperty( const std::string &name )
|
||||
{
|
||||
std::vector< SDynMaterialProp >::iterator itr = properties.begin();
|
||||
while( itr != properties.end() )
|
||||
{
|
||||
if( itr->prop == name )
|
||||
break;
|
||||
++itr;
|
||||
}
|
||||
if( itr == properties.end() )
|
||||
return;
|
||||
|
||||
properties.erase( itr );
|
||||
}
|
||||
|
||||
bool SRenderPass::changeProperty( const std::string &name, const SDynMaterialProp &prop )
|
||||
{
|
||||
std::vector< SDynMaterialProp >::iterator itr = properties.begin();
|
||||
while( itr != properties.end() )
|
||||
{
|
||||
if( itr->prop == name )
|
||||
break;
|
||||
++itr;
|
||||
}
|
||||
if( itr == properties.end() )
|
||||
return false;
|
||||
|
||||
itr->prop = prop.prop;
|
||||
itr->label = prop.label;
|
||||
itr->type = prop.type;
|
||||
itr->value = prop.value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const SDynMaterialProp* SRenderPass::getProperty( uint32 i ) const
|
||||
{
|
||||
if( i >= properties.size() )
|
||||
return NULL;
|
||||
|
||||
return &( properties[ i ] );
|
||||
}
|
||||
|
||||
CDynMaterial::CDynMaterial()
|
||||
{
|
||||
reconstruct();
|
||||
}
|
||||
|
||||
CDynMaterial::~CDynMaterial()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
CDynMaterial& CDynMaterial::operator=( const CDynMaterial &other )
|
||||
{
|
||||
if( &other != this )
|
||||
{
|
||||
clear();
|
||||
|
||||
std::vector< SRenderPass* >::const_iterator itr = other.passes.begin();
|
||||
while( itr != other.passes.end() )
|
||||
{
|
||||
SRenderPass *pass = new SRenderPass();
|
||||
*pass = *(*itr);
|
||||
passes.push_back( pass );
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void CDynMaterial::reconstruct()
|
||||
{
|
||||
clear();
|
||||
SRenderPass *p = new SRenderPass();
|
||||
p->setName( "pass1" );
|
||||
passes.push_back( p );
|
||||
}
|
||||
|
||||
void CDynMaterial::clear()
|
||||
{
|
||||
std::vector< SRenderPass* >::iterator itr = passes.begin();
|
||||
while( itr != passes.end() )
|
||||
{
|
||||
delete *itr;
|
||||
++itr;
|
||||
}
|
||||
passes.clear();
|
||||
}
|
||||
|
||||
void CDynMaterial::serial( NLMISC::IStream &f )
|
||||
{
|
||||
f.xmlPush( "Material" );
|
||||
|
||||
int version = f.serialVersion( 1 );
|
||||
|
||||
f.xmlPush( "passes" );
|
||||
|
||||
if( !f.isReading() )
|
||||
{
|
||||
uint32 n = passes.size();
|
||||
f.xmlPush( "count" );
|
||||
f.serial( n );
|
||||
f.xmlPop();
|
||||
|
||||
std::vector< SRenderPass* >::iterator itr = passes.begin();
|
||||
while( itr != passes.end() )
|
||||
{
|
||||
(*itr)->serial( f );
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
clear();
|
||||
uint32 n;
|
||||
f.xmlPush( "count" );
|
||||
f.serial( n );
|
||||
f.xmlPop();
|
||||
|
||||
for( uint32 i = 0; i < n; i++ )
|
||||
{
|
||||
SRenderPass *pass = new SRenderPass();
|
||||
pass->serial( f );
|
||||
passes.push_back( pass );
|
||||
}
|
||||
}
|
||||
|
||||
f.xmlPop();
|
||||
|
||||
f.xmlPop();
|
||||
}
|
||||
|
||||
void CDynMaterial::addPass( const SRenderPass &pass )
|
||||
{
|
||||
std::string n;
|
||||
std::string name;
|
||||
pass.getName( name );
|
||||
|
||||
std::vector< SRenderPass* >::iterator itr = passes.begin();
|
||||
while( itr != passes.end() )
|
||||
{
|
||||
(*itr)->getName( n );
|
||||
if( n == name )
|
||||
break;
|
||||
++itr;
|
||||
}
|
||||
if( itr != passes.end() )
|
||||
return;
|
||||
|
||||
SRenderPass *p = new SRenderPass();
|
||||
*p = pass;
|
||||
passes.push_back( p );
|
||||
}
|
||||
|
||||
void CDynMaterial::removePass( const std::string &name )
|
||||
{
|
||||
std::string n;
|
||||
std::vector< SRenderPass* >::iterator itr = passes.begin();
|
||||
while( itr != passes.end() )
|
||||
{
|
||||
(*itr)->getName( n );
|
||||
if( n == name )
|
||||
break;
|
||||
++itr;
|
||||
}
|
||||
|
||||
if( itr != passes.end() )
|
||||
{
|
||||
delete *itr;
|
||||
passes.erase( itr );
|
||||
}
|
||||
}
|
||||
|
||||
void CDynMaterial::renamePass( const std::string &from, const std::string &to )
|
||||
{
|
||||
std::string n;
|
||||
std::vector< SRenderPass* >::iterator itr = passes.begin();
|
||||
while( itr != passes.end() )
|
||||
{
|
||||
(*itr)->getName( n );
|
||||
if( n == from )
|
||||
break;
|
||||
++itr;
|
||||
}
|
||||
|
||||
if( itr != passes.end() )
|
||||
(*itr)->setName( to );
|
||||
}
|
||||
|
||||
void CDynMaterial::movePassUp( const std::string &name )
|
||||
{
|
||||
std::string n;
|
||||
uint32 i = 0;
|
||||
for( i = 0; i < passes.size(); i++ )
|
||||
{
|
||||
passes[ i ]->getName( n );
|
||||
if( n == name )
|
||||
break;
|
||||
}
|
||||
|
||||
if( i >= passes.size() )
|
||||
return;
|
||||
|
||||
if( i == 0 )
|
||||
return;
|
||||
|
||||
SRenderPass *temp = passes[ i ];
|
||||
passes[ i ] = passes[ i - 1 ];
|
||||
passes[ i - 1 ] = temp;
|
||||
}
|
||||
|
||||
void CDynMaterial::movePassDown( const std::string &name )
|
||||
{
|
||||
std::string n;
|
||||
uint32 i = 0;
|
||||
for( i = 0; i < passes.size(); i++ )
|
||||
{
|
||||
passes[ i ]->getName( n );
|
||||
if( n == name )
|
||||
break;
|
||||
}
|
||||
|
||||
if( i >= passes.size() )
|
||||
return;
|
||||
|
||||
if( i == ( passes.size() - 1 ) )
|
||||
return;
|
||||
|
||||
SRenderPass *temp = passes[ i ];
|
||||
passes[ i ] = passes[ i + 1 ];
|
||||
passes[ i + 1 ] = temp;
|
||||
}
|
||||
|
||||
SRenderPass* CDynMaterial::getPass( const std::string &name )
|
||||
{
|
||||
std::string n;
|
||||
std::vector< SRenderPass* >::iterator itr = passes.begin();
|
||||
while( itr != passes.end() )
|
||||
{
|
||||
(*itr)->getName( n );
|
||||
if( n == name )
|
||||
break;
|
||||
++itr;
|
||||
}
|
||||
if( itr == passes.end() )
|
||||
return NULL;
|
||||
else
|
||||
return *itr;
|
||||
}
|
||||
|
||||
SRenderPass* CDynMaterial::getPass( uint32 i )
|
||||
{
|
||||
if( i >= passes.size() )
|
||||
return NULL;
|
||||
else
|
||||
return passes[ i ];
|
||||
}
|
||||
|
||||
void CDynMaterial::getPassList( std::vector< std::string > &l )
|
||||
{
|
||||
std::vector< SRenderPass* >::iterator itr = passes.begin();
|
||||
while( itr != passes.end() )
|
||||
{
|
||||
std::string name;
|
||||
|
||||
(*itr)->getName( name );
|
||||
l.push_back( name );
|
||||
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,102 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "nel/3d/shape_material_serializer.h"
|
||||
#include "nel/3d/shape.h"
|
||||
#include "nel/3d/material.h"
|
||||
#include "nel/3d/dynamic_material.h"
|
||||
#include "nel/3d/mesh_base.h"
|
||||
#include "nel/misc/file.h"
|
||||
#include "nel/misc/o_xml.h"
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
ShapeMatSerial::ShapeMatSerial()
|
||||
{
|
||||
shape = NULL;
|
||||
}
|
||||
|
||||
ShapeMatSerial::~ShapeMatSerial()
|
||||
{
|
||||
shape = NULL;
|
||||
}
|
||||
|
||||
void ShapeMatSerial::serial( const char *sPath )
|
||||
{
|
||||
if( shape == NULL )
|
||||
return;
|
||||
|
||||
nlinfo( "Exporting materials of %s", sPath );
|
||||
|
||||
std::string path = sPath;
|
||||
std::string fname;
|
||||
std::string::size_type idx;
|
||||
|
||||
idx = path.find_last_of( '.' );
|
||||
path = path.substr( 0, idx );
|
||||
|
||||
CMeshBase *mb = dynamic_cast< CMeshBase* >( shape );
|
||||
if( mb != NULL )
|
||||
{
|
||||
uint n = mb->getNbMaterial();
|
||||
nlinfo( "exporting %u materials", n );
|
||||
|
||||
for( int i = 0; i < n; i++ )
|
||||
{
|
||||
CMaterial &m = mb->getMaterial( i );
|
||||
CDynMaterial *dm = m.getDynMat();
|
||||
if( dm == NULL )
|
||||
{
|
||||
m.createDynMat();
|
||||
dm = m.getDynMat();
|
||||
}
|
||||
|
||||
fname = path + "_";
|
||||
fname += char( '0' + i );
|
||||
fname += ".nelmat";
|
||||
|
||||
nlinfo( "exporting to %s", fname.c_str() );
|
||||
|
||||
NLMISC::COFile o;
|
||||
if( o.open( fname ) )
|
||||
{
|
||||
NLMISC::COXml xml;
|
||||
if( xml.init( &o ) )
|
||||
{
|
||||
dm->serial( xml );
|
||||
xml.flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
nlerror( "Error initializing XML output stream for %s", fname.c_str() );
|
||||
}
|
||||
o.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
nlerror( "Error creating file %s", fname.c_str() );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,74 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "nel/3d/usr_shader_loader.h"
|
||||
#include "nel/3d/usr_shader_manager.h"
|
||||
#include "nel/3d/usr_shader_program.h"
|
||||
#include "nel/misc/file.h"
|
||||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/i_xml.h"
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
CUsrShaderLoader::CUsrShaderLoader()
|
||||
{
|
||||
manager = NULL;
|
||||
}
|
||||
|
||||
CUsrShaderLoader::~CUsrShaderLoader()
|
||||
{
|
||||
}
|
||||
|
||||
void CUsrShaderLoader::loadShaders( const std::string &directory )
|
||||
{
|
||||
if( manager == NULL )
|
||||
return;
|
||||
|
||||
std::vector< std::string > files;
|
||||
|
||||
NLMISC::CPath::getPathContent( directory, true, false, true, files );
|
||||
|
||||
std::vector< std::string >::iterator itr = files.begin();
|
||||
while( itr != files.end() )
|
||||
{
|
||||
if( NLMISC::CFile::getExtension( *itr ) == "nlshdr" )
|
||||
{
|
||||
loadShader( *itr );
|
||||
}
|
||||
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
void CUsrShaderLoader::loadShader( const std::string &file )
|
||||
{
|
||||
NLMISC::CIFile f;
|
||||
if( !f.open( file, true ) )
|
||||
return;
|
||||
|
||||
NLMISC::CIXml xml;
|
||||
if( !xml.init( f ) )
|
||||
return;
|
||||
|
||||
CUsrShaderProgram *p = new CUsrShaderProgram();
|
||||
p->serial( xml );
|
||||
manager->addShader( p );
|
||||
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,157 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "nel/3d/usr_shader_manager.h"
|
||||
#include "nel/3d/usr_shader_program.h"
|
||||
#include "nel/3d/usr_shader_visitor.h"
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
CUsrShaderManager::CUsrShaderManager()
|
||||
{
|
||||
}
|
||||
|
||||
CUsrShaderManager::~CUsrShaderManager()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
void CUsrShaderManager::clear()
|
||||
{
|
||||
std::map< std::string, CUsrShaderProgram* >::iterator itr = programs.begin();
|
||||
while( itr != programs.end() )
|
||||
{
|
||||
delete itr->second;
|
||||
++itr;
|
||||
}
|
||||
programs.clear();
|
||||
}
|
||||
|
||||
void CUsrShaderManager::getShaderList( std::vector< std::string > &v )
|
||||
{
|
||||
v.clear();
|
||||
|
||||
std::string n;
|
||||
std::map< std::string, CUsrShaderProgram* >::iterator itr = programs.begin();
|
||||
while( itr != programs.end() )
|
||||
{
|
||||
itr->second->getName( n );
|
||||
v.push_back( n );
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
bool CUsrShaderManager::addShader( CUsrShaderProgram *program )
|
||||
{
|
||||
std::string n;
|
||||
program->getName( n );
|
||||
|
||||
std::map< std::string, CUsrShaderProgram* >::iterator itr
|
||||
= programs.find( n );
|
||||
if( itr != programs.end() )
|
||||
return false;
|
||||
|
||||
programs[ n ] = program;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CUsrShaderManager::removeShader( const std::string &name )
|
||||
{
|
||||
std::map< std::string, CUsrShaderProgram* >::iterator itr
|
||||
= programs.find( name );
|
||||
if( itr == programs.end() )
|
||||
return false;
|
||||
|
||||
delete itr->second;
|
||||
itr->second = NULL;
|
||||
programs.erase( itr );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CUsrShaderManager::changeShader( const std::string &name, CUsrShaderProgram *program )
|
||||
{
|
||||
std::map< std::string, CUsrShaderProgram* >::iterator itr
|
||||
= programs.find( name );
|
||||
if( itr == programs.end() )
|
||||
return false;
|
||||
|
||||
CUsrShaderProgram *p = itr->second;
|
||||
std::string s;
|
||||
|
||||
program->getName( s );
|
||||
p->setName( s );
|
||||
|
||||
program->getDescription( s );
|
||||
p->setDescription( s );
|
||||
|
||||
program->getVP( s );
|
||||
p->setVP( s );
|
||||
|
||||
program->getFP( s );
|
||||
p->setFP( s );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CUsrShaderManager::getShader( const std::string &name, CUsrShaderProgram *program )
|
||||
{
|
||||
std::map< std::string, CUsrShaderProgram* >::iterator itr
|
||||
= programs.find( name );
|
||||
if( itr == programs.end() )
|
||||
return false;
|
||||
|
||||
CUsrShaderProgram *p = itr->second;
|
||||
std::string s;
|
||||
|
||||
program->setName( name );
|
||||
|
||||
p->getDescription( s );
|
||||
program->setDescription( s );
|
||||
|
||||
p->getVP( s );
|
||||
program->setVP( s );
|
||||
|
||||
p->getFP( s );
|
||||
program->setFP( s );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CUsrShaderManager::visitShaders( IUsrShaderVisitor *visitor )
|
||||
{
|
||||
std::map< std::string, CUsrShaderProgram* >::iterator itr = programs.begin();
|
||||
while( itr != programs.end() )
|
||||
{
|
||||
visitor->visit( itr->second );
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
void CUsrShaderManager::visitShader( const std::string &name, IUsrShaderVisitor *visitor )
|
||||
{
|
||||
std::map< std::string, CUsrShaderProgram* >::iterator itr =
|
||||
programs.find( name );
|
||||
if( itr == programs.end() )
|
||||
return;
|
||||
|
||||
visitor->visit( itr->second );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,59 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "nel/3d/usr_shader_program.h"
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
CUsrShaderProgram::CUsrShaderProgram()
|
||||
{
|
||||
vpId = 0;
|
||||
fpId = 0;
|
||||
pId = 0;
|
||||
}
|
||||
|
||||
CUsrShaderProgram::~CUsrShaderProgram()
|
||||
{
|
||||
}
|
||||
|
||||
void CUsrShaderProgram::serial( NLMISC::IStream &f )
|
||||
{
|
||||
f.xmlPush( "ShaderProgram" );
|
||||
|
||||
int version = f.serialVersion( 1 );
|
||||
|
||||
f.xmlPush( "Name" );
|
||||
f.serial( name );
|
||||
f.xmlPop();
|
||||
|
||||
f.xmlPush( "Description" );
|
||||
f.serial( description );
|
||||
f.xmlPop();
|
||||
|
||||
f.xmlPush( "VertexProgram" );
|
||||
f.serial( vertexProgram );
|
||||
f.xmlPop();
|
||||
|
||||
f.xmlPush( "FragmentProgram" );
|
||||
f.serial( fragmentProgram );
|
||||
f.xmlPop();
|
||||
|
||||
f.xmlPop();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,71 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "nel/3d/usr_shader_saver.h"
|
||||
#include "nel/3d/usr_shader_manager.h"
|
||||
#include "nel/3d/usr_shader_program.h"
|
||||
#include "nel/misc/file.h"
|
||||
#include "nel/misc/o_xml.h"
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
CUsrShaderSaver::CUsrShaderSaver()
|
||||
{
|
||||
manager = NULL;
|
||||
}
|
||||
|
||||
CUsrShaderSaver::~CUsrShaderSaver()
|
||||
{
|
||||
}
|
||||
|
||||
void CUsrShaderSaver::visit( CUsrShaderProgram *program )
|
||||
{
|
||||
std::string fn;
|
||||
program->getName( fn );
|
||||
fn += ".nlshdr";
|
||||
|
||||
fn = outputDir + "/" + fn;
|
||||
|
||||
NLMISC::COFile of;
|
||||
if( !of.open( fn, false, true ) )
|
||||
return;
|
||||
|
||||
NLMISC::COXml xml;
|
||||
if( !xml.init( &of ) )
|
||||
return;
|
||||
|
||||
program->serial( xml );
|
||||
|
||||
xml.flush();
|
||||
of.close();
|
||||
|
||||
}
|
||||
|
||||
void CUsrShaderSaver::saveShaders( const std::string &directory )
|
||||
{
|
||||
outputDir = directory;
|
||||
manager->visitShaders( this );
|
||||
}
|
||||
|
||||
void CUsrShaderSaver::saveShader( const std::string &directory, const std::string &name )
|
||||
{
|
||||
outputDir = directory;
|
||||
manager->visitShader( name, this );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,320 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "nel/misc/variant.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
CVariant::CVariant()
|
||||
{
|
||||
std::fill( uvalue.vval, uvalue.vval + VARIANT_VVAL_END, 0.0f );
|
||||
type = String;
|
||||
}
|
||||
|
||||
CVariant::~CVariant()
|
||||
{
|
||||
}
|
||||
|
||||
void CVariant::serial( IStream &f )
|
||||
{
|
||||
uint v = f.serialVersion( 1 );
|
||||
|
||||
f.xmlPush( "type" );
|
||||
|
||||
if( !f.isReading() )
|
||||
{
|
||||
uint t = type;
|
||||
f.serial( t );
|
||||
}
|
||||
else
|
||||
{
|
||||
uint t;
|
||||
f.serial( t );
|
||||
type = EVarType( t );
|
||||
}
|
||||
|
||||
f.xmlPop();
|
||||
|
||||
f.xmlPush( "value" );
|
||||
|
||||
switch( type )
|
||||
{
|
||||
case Double:
|
||||
{
|
||||
f.serial( uvalue.dval );
|
||||
break;
|
||||
}
|
||||
|
||||
case Float:
|
||||
{
|
||||
f.serial( uvalue.fval );
|
||||
break;
|
||||
}
|
||||
|
||||
case Int:
|
||||
{
|
||||
f.serial( uvalue.ival );
|
||||
break;
|
||||
}
|
||||
|
||||
case UInt:
|
||||
{
|
||||
f.serial( uvalue.uval );
|
||||
break;
|
||||
}
|
||||
|
||||
case String:
|
||||
{
|
||||
f.serial( sval );
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if( !f.isReading() )
|
||||
{
|
||||
switch( type )
|
||||
{
|
||||
case Vector4:
|
||||
{
|
||||
float fval;
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
fval = uvalue.vval[ i ];
|
||||
f.serial( fval );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case Matrix4:
|
||||
{
|
||||
float fval;
|
||||
for( int i = 0; i < 16; i++ )
|
||||
{
|
||||
fval = uvalue.vval[ i ];
|
||||
f.serial( fval );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch( type )
|
||||
{
|
||||
|
||||
case Vector4:
|
||||
{
|
||||
float fval;
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
f.serial( fval );
|
||||
uvalue.vval[ i ] = fval;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case Matrix4:
|
||||
{
|
||||
float fval;
|
||||
for( int i = 0; i < 16; i++ )
|
||||
{
|
||||
f.serial( fval );
|
||||
uvalue.vval[ i ] = fval;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
f.xmlPop();
|
||||
}
|
||||
|
||||
void CVariant::setVector4( const float *v )
|
||||
{
|
||||
for( int i = 0; i < 4; i++ )
|
||||
uvalue.vval[ i ] = v[ i ];
|
||||
type = Vector4;
|
||||
}
|
||||
|
||||
void CVariant::setMatrix4( const float *m )
|
||||
{
|
||||
for( int i = 0; i < 16; i++ )
|
||||
uvalue.vval[ i ] = m[ i ];
|
||||
type = Matrix4;
|
||||
}
|
||||
|
||||
void CVariant::getVector4( float *v ) const
|
||||
{
|
||||
for( int i = 0; i < 4; i++ )
|
||||
v[ i ] = uvalue.vval[ i ];
|
||||
}
|
||||
|
||||
void CVariant::getMatrix4( float *m ) const
|
||||
{
|
||||
for( int i = 0; i < 16; i++ )
|
||||
m[ i ] = uvalue.vval[ i ];
|
||||
}
|
||||
|
||||
bool CVariant::valueAsString( std::string &s ) const
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
||||
switch( type )
|
||||
{
|
||||
case Double:
|
||||
{
|
||||
ss << uvalue.dval;
|
||||
s = ss.str();
|
||||
break;
|
||||
}
|
||||
|
||||
case Float:
|
||||
{
|
||||
ss << uvalue.fval;
|
||||
s = ss.str();
|
||||
break;
|
||||
}
|
||||
|
||||
case Int:
|
||||
{
|
||||
ss << uvalue.ival;
|
||||
s = ss.str();
|
||||
break;
|
||||
}
|
||||
|
||||
case UInt:
|
||||
{
|
||||
ss << uvalue.uval;
|
||||
s = ss.str();
|
||||
break;
|
||||
}
|
||||
|
||||
case String:
|
||||
{
|
||||
s = sval;
|
||||
break;
|
||||
}
|
||||
|
||||
case Vector4:
|
||||
{
|
||||
for( int i = 0; i < 4; i++ )
|
||||
ss << uvalue.vval[ i ] << " ";
|
||||
s = ss.str();
|
||||
s.resize( s.size() - 1 );
|
||||
break;
|
||||
}
|
||||
|
||||
case Matrix4:
|
||||
{
|
||||
for( int i = 0; i < 16; i++ )
|
||||
ss << uvalue.vval[ i ] << " ";
|
||||
s = ss.str();
|
||||
s.resize( s.size() - 1 );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CVariant::fromString( const std::string &s, EVarType t )
|
||||
{
|
||||
type = t;
|
||||
sval = "";
|
||||
std::fill( uvalue.vval, uvalue.vval + VARIANT_VVAL_END, 0.0 );
|
||||
|
||||
if( s.empty() )
|
||||
return;
|
||||
|
||||
switch( t )
|
||||
{
|
||||
case Double:
|
||||
{
|
||||
uvalue.dval = strtod( s.c_str(), NULL );
|
||||
break;
|
||||
}
|
||||
|
||||
case Float:
|
||||
{
|
||||
uvalue.fval = strtod( s.c_str(), NULL );
|
||||
break;
|
||||
}
|
||||
|
||||
case Int:
|
||||
{
|
||||
uvalue.ival = strtod( s.c_str(), NULL );
|
||||
break;
|
||||
}
|
||||
|
||||
case UInt:
|
||||
{
|
||||
uvalue.uval = strtod( s.c_str(), NULL );
|
||||
break;
|
||||
}
|
||||
|
||||
case String:
|
||||
{
|
||||
sval = s;
|
||||
break;
|
||||
}
|
||||
|
||||
case Vector4:
|
||||
{
|
||||
std::stringstream ss( s );
|
||||
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
ss >> uvalue.vval[ i ];
|
||||
if( !ss.good() )
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case Matrix4:
|
||||
{
|
||||
std::stringstream ss( s );
|
||||
|
||||
for( int i = 0; i < 16; i++ )
|
||||
{
|
||||
ss >> uvalue.vval[ i ];
|
||||
if( !ss.good() )
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,79 @@
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${QT_INCLUDES}
|
||||
)
|
||||
|
||||
FILE(GLOB SRC *.cpp *.h)
|
||||
|
||||
SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
|
||||
|
||||
SET(OVQT_PLUGIN_MATERIAL_EDITOR_HDR
|
||||
material_editor_context.h
|
||||
material_editor_plugin.h
|
||||
material_editor_window.h
|
||||
material_editor_core_listener.h
|
||||
material_properties.h
|
||||
material_property_editor.h
|
||||
material_widget.h
|
||||
material_splitter.h
|
||||
render_passes.h
|
||||
shader_editor.h
|
||||
shader_widget.h
|
||||
prop_browser_ctrl.h
|
||||
viewport_widget.h
|
||||
fog_widget.h
|
||||
lights_widget.h
|
||||
)
|
||||
|
||||
SET(OVQT_PLUGIN_MATERIAL_EDITOR_UIS
|
||||
material_editor_window.ui
|
||||
material_properties.ui
|
||||
material_property_editor.ui
|
||||
material_widget.ui
|
||||
render_passes.ui
|
||||
shader_editor.ui
|
||||
shader_widget.ui
|
||||
fog_widget.ui
|
||||
lights_widget.ui
|
||||
)
|
||||
|
||||
SET(QT_USE_QTGUI TRUE)
|
||||
SET(QT_USE_QTOPENGL TRUE)
|
||||
|
||||
QT4_ADD_RESOURCES(OVQT_PLUGIN_MATERIAL_EDITOR_RC_SRCS ${OVQT_PLUGIN_MATERIAL_EDITOR_RCS})
|
||||
QT4_WRAP_CPP(OVQT_PLUGIN_MATERIAL_EDITOR_MOC_SRC ${OVQT_PLUGIN_MATERIAL_EDITOR_HDR})
|
||||
QT4_WRAP_UI(OVQT_PLUGIN_MATERIAL_EDITOR_UI_HDRS ${OVQT_PLUGIN_MATERIAL_EDITOR_UIS})
|
||||
|
||||
SOURCE_GROUP(QtResources FILES ${OVQT_PLUGIN_MATERIAL_EDITOR_UIS})
|
||||
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUGIN_MATERIAL_EDITOR_UI_HDRS})
|
||||
SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${OVQT_PLUGIN_MATERIAL_EDITOR_MOC_SRC} OVQT_PLUGIN_MATERIAL_EDITOR_RC_SRCS)
|
||||
SOURCE_GROUP("Material Editor Plugin" FILES ${SRC})
|
||||
SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
|
||||
|
||||
ADD_LIBRARY(ovqt_plugin_material_editor MODULE ${SRC}
|
||||
${OVQT_PLUGIN_MATERIAL_EDITOR_MOC_SRC}
|
||||
${OVQT_EXT_SYS_SRC}
|
||||
${OVQT_PLUGIN_MATERIAL_EDITOR_UI_HDRS}
|
||||
${OVQT_PLUGIN_MATERIAL_EDITOR_RC_SRCS}
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(
|
||||
ovqt_plugin_material_editor
|
||||
ovqt_plugin_core
|
||||
qt_property_browser
|
||||
nelmisc
|
||||
nel3d
|
||||
${QT_LIBRARIES}
|
||||
${QT_QTOPENGL_LIBRARY}
|
||||
)
|
||||
|
||||
NL_DEFAULT_PROPS(ovqt_plugin_material_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Material Editor")
|
||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_material_editor)
|
||||
NL_ADD_LIB_SUFFIX(ovqt_plugin_material_editor)
|
||||
|
||||
ADD_DEFINITIONS(-DMATERIAL_EDITOR_LIBRARY -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
|
||||
|
||||
INSTALL(TARGETS ovqt_plugin_material_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,116 @@
|
||||
// Object Viewer Qt Material Editor plugin <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "fog_widget.h"
|
||||
#include "nel3d_interface.h"
|
||||
#include <QColorDialog>
|
||||
|
||||
namespace MaterialEditor
|
||||
{
|
||||
FogWidget::FogWidget( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
iface = NULL;
|
||||
setupUi( this );
|
||||
setupConnections();
|
||||
}
|
||||
|
||||
FogWidget::~FogWidget()
|
||||
{
|
||||
iface = NULL;
|
||||
}
|
||||
|
||||
void FogWidget::loadValues()
|
||||
{
|
||||
SFogSettings s;
|
||||
iface->getFogSettings( s );
|
||||
|
||||
fogCB->setChecked( s.enable );
|
||||
startSB->setValue( s.start );
|
||||
endSB->setValue( s.end );
|
||||
setColorButtonColor( s.color[ 0 ], s.color[ 1 ], s.color[ 2 ] );
|
||||
}
|
||||
|
||||
void FogWidget::setupConnections()
|
||||
{
|
||||
connect( fogCB, SIGNAL( clicked( bool ) ), this, SLOT( onFogCBClicked() ) );
|
||||
connect( startSB, SIGNAL( valueChanged( double ) ), this, SLOT( onStartSBChanged() ) );
|
||||
connect( endSB, SIGNAL( valueChanged( double ) ), this, SLOT( onEndSBChanged() ) );
|
||||
connect( colorButton, SIGNAL( clicked( bool ) ), this, SLOT( onColorButtonClicked() ) );
|
||||
}
|
||||
|
||||
void FogWidget::onFogCBClicked()
|
||||
{
|
||||
SFogSettings s;
|
||||
iface->getFogSettings( s );
|
||||
|
||||
s.enable = fogCB->isChecked();
|
||||
|
||||
iface->setFogSettings( s );
|
||||
|
||||
if( !s.enable )
|
||||
iface->setBGColor( 255, 255, 255, 255 );
|
||||
}
|
||||
|
||||
void FogWidget::onStartSBChanged()
|
||||
{
|
||||
SFogSettings s;
|
||||
iface->getFogSettings( s );
|
||||
|
||||
s.start = startSB->value();
|
||||
|
||||
iface->setFogSettings( s );
|
||||
}
|
||||
|
||||
void FogWidget::onEndSBChanged()
|
||||
{
|
||||
SFogSettings s;
|
||||
iface->getFogSettings( s );
|
||||
|
||||
s.end = endSB->value();
|
||||
|
||||
iface->setFogSettings( s );
|
||||
}
|
||||
|
||||
void FogWidget::onColorButtonClicked()
|
||||
{
|
||||
QColor c = QColorDialog::getColor();
|
||||
|
||||
setColorButtonColor( c.red(), c.green(), c.blue() );
|
||||
|
||||
SFogSettings s;
|
||||
iface->getFogSettings( s );
|
||||
|
||||
s.color[ 0 ] = c.red();
|
||||
s.color[ 1 ] = c.green();
|
||||
s.color[ 2 ] = c.blue();
|
||||
s.color[ 3 ] = 255;
|
||||
|
||||
iface->setFogSettings( s );
|
||||
}
|
||||
|
||||
void FogWidget::setColorButtonColor( int r, int g, int b )
|
||||
{
|
||||
QString sh;
|
||||
sh = QString( "background-color: rgb(%1, %2, %3);" ).arg( r ).arg( g ).arg( b );
|
||||
colorButton->setStyleSheet( sh );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
// Object Viewer Qt Material Editor plugin <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef FOG_WIDGET_H
|
||||
#define FOG_WIDGET_H
|
||||
|
||||
#include "ui_fog_widget.h"
|
||||
|
||||
namespace MaterialEditor
|
||||
{
|
||||
class CNel3DInterface;
|
||||
|
||||
class FogWidget : public QWidget, public Ui::FogWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FogWidget( QWidget *parent = NULL );
|
||||
~FogWidget();
|
||||
|
||||
void loadValues();
|
||||
|
||||
void setNl3DIface( CNel3DInterface *iface ){ this->iface = iface; }
|
||||
|
||||
private Q_SLOTS:
|
||||
void onFogCBClicked();
|
||||
void onStartSBChanged();
|
||||
void onEndSBChanged();
|
||||
void onColorButtonClicked();
|
||||
|
||||
private:
|
||||
void setupConnections();
|
||||
void setColorButtonColor( int r, int g, int b );
|
||||
|
||||
|
||||
CNel3DInterface *iface;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FogWidget</class>
|
||||
<widget class="QWidget" name="FogWidget">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>278</width>
|
||||
<height>116</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Fog settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="fogCB">
|
||||
<property name="text">
|
||||
<string>Enable fog</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="startSB"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>End</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="endSB"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="colorButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -0,0 +1,270 @@
|
||||
// Object Viewer Qt Material Editor plugin <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "lights_widget.h"
|
||||
#include <QColorDialog>
|
||||
#include "nel3d_interface.h"
|
||||
|
||||
namespace MaterialEditor
|
||||
{
|
||||
enum LWLightTypes
|
||||
{
|
||||
DIRECTIONAL,
|
||||
POINT,
|
||||
SPOT
|
||||
};
|
||||
|
||||
enum LWColorButton
|
||||
{
|
||||
AMBIENT,
|
||||
DIFFUSE,
|
||||
SPECULAR
|
||||
};
|
||||
|
||||
void LightsWidget::setButtonColor( unsigned char butt, int r, int g, int b )
|
||||
{
|
||||
QString sh;
|
||||
QPushButton *button;
|
||||
|
||||
if( butt > SPECULAR )
|
||||
return;
|
||||
|
||||
switch( butt )
|
||||
{
|
||||
case AMBIENT:
|
||||
button = ambientButton;
|
||||
break;
|
||||
|
||||
case DIFFUSE:
|
||||
button = diffuseButton;
|
||||
break;
|
||||
|
||||
case SPECULAR:
|
||||
button = specularButton;
|
||||
break;
|
||||
}
|
||||
|
||||
sh = QString( "background-color: rgb(%1, %2, %3);" ).arg( r ).arg( g ).arg( b );
|
||||
button->setStyleSheet( sh );
|
||||
|
||||
buttonColors[ butt ][ 0 ] = r;
|
||||
buttonColors[ butt ][ 1 ] = g;
|
||||
buttonColors[ butt ][ 2 ] = b;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LightsWidget::LightsWidget( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
setupConnections();
|
||||
|
||||
typeCB->addItem( "Directional light" );
|
||||
typeCB->addItem( "Point light" );
|
||||
typeCB->addItem( "Spot light" );
|
||||
}
|
||||
|
||||
LightsWidget::~LightsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void LightsWidget::loadValues()
|
||||
{
|
||||
disableChangeConnections();
|
||||
|
||||
unsigned char c = iface->getMaxLights();
|
||||
|
||||
lightList->clear();
|
||||
|
||||
for( unsigned char i = 0; i < c; i++ )
|
||||
{
|
||||
QString s = "light";
|
||||
s += QString::number( i );
|
||||
lightList->addItem( s );
|
||||
}
|
||||
|
||||
lightList->setCurrentRow( 0 );
|
||||
loadLight( 0 );
|
||||
|
||||
// loadLight enables it anyways
|
||||
//setupChangeConnections();
|
||||
}
|
||||
|
||||
void LightsWidget::setupConnections()
|
||||
{
|
||||
}
|
||||
|
||||
void LightsWidget::setupChangeConnections()
|
||||
{
|
||||
connect( enableCB, SIGNAL( toggled( bool ) ), this, SLOT( onChanges() ) );
|
||||
connect( ambientButton, SIGNAL( clicked( bool ) ), this, SLOT( onAmbButtonClicked() ) );
|
||||
connect( diffuseButton, SIGNAL( clicked( bool ) ), this, SLOT( onDiffButtonClicked() ) );
|
||||
connect( specularButton, SIGNAL( clicked( bool ) ), this, SLOT( onSpecButtonClicked() ) );
|
||||
connect( lightList, SIGNAL( currentRowChanged( int ) ), this, SLOT( onLightChanged( int ) ) );
|
||||
|
||||
connect( typeCB, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onChanges() ) );
|
||||
connect( xSB, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) );
|
||||
connect( ySB, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) );
|
||||
connect( zSB, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) );
|
||||
connect( constAttnButton, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) );
|
||||
connect( linearAttnButton, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) );
|
||||
connect( quadAttnButton, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) );
|
||||
}
|
||||
|
||||
void LightsWidget::disableChangeConnections()
|
||||
{
|
||||
disconnect( enableCB, SIGNAL( toggled( bool ) ), this, SLOT( onChanges() ) );
|
||||
disconnect( ambientButton, SIGNAL( clicked( bool ) ), this, SLOT( onAmbButtonClicked() ) );
|
||||
disconnect( diffuseButton, SIGNAL( clicked( bool ) ), this, SLOT( onDiffButtonClicked() ) );
|
||||
disconnect( specularButton, SIGNAL( clicked( bool ) ), this, SLOT( onSpecButtonClicked() ) );
|
||||
disconnect( lightList, SIGNAL( currentRowChanged( int ) ), this, SLOT( onLightChanged( int ) ) );
|
||||
|
||||
disconnect( typeCB, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onChanges() ) );
|
||||
disconnect( xSB, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) );
|
||||
disconnect( ySB, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) );
|
||||
disconnect( zSB, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) );
|
||||
disconnect( constAttnButton, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) );
|
||||
disconnect( linearAttnButton, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) );
|
||||
disconnect( quadAttnButton, SIGNAL( valueChanged( double ) ), this, SLOT( onChanges() ) );
|
||||
}
|
||||
|
||||
void LightsWidget::onAmbButtonClicked()
|
||||
{
|
||||
QColor c = QColorDialog::getColor();
|
||||
setButtonColor( AMBIENT, c.red(), c.green(), c.blue() );
|
||||
applyChanges();
|
||||
}
|
||||
|
||||
void LightsWidget::onDiffButtonClicked()
|
||||
{
|
||||
QColor c = QColorDialog::getColor();
|
||||
setButtonColor( DIFFUSE, c.red(), c.green(), c.blue() );
|
||||
applyChanges();
|
||||
}
|
||||
|
||||
void LightsWidget::onSpecButtonClicked()
|
||||
{
|
||||
QColor c = QColorDialog::getColor();
|
||||
setButtonColor( SPECULAR, c.red(), c.green(), c.blue() );
|
||||
applyChanges();
|
||||
}
|
||||
|
||||
void LightsWidget::onLightChanged( int light )
|
||||
{
|
||||
loadLight( light );
|
||||
}
|
||||
|
||||
void LightsWidget::onChanges()
|
||||
{
|
||||
applyChanges();
|
||||
}
|
||||
|
||||
void LightsWidget::loadLight( unsigned char light )
|
||||
{
|
||||
disableChangeConnections();
|
||||
|
||||
SLightInfo info;
|
||||
iface->getLightInfo( light, info );
|
||||
|
||||
if( info.enabled )
|
||||
enableCB->setChecked( true );
|
||||
else
|
||||
enableCB->setChecked( false );
|
||||
|
||||
switch( info.type )
|
||||
{
|
||||
case SLightInfo::Directional:
|
||||
typeCB->setCurrentIndex( DIRECTIONAL );
|
||||
break;
|
||||
case SLightInfo::Point:
|
||||
typeCB->setCurrentIndex( POINT );
|
||||
break;
|
||||
case SLightInfo::Spot:
|
||||
typeCB->setCurrentIndex( SPOT );
|
||||
break;
|
||||
}
|
||||
|
||||
xSB->setValue( info.posOrDir[ 0 ] );
|
||||
ySB->setValue( info.posOrDir[ 1 ] );
|
||||
zSB->setValue( info.posOrDir[ 2 ] );
|
||||
|
||||
constAttnButton->setValue( info.constAttn );
|
||||
linearAttnButton->setValue( info.linAttn );
|
||||
quadAttnButton->setValue( info.quadAttn );
|
||||
|
||||
setButtonColor( AMBIENT, info.ambColor[ 0 ] * 255.0f,
|
||||
info.ambColor[ 1 ] * 255.0f,
|
||||
info.ambColor[ 2 ] * 255.0f );
|
||||
|
||||
setButtonColor( DIFFUSE, info.diffColor[ 0 ] * 255.0f,
|
||||
info.diffColor[ 1 ] * 255.0f,
|
||||
info.diffColor[ 2 ] * 255.0f );
|
||||
|
||||
setButtonColor( SPECULAR, info.specColor[ 0 ] * 255.0f,
|
||||
info.specColor[ 1 ] * 255.0f,
|
||||
info.specColor[ 2 ] * 255.0f );
|
||||
|
||||
setupChangeConnections();
|
||||
}
|
||||
|
||||
void LightsWidget::saveLight( unsigned char light )
|
||||
{
|
||||
SLightInfo info;
|
||||
|
||||
info.enabled = enableCB->isChecked();
|
||||
switch( typeCB->currentIndex() )
|
||||
{
|
||||
case DIRECTIONAL:
|
||||
info.type = SLightInfo::Directional;
|
||||
break;
|
||||
case POINT:
|
||||
info.type = SLightInfo::Point;
|
||||
break;
|
||||
case SPOT:
|
||||
info.type = SLightInfo::Spot;
|
||||
break;
|
||||
}
|
||||
|
||||
info.posOrDir[ 0 ] = static_cast< float >( xSB->value() );
|
||||
info.posOrDir[ 1 ] = static_cast< float >( ySB->value() );
|
||||
info.posOrDir[ 2 ] = static_cast< float >( zSB->value() );
|
||||
|
||||
info.constAttn = static_cast< float >( constAttnButton->value() );
|
||||
info.linAttn = static_cast< float >( linearAttnButton->value() );
|
||||
info.quadAttn = static_cast< float >( quadAttnButton->value() );
|
||||
|
||||
info.ambColor[ 0 ] = buttonColors[ AMBIENT ][ 0 ] / 255.0f;
|
||||
info.ambColor[ 1 ] = buttonColors[ AMBIENT ][ 1 ] / 255.0f;
|
||||
info.ambColor[ 2 ] = buttonColors[ AMBIENT ][ 2 ] / 255.0f;
|
||||
info.diffColor[ 0 ] = buttonColors[ DIFFUSE ][ 0 ] / 255.0f;
|
||||
info.diffColor[ 1 ] = buttonColors[ DIFFUSE ][ 1 ] / 255.0f;
|
||||
info.diffColor[ 2 ] = buttonColors[ DIFFUSE ][ 2 ] / 255.0f;
|
||||
info.specColor[ 0 ] = buttonColors[ SPECULAR ][ 0 ] / 255.0f;
|
||||
info.specColor[ 1 ] = buttonColors[ SPECULAR ][ 1 ] / 255.0f;
|
||||
info.specColor[ 2 ] = buttonColors[ SPECULAR ][ 2 ] / 255.0f;
|
||||
|
||||
iface->setLightInfo( light, info );
|
||||
}
|
||||
|
||||
void LightsWidget::applyChanges()
|
||||
{
|
||||
int row = lightList->currentRow();
|
||||
saveLight( static_cast< unsigned char >( row ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
// Object Viewer Qt Material Editor plugin <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef LIGHTS_WIDGET_H
|
||||
#define LIGHTS_WIDGET_H
|
||||
|
||||
#include "ui_lights_widget.h"
|
||||
|
||||
namespace MaterialEditor
|
||||
{
|
||||
class CNel3DInterface;
|
||||
|
||||
class LightsWidget : public QWidget, public Ui::LightsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
void setButtonColor( unsigned char butt, int r, int g, int b );
|
||||
|
||||
public:
|
||||
LightsWidget( QWidget *parent = NULL );
|
||||
~LightsWidget();
|
||||
void setNL3DIface( CNel3DInterface *iface ){ this->iface = iface; }
|
||||
void loadValues();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onAmbButtonClicked();
|
||||
void onDiffButtonClicked();
|
||||
void onSpecButtonClicked();
|
||||
void onLightChanged( int light );
|
||||
void onChanges();
|
||||
|
||||
private:
|
||||
void setupConnections();
|
||||
void setupChangeConnections();
|
||||
void disableChangeConnections();
|
||||
void loadLight( unsigned char light );
|
||||
void saveLight( unsigned char light );
|
||||
void applyChanges();
|
||||
|
||||
CNel3DInterface *iface;
|
||||
|
||||
enum LightType
|
||||
{
|
||||
Directional,
|
||||
Point,
|
||||
Spot
|
||||
};
|
||||
|
||||
int buttonColors[ 3 ][ 3 ];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,229 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LightsWidget</class>
|
||||
<widget class="QWidget" name="LightsWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>495</width>
|
||||
<height>434</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Light settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="enableCB">
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
<widget class="QComboBox" name="typeCB">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>99</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Direction or Position</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="xSB">
|
||||
<property name="minimum">
|
||||
<double>-9999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Y</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="ySB">
|
||||
<property name="minimum">
|
||||
<double>-9999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Z</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="zSB">
|
||||
<property name="minimum">
|
||||
<double>-9999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Attenuation</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Constant</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="constAttnButton"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Linear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="linearAttnButton"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Quadratic</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="quadAttnButton"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2" rowspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Ambient</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="ambientButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Diffuse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="diffuseButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Specular</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="specularButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="6">
|
||||
<widget class="QListWidget" name="lightList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue