Merging r5812 through r5842 from trunk to ogl-es branch

Also added some comments to gl-es drivers about missing polygon offset code.
The merges had some changes for that in the OpenGL driver, but both es drivers have no code at all about this.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5889 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2019-10-17 10:23:16 +00:00 committed by MoNTE48
parent 674778e45a
commit 4d9c660504
45 changed files with 3119 additions and 380 deletions

View File

@ -9,6 +9,10 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point)
--------------------------
Changes in 1.9 (not yet released)
- Add operator[] to vector2d and vector3d
- Bugfix: IrrlichtDevice::isWindowMinimized no longer returns true when it's maximized on Windows.
- Ignore degenerated faces in obj file loader when they would generate triangles where 2 vertices use identical indices.
- Add CMatrix4::transformVec4 to transform vectors with 4 elements (thx @ devsh)
- Add ITexture::getOriginalColorFormat to access color format of images used to create a texture
- Add IMemoryReadFile interface which allows direct access to memory block used as file.
- Add IReadFile::getType() interface to all users to find out what kind of class implements that interface.

View File

@ -35,7 +35,7 @@ namespace irr
//! A device which uses Simple DirectMedia Layer
/** The SDL device works under all platforms supported by SDL but first must be compiled
in by defining the IRR_USE_SDL_DEVICE macro in IrrCompileConfig.h */
in by defining the _IRR_COMPILE_WITH_SDL_DEVICE_ macro in IrrCompileConfig.h */
EIDT_SDL,
//! A device for raw framebuffer access

View File

@ -16,7 +16,7 @@ namespace video
//! Is driver able to render to a surface?
EVDF_RENDER_TO_TARGET = 0,
//! Is hardeware transform and lighting supported?
//! Is hardware transform and lighting supported?
EVDF_HARDWARE_TL,
//! Are multiple textures per material possible?

View File

@ -54,7 +54,7 @@ namespace video
//! Like EMT_LIGHTMAP_M2, but also supports dynamic lighting.
EMT_LIGHTMAP_LIGHTING_M2,
//! Like EMT_LIGHTMAP_4, but also supports dynamic lighting.
//! Like EMT_LIGHTMAP_M4, but also supports dynamic lighting.
EMT_LIGHTMAP_LIGHTING_M4,
//! Detail mapped material.

View File

@ -641,8 +641,8 @@ struct SJoystickInfo
u32 Axes;
//! An indication of whether the joystick has a POV hat.
/** A Windows device will identify the presence or absence or the POV hat. A
* Linux device cannot, and will always return POV_HAT_UNKNOWN. */
/** A Windows device will identify the presence or absence of the POV hat.
* A Linux device cannot, and will always return POV_HAT_UNKNOWN. */
enum
{
//! A hat is definitely present.

View File

@ -796,30 +796,30 @@ public:
scripting languages, editors, debuggers or xml deserialization purposes. */
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
setName(in->getAttributeAsString("Name"));
setID(in->getAttributeAsInt("Id"));
setText(in->getAttributeAsStringW("Caption").c_str());
setName(in->getAttributeAsString("Name", Name));
setID(in->getAttributeAsInt("Id", ID));
setText(in->getAttributeAsStringW("Caption", Text).c_str());
setToolTipText(in->getAttributeAsStringW("ToolTip").c_str());
setVisible(in->getAttributeAsBool("Visible"));
setEnabled(in->getAttributeAsBool("Enabled"));
IsTabStop = in->getAttributeAsBool("TabStop");
IsTabGroup = in->getAttributeAsBool("TabGroup");
TabOrder = in->getAttributeAsInt("TabOrder");
setVisible(in->getAttributeAsBool("Visible", IsVisible));
setEnabled(in->getAttributeAsBool("Enabled", IsEnabled));
IsTabStop = in->getAttributeAsBool("TabStop", IsTabStop);
IsTabGroup = in->getAttributeAsBool("TabGroup", IsTabGroup);
TabOrder = in->getAttributeAsInt("TabOrder", TabOrder);
core::position2di p = in->getAttributeAsPosition2d("MaxSize");
core::position2di p = in->getAttributeAsPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height));
setMaxSize(core::dimension2du(p.X,p.Y));
p = in->getAttributeAsPosition2d("MinSize");
p = in->getAttributeAsPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height));
setMinSize(core::dimension2du(p.X,p.Y));
setAlignment((EGUI_ALIGNMENT) in->getAttributeAsEnumeration("LeftAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("RightAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("TopAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("BottomAlign", GUIAlignmentNames));
setAlignment((EGUI_ALIGNMENT) in->getAttributeAsEnumeration("LeftAlign", GUIAlignmentNames, AlignLeft),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("RightAlign", GUIAlignmentNames, AlignRight),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("TopAlign", GUIAlignmentNames, AlignTop),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("BottomAlign", GUIAlignmentNames, AlignBottom));
setRelativePosition(in->getAttributeAsRect("Rect"));
setRelativePosition(in->getAttributeAsRect("Rect", DesiredRect));
setNotClipped(in->getAttributeAsBool("NoClip"));
setNotClipped(in->getAttributeAsBool("NoClip", NoClip));
}
protected:

View File

@ -56,7 +56,7 @@ namespace scene
//! generic skinned mesh
EAMT_SKINNED,
//! generig non-animated mesh
//! generic non-animated mesh
EAMT_STATIC
};

View File

@ -71,12 +71,12 @@ namespace scene
/** This value will never be returned by
ISceneManager::getSceneNodeRenderPass(). The scene manager
will determine by itself if an object is transparent or solid
and register the object as SNRT_TRANSPARENT or SNRT_SOLD
and register the object as ESNRT_TRANSPARENT or ESNRP_SOLID
automatically if you call registerNodeForRendering with this
value (which is default). Note that it will register the node
only as ONE type. If your scene node has both solid and
transparent material types register it twice (one time as
SNRT_SOLID, the other time as SNRT_TRANSPARENT) and in the
ESNRP_SOLID, the other time as ESNRT_TRANSPARENT) and in the
render() method call getSceneNodeRenderPass() to find out the
current render pass and render only the corresponding parts of
the node. */
@ -1085,7 +1085,7 @@ namespace scene
/** \param type: Type of scene node to find (ESNT_ANY will return all child nodes).
\param outNodes: results will be added to this array (outNodes is not cleared).
\param start: Scene node to start from. This node and all children of this scene
node are checked (recursively, so also children of children, etc). If null is specified,
node are checked (recursively, so also children of children, etc). If null is specified,
the root scene node is taken as start-node. */
virtual void getSceneNodesFromType(ESCENE_NODE_TYPE type,
core::array<scene::ISceneNode*>& outNodes,

View File

@ -199,7 +199,7 @@ namespace video
//! All typical anti-alias and smooth modes
EAAM_FULL_BASIC=15,
//! Enhanced anti-aliasing for transparent materials
/** Usually used with EMT_TRANSPARENT_ALPHA_REF and multisampling. */
/** Usually used with EMT_TRANSPARENT_ALPHA_CHANNEL_REF and multisampling. */
EAAM_ALPHA_TO_COVERAGE=16
};
@ -226,8 +226,8 @@ namespace video
ECM_DIFFUSE_AND_AMBIENT
};
//! Flags for the definition of the polygon offset feature
/** These flags define whether the offset should be into the screen, or towards the eye. */
//! DEPRECATED. Will be removed after Irrlicht 1.9.
/** Flags for the definition of the polygon offset feature. These flags define whether the offset should be into the screen, or towards the eye. */
enum E_POLYGON_OFFSET
{
//! Push pixel towards the far plane, away from the eye
@ -250,7 +250,7 @@ namespace video
//! Fine-tuning for SMaterial.ZWriteFineControl
enum E_ZWRITE_FINE_CONTROL
{
//! Default. Only write zbuffer when When SMaterial::ZBuffer is true and SMaterial::isTransparent() returns false.
//! Default. Only write zbuffer when SMaterial::ZBuffer is true and SMaterial::isTransparent() returns false.
EZI_ONLY_NON_TRANSPARENT,
//! Writing will just be based on SMaterial::ZBuffer value, transparency is ignored.
//! Needed mostly for certain shader materials as SMaterial::isTransparent will always return false for those.
@ -266,13 +266,13 @@ namespace video
//! By default this is identical to MATERIAL_MAX_TEXTURES
/** Users can modify this value if they are certain they don't need all
available textures per material in their application. For example if you
available textures per material in their application. For example if you
never need more than 2 textures per material you can set this to 2.
We (mostly) avoid dynamic memory in SMaterial, so the extra memory
will still be allocated. But by lowering MATERIAL_MAX_TEXTURES_USED the
material comparisons and assignments can be faster. Also several other
places in the engine can be faster when reducing this value to the limit
We (mostly) avoid dynamic memory in SMaterial, so the extra memory
will still be allocated. But by lowering MATERIAL_MAX_TEXTURES_USED the
material comparisons and assignments can be faster. Also several other
places in the engine can be faster when reducing this value to the limit
you need.
NOTE: This should only be changed once and before any call to createDevice.
@ -294,6 +294,7 @@ namespace video
ZBuffer(ECFN_LESSEQUAL), AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL),
ColorMaterial(ECM_DIFFUSE), BlendOperation(EBO_NONE), BlendFactor(0.0f),
PolygonOffsetFactor(0), PolygonOffsetDirection(EPO_FRONT),
PolygonOffsetDepthBias(0.f), PolygonOffsetSlopeScale(0.f),
Wireframe(false), PointCloud(false), GouraudShading(true),
Lighting(true), ZWriteEnable(true), BackfaceCulling(true), FrontfaceCulling(false),
FogEnable(false), NormalizeNormals(false), UseMipMaps(true),
@ -350,6 +351,8 @@ namespace video
BlendFactor = other.BlendFactor;
PolygonOffsetFactor = other.PolygonOffsetFactor;
PolygonOffsetDirection = other.PolygonOffsetDirection;
PolygonOffsetDepthBias = other.PolygonOffsetDepthBias;
PolygonOffsetSlopeScale = other.PolygonOffsetSlopeScale;
UseMipMaps = other.UseMipMaps;
ZWriteFineControl = other.ZWriteFineControl;
@ -460,15 +463,36 @@ namespace video
type for this material, this field should be equal to MaterialTypeParam. */
f32 BlendFactor;
//! Factor specifying how far the polygon offset should be made
/** Specifying 0 disables the polygon offset. The direction is specified separately.
The factor can be from 0 to 7.*/
//! DEPRECATED. Will be removed after Irrlicht 1.9. Please use PolygonOffsetDepthBias instead.
/** Factor specifying how far the polygon offset should be made.
Specifying 0 disables the polygon offset. The direction is specified separately.
The factor can be from 0 to 7.
Note: This probably never worked on Direct3D9 (was coded for D3D8 which had different value ranges) */
u8 PolygonOffsetFactor:3;
//! Flag defining the direction the polygon offset is applied to.
/** Can be to front or to back, specified by values from E_POLYGON_OFFSET. */
//! DEPRECATED. Will be removed after Irrlicht 1.9.
/** Flag defining the direction the polygon offset is applied to.
Can be to front or to back, specified by values from E_POLYGON_OFFSET. */
E_POLYGON_OFFSET PolygonOffsetDirection:1;
//! A constant z-buffer offset for a polygon/line/point
/** The range of the value is driver specific.
On OpenGL you get units which are multiplied by the smallest value that is guaranteed to produce a resolvable offset.
On D3D9 you can pass a range between -1 and 1. But you should likely divide it by the range of the depthbuffer.
Like dividing by 65535.0 for a 16 bit depthbuffer. Thought it still might produce too large of a bias.
Some article (https://aras-p.info/blog/2008/06/12/depth-bias-and-the-power-of-deceiving-yourself/)
recommends multiplying by 2.0*4.8e-7 (and strangely on both 16 bit and 24 bit). */
f32 PolygonOffsetDepthBias;
//! Variable Z-Buffer offset based on the slope of the polygon.
/** For polygons looking flat at a camera you could use 0 (for example in a 2D game)
But in most cases you will have polygons rendered at a certain slope.
The driver will calculate the slope for you and this value allows to scale that slope.
The complete polygon offset is: PolygonOffsetSlopeScale*slope + PolygonOffsetDepthBias
A good default here is to use 1.f if you want to push the polygons away from the camera
and -1.f to pull them towards the camera. */
f32 PolygonOffsetSlopeScale;
//! Draw as wireframe or filled triangles? Default: false
/** The user can access a material flag using
\code material.Wireframe=true \endcode
@ -484,7 +508,7 @@ namespace video
//! Will this material be lighted? Default: true
bool Lighting:1;
//! Is the zbuffer writeable or is it read-only. Default: true.
//! Is the zbuffer writable or is it read-only. Default: true.
/** This flag is forced to false if the MaterialType is a
transparent type and the scene parameter
ALLOW_ZWRITE_ON_TRANSPARENT is not set. If you set this parameter
@ -635,7 +659,8 @@ namespace video
case EMF_POLYGON_OFFSET:
PolygonOffsetFactor = value?1:0;
PolygonOffsetDirection = EPO_BACK;
break;
PolygonOffsetSlopeScale = value?1.f:0.f;
PolygonOffsetDepthBias = value?1.f:0.f;
default:
break;
}
@ -691,7 +716,7 @@ namespace video
case EMF_BLEND_FACTOR:
return BlendFactor != 0.f;
case EMF_POLYGON_OFFSET:
return PolygonOffsetFactor != 0;
return PolygonOffsetFactor != 0 || PolygonOffsetDepthBias != 0.f;
}
return false;
@ -729,6 +754,8 @@ namespace video
BlendFactor != b.BlendFactor ||
PolygonOffsetFactor != b.PolygonOffsetFactor ||
PolygonOffsetDirection != b.PolygonOffsetDirection ||
PolygonOffsetDepthBias != b.PolygonOffsetDepthBias ||
PolygonOffsetSlopeScale != b.PolygonOffsetSlopeScale ||
UseMipMaps != b.UseMipMaps ||
ZWriteFineControl != b.ZWriteFineControl;
;

View File

@ -68,7 +68,10 @@ namespace video
case EMF_BLEND_FACTOR: material.BlendFactor = Material.BlendFactor; break;
case EMF_POLYGON_OFFSET:
material.PolygonOffsetDirection = Material.PolygonOffsetDirection;
material.PolygonOffsetFactor = Material.PolygonOffsetFactor; break;
material.PolygonOffsetFactor = Material.PolygonOffsetFactor;
material.PolygonOffsetDepthBias = Material.PolygonOffsetDepthBias;
material.PolygonOffsetSlopeScale = Material.PolygonOffsetSlopeScale;
break;
}
}
}

View File

@ -189,6 +189,16 @@ class aabbox3d
{ t=MinEdge.Z; MinEdge.Z = MaxEdge.Z; MaxEdge.Z=t; }
}
// Check if MaxEdge > MinEdge
bool isValid() const
{
if (MinEdge.X > MaxEdge.X) return false;
if (MinEdge.Y > MaxEdge.Y) return false;
if (MinEdge.Z > MaxEdge.Z) return false;
return true;
}
//! Calculates a new interpolated bounding box.
/** d=0 returns other, d=1 returns this, all other values blend between
the two boxes.

View File

@ -251,6 +251,9 @@ namespace core
NOTE: out[3] will be written to (4th vector component)*/
void transformVec3(T *out, const T * in) const;
//! An alternate transform vector method, reading from and writing to an array of 4 floats
void transformVec4(T *out, const T * in) const;
//! Translate a vector by the translation part of this matrix.
/** This operation is performed as if the vector was 4d with the 4th component =1 */
void translateVect( vector3df& vect ) const;
@ -1225,6 +1228,15 @@ namespace core
out[2] = in[0]*M[2] + in[1]*M[6] + in[2]*M[10] + M[14];
}
template <class T>
inline void CMatrix4<T>::transformVec4(T *out, const T * in) const
{
out[0] = in[0]*M[0] + in[1]*M[4] + in[2]*M[8] + in[3]*M[12];
out[1] = in[0]*M[1] + in[1]*M[5] + in[2]*M[9] + in[3]*M[13];
out[2] = in[0]*M[2] + in[1]*M[6] + in[2]*M[10] + in[3]*M[14];
out[3] = in[0]*M[3] + in[1]*M[7] + in[2]*M[11] + in[3]*M[15];
}
//! Transforms a plane by this matrix
template <class T>
@ -1692,9 +1704,9 @@ namespace core
M[8] = 0;
M[9] = 0;
// M[10]
// M[10]
M[11] = 0;
M[12] = 0;
M[13] = 0;
// M[14]
@ -1738,12 +1750,12 @@ namespace core
M[8] = 0;
M[9] = 0;
// M[10]
// M[10]
M[11] = 0;
M[12] = 0;
M[13] = 0;
// M[14]
// M[14]
M[15] = 1;
if ( zClipFromZero )

View File

@ -163,7 +163,7 @@ class quaternion
quaternion& slerp(quaternion q1, quaternion q2,
f32 time, f32 threshold=.05f);
//! Create quaternion from rotation angle and rotation axis.
//! Set this quaternion to represent a rotation from angle and axis.
/** Axis must be unit length.
The quaternion representing the rotation is
q = cos(A/2)+sin(A/2)*(x*i+y*j+z*k).
@ -354,7 +354,7 @@ inline matrix4 quaternion::getMatrix() const
//! Faster method to create a rotation matrix, you should normalize the quaternion before!
inline void quaternion::getMatrixFast( matrix4 &dest) const
{
// TODO:
// TODO:
// gpu quaternion skinning => fast Bones transform chain O_O YEAH!
// http://www.mrelusive.com/publications/papers/SIMD-From-Quaternion-to-Matrix-and-Back.pdf
dest[0] = 1.0f - 2.0f*Y*Y - 2.0f*Z*Z;

View File

@ -64,6 +64,20 @@ public:
vector2d<T> operator/(const T v) const { return vector2d<T>(X / v, Y / v); }
vector2d<T>& operator/=(const T v) { X/=v; Y/=v; return *this; }
T& operator [](u32 index)
{
_IRR_DEBUG_BREAK_IF(index>1) // access violation
return *(&X+index);
}
const T& operator [](u32 index) const
{
_IRR_DEBUG_BREAK_IF(index>1) // access violation
return *(&X+index);
}
//! sort in order X, Y. Equality with rounding tolerance.
bool operator<=(const vector2d<T>&other) const
{

View File

@ -57,6 +57,20 @@ namespace core
vector3d<T> operator/(const T v) const { T i=(T)1.0/v; return vector3d<T>(X * i, Y * i, Z * i); }
vector3d<T>& operator/=(const T v) { T i=(T)1.0/v; X*=i; Y*=i; Z*=i; return *this; }
T& operator [](u32 index)
{
_IRR_DEBUG_BREAK_IF(index>2) // access violation
return *(&X+index);
}
const T& operator [](u32 index) const
{
_IRR_DEBUG_BREAK_IF(index>2) // access violation
return *(&X+index);
}
//! sort in order X, Y, Z. Equality with rounding tolerance.
bool operator<=(const vector3d<T>&other) const
{

View File

@ -2226,9 +2226,16 @@ void CD3D9Driver::setBasicRenderStates(const SMaterial& material, const SMateria
// Polygon offset
if (queryFeature(EVDF_POLYGON_OFFSET) && (resetAllRenderstates ||
lastmaterial.PolygonOffsetDirection != material.PolygonOffsetDirection ||
lastmaterial.PolygonOffsetFactor != material.PolygonOffsetFactor))
lastmaterial.PolygonOffsetFactor != material.PolygonOffsetFactor ||
lastmaterial.PolygonOffsetSlopeScale != material.PolygonOffsetSlopeScale ||
lastmaterial.PolygonOffsetDepthBias != material.PolygonOffsetDepthBias ))
{
if (material.PolygonOffsetFactor)
if ( material.PolygonOffsetSlopeScale || material.PolygonOffsetDepthBias )
{
pID3DDevice->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, F2DW(material.PolygonOffsetSlopeScale));
pID3DDevice->SetRenderState(D3DRS_DEPTHBIAS, F2DW(material.PolygonOffsetDepthBias));
}
else if (material.PolygonOffsetFactor)
{
if (material.PolygonOffsetDirection==EPO_BACK)
{

View File

@ -227,7 +227,7 @@ void CGUIFont::pushTextureCreationFlags(bool(&flags)[3])
Driver->setTextureCreationFlag(video::ETCF_ALLOW_MEMORY_COPY, true);
}
void CGUIFont::popTextureCreationFlags(bool(&flags)[3])
void CGUIFont::popTextureCreationFlags(const bool(&flags)[3])
{
Driver->setTextureCreationFlag(video::ETCF_ALLOW_NON_POWER_2, flags[0]);
Driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, flags[1]);

View File

@ -99,7 +99,7 @@ private:
void setMaxHeight();
void pushTextureCreationFlags(bool(&flags)[3]);
void popTextureCreationFlags(bool(&flags)[3]);
void popTextureCreationFlags(const bool(&flags)[3]);
core::array<SFontArea> Areas;
core::map<wchar_t, s32> CharacterMap;

View File

@ -1439,7 +1439,7 @@ bool CIrrDeviceWin32::isWindowMinimized() const
plc.length=sizeof(WINDOWPLACEMENT);
bool ret=false;
if (GetWindowPlacement(HWnd,&plc))
ret=(plc.showCmd & SW_SHOWMINIMIZED)!=0;
ret = plc.showCmd == SW_SHOWMINIMIZED;
return ret;
}

View File

@ -2180,6 +2180,8 @@ io::IAttributes* CNullDriver::createAttributesFromMaterial(const video::SMateria
attr->addFloat("BlendFactor", material.BlendFactor);
attr->addInt("PolygonOffsetFactor", material.PolygonOffsetFactor);
attr->addEnum("PolygonOffsetDirection", material.PolygonOffsetDirection, video::PolygonOffsetDirectionNames);
attr->addFloat("PolygonOffsetDepthBias", material.PolygonOffsetDepthBias);
attr->addFloat("PolygonOffsetSlopeScale", material.PolygonOffsetSlopeScale);
attr->addInt("ZWriteFineControl", material.ZWriteFineControl);
// TODO: Would be nice to have a flag that only serializes rest of texture data when a texture pointer exists.
@ -2258,6 +2260,8 @@ void CNullDriver::fillMaterialStructureFromAttributes(video::SMaterial& outMater
outMaterial.BlendFactor = attr->getAttributeAsFloat("BlendFactor", outMaterial.BlendFactor);
outMaterial.PolygonOffsetFactor = attr->getAttributeAsInt("PolygonOffsetFactor", outMaterial.PolygonOffsetFactor);
outMaterial.PolygonOffsetDirection = (video::E_POLYGON_OFFSET)attr->getAttributeAsEnumeration("PolygonOffsetDirection", video::PolygonOffsetDirectionNames, outMaterial.PolygonOffsetDirection);
outMaterial.PolygonOffsetDepthBias = attr->getAttributeAsFloat("PolygonOffsetDepthBias", outMaterial.PolygonOffsetDepthBias);
outMaterial.PolygonOffsetSlopeScale = attr->getAttributeAsFloat("PolygonOffsetSlopeScale", outMaterial.PolygonOffsetSlopeScale);
outMaterial.ZWriteFineControl = (video::E_ZWRITE_FINE_CONTROL)attr->getAttributeAsInt("ZWriteFineControl", outMaterial.ZWriteFineControl);
prefix = "BilinearFilter";
if (attr->existsAttribute(prefix.c_str())) // legacy

View File

@ -104,6 +104,7 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
core::array<int> faceCorners;
faceCorners.reallocate(32); // should be large enough
const core::stringc TAG_OFF = "off";
irr::u32 degeneratedFaces = 0;
while(bufPtr != bufEnd)
{
@ -275,12 +276,22 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
}
// triangulate the face
const int c = faceCorners[0];
for ( u32 i = 1; i < faceCorners.size() - 1; ++i )
{
// Add a triangle
currMtl->Meshbuffer->Indices.push_back( faceCorners[i+1] );
currMtl->Meshbuffer->Indices.push_back( faceCorners[i] );
currMtl->Meshbuffer->Indices.push_back( faceCorners[0] );
const int a = faceCorners[i + 1];
const int b = faceCorners[i];
if (a != b && a != c && b != c) // ignore degenerated faces. We can get them when we merge vertices above in the VertMap.
{
currMtl->Meshbuffer->Indices.push_back(a);
currMtl->Meshbuffer->Indices.push_back(b);
currMtl->Meshbuffer->Indices.push_back(c);
}
else
{
++degeneratedFaces;
}
}
}
break;
@ -294,6 +305,14 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
++lineNr;
} // end while(bufPtr && (bufPtr-buf<filesize))
if ( degeneratedFaces > 0 )
{
irr::core::stringc log(degeneratedFaces);
log += " degenerated faces removed in ";
log += irr::core::stringc(fullName);
os::Printer::log(log.c_str(), ELL_INFORMATION);
}
SMesh* mesh = new SMesh();
// Combine all the groups (meshbuffers) into the mesh

View File

@ -1840,6 +1840,8 @@ COGLES2Driver::~COGLES2Driver()
getGLBlend(srcAlphaFact), getGLBlend(dstAlphaFact));
}
// TODO: Polygon Offset. Not sure if it was left out deliberately or if it won't work with this driver.
if (resetAllRenderStates || lastmaterial.Thickness != material.Thickness)
glLineWidth(core::clamp(static_cast<GLfloat>(material.Thickness), DimAliasedLine[0], DimAliasedLine[1]));

View File

@ -1822,6 +1822,8 @@ void COGLES1Driver::setBasicRenderStates(const SMaterial& material, const SMater
}
}
// TODO: Polygon Offset. Not sure if it was left out deliberately or if it won't work with this driver.
// thickness
if (resetAllRenderStates || lastmaterial.Thickness != material.Thickness)
{

View File

@ -86,48 +86,59 @@ void COctreeTriangleSelector::constructOctree(SOctreeNode* node)
node->Box.addInternalPoint(node->Triangles[i].pointC);
}
const core::vector3df& middle = node->Box.getCenter();
core::vector3df edges[8];
node->Box.getEdges(edges);
core::aabbox3d<f32> box;
core::array<core::triangle3df> keepTriangles;
// calculate children
if (!node->Box.isEmpty() && (s32)node->Triangles.size() > MinimalPolysPerNode)
for (s32 ch=0; ch<8; ++ch)
{
box.reset(middle);
box.addInternalPoint(edges[ch]);
node->Child[ch] = new SOctreeNode();
const core::vector3df& middle = node->Box.getCenter();
core::vector3df edges[8];
node->Box.getEdges(edges);
for (s32 i=0; i<(s32)node->Triangles.size(); ++i)
core::aabbox3d<f32> box;
core::array<core::triangle3df> keepTriangles(node->Triangles.size()); // reserving enough memory, so we don't get re-allocations per child
for (s32 ch=0; ch<8; ++ch)
{
if (node->Triangles[i].isTotalInsideBox(box))
box.reset(middle);
box.addInternalPoint(edges[ch]);
node->Child[ch] = new SOctreeNode();
for (s32 i=0; i<(s32)node->Triangles.size(); ++i)
{
node->Child[ch]->Triangles.push_back(node->Triangles[i]);
//node->Triangles.erase(i);
//--i;
if (node->Triangles[i].isTotalInsideBox(box))
{
node->Child[ch]->Triangles.push_back(node->Triangles[i]);
//node->Triangles.erase(i);
//--i;
}
else
{
keepTriangles.push_back(node->Triangles[i]);
}
}
memcpy(node->Triangles.pointer(), keepTriangles.pointer(),
sizeof(core::triangle3df)*keepTriangles.size());
node->Triangles.set_used(keepTriangles.size());
keepTriangles.set_used(0);
}
keepTriangles.clear(); // release memory early, for large meshes it can matter.
node->Triangles.reallocate(node->Triangles.size(), true); // shrink memory to minimum necessary
// Note: We use an extra loop to construct child-nodes instead of doing
// that in above loop to avoid memory fragmentation which happens if
// the code has to switch between allocating memory for this node and
// the child nodes (thanks @Squarefox for noting this).
for (s32 ch=0; ch<8; ++ch)
{
if (node->Child[ch]->Triangles.empty())
{
delete node->Child[ch];
node->Child[ch] = 0;
}
else
{
keepTriangles.push_back(node->Triangles[i]);
}
constructOctree(node->Child[ch]);
}
memcpy(node->Triangles.pointer(), keepTriangles.pointer(),
sizeof(core::triangle3df)*keepTriangles.size());
node->Triangles.set_used(keepTriangles.size());
keepTriangles.set_used(0);
if (node->Child[ch]->Triangles.empty())
{
delete node->Child[ch];
node->Child[ch] = 0;
}
else
constructOctree(node->Child[ch]);
}
}
@ -136,7 +147,7 @@ void COctreeTriangleSelector::constructOctree(SOctreeNode* node)
void COctreeTriangleSelector::getTriangles(core::triangle3df* triangles,
s32 arraySize, s32& outTriangleCount,
const core::aabbox3d<f32>& box,
const core::matrix4* transform, bool useNodeTransform,
const core::matrix4* transform, bool useNodeTransform,
irr::core::array<SCollisionTriangleRange>* outTriangleInfo) const
{
core::matrix4 mat(core::matrix4::EM4CONST_NOTHING);
@ -220,7 +231,7 @@ void COctreeTriangleSelector::getTrianglesFromOctree(
// new version: from user Piraaate
void COctreeTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize,
s32& outTriangleCount, const core::line3d<f32>& line,
const core::matrix4* transform, bool useNodeTransform,
const core::matrix4* transform, bool useNodeTransform,
irr::core::array<SCollisionTriangleRange>* outTriangleInfo) const
{
#if 0

View File

@ -497,6 +497,11 @@ public:
}
}
void getDepthTest(bool& enable)
{
enable = DepthTest;
}
void setDepthTest(bool enable)
{
if (DepthTest != enable)

View File

@ -122,21 +122,23 @@ public:
needSizeUpdate = true;
TOpenGLTexture* currentTexture = (depthStencil && depthStencil->getDriverType() == DriverType) ? static_cast<TOpenGLTexture*>(depthStencil) : 0;
GLuint textureID = 0;
if (currentTexture)
{
if (currentTexture->getType() == ETT_2D)
textureID = currentTexture->getOpenGLTextureName();
else
os::Printer::log("This driver doesn't support depth/stencil to cubemaps.", ELL_WARNING);
}
{
GLuint textureID = currentTexture->getOpenGLTextureName();
const ECOLOR_FORMAT textureFormat = (textureID != 0) ? depthStencil->getColorFormat() : ECF_UNKNOWN;
if (IImage::isDepthFormat(textureFormat))
{
DepthStencil = depthStencil;
DepthStencil->grab();
const ECOLOR_FORMAT textureFormat = (textureID != 0) ? depthStencil->getColorFormat() : ECF_UNKNOWN;
if (IImage::isDepthFormat(textureFormat))
{
DepthStencil = depthStencil;
DepthStencil->grab();
}
}
else
{
os::Printer::log("This driver doesn't support depth/stencil to cubemaps.", ELL_WARNING);
}
}
RequestDepthStencilUpdate = true;

View File

@ -104,8 +104,6 @@ public:
for (u32 i = 0; i < (*tmpImage).size(); ++i)
uploadTexture(true, i, 0, (*tmpImage)[i]->getData());
Driver->getCacheHandler()->getTextureCache().set(0, prevTexture);
bool autoGenerateRequired = true;
for (u32 i = 0; i < (*tmpImage).size(); ++i)
@ -127,6 +125,9 @@ public:
Image.clear();
}
Driver->getCacheHandler()->getTextureCache().set(0, prevTexture);
Driver->testGLError(__LINE__);
}

View File

@ -2612,18 +2612,30 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
// Polygon Offset
if (queryFeature(EVDF_POLYGON_OFFSET) && (resetAllRenderStates ||
lastmaterial.PolygonOffsetDirection != material.PolygonOffsetDirection ||
lastmaterial.PolygonOffsetFactor != material.PolygonOffsetFactor))
lastmaterial.PolygonOffsetFactor != material.PolygonOffsetFactor ||
lastmaterial.PolygonOffsetSlopeScale != material.PolygonOffsetSlopeScale ||
lastmaterial.PolygonOffsetDepthBias != material.PolygonOffsetDepthBias ))
{
glDisable(lastmaterial.Wireframe?GL_POLYGON_OFFSET_LINE:lastmaterial.PointCloud?GL_POLYGON_OFFSET_POINT:GL_POLYGON_OFFSET_FILL);
if (material.PolygonOffsetFactor)
if ( material.PolygonOffsetSlopeScale || material.PolygonOffsetDepthBias )
{
glDisable(material.Wireframe?GL_POLYGON_OFFSET_LINE:material.PointCloud?GL_POLYGON_OFFSET_POINT:GL_POLYGON_OFFSET_FILL);
glEnable(material.Wireframe?GL_POLYGON_OFFSET_LINE:material.PointCloud?GL_POLYGON_OFFSET_POINT:GL_POLYGON_OFFSET_FILL);
glPolygonOffset(material.PolygonOffsetSlopeScale, material.PolygonOffsetDepthBias);
}
else if (material.PolygonOffsetFactor)
{
glEnable(material.Wireframe?GL_POLYGON_OFFSET_LINE:material.PointCloud?GL_POLYGON_OFFSET_POINT:GL_POLYGON_OFFSET_FILL);
if (material.PolygonOffsetDirection==EPO_BACK)
glPolygonOffset(1.0f, (GLfloat)material.PolygonOffsetFactor);
else
glPolygonOffset(-1.0f, (GLfloat)-material.PolygonOffsetFactor);
}
if (material.PolygonOffsetDirection==EPO_BACK)
glPolygonOffset(1.0f, (GLfloat)material.PolygonOffsetFactor);
else
glPolygonOffset(-1.0f, (GLfloat)-material.PolygonOffsetFactor);
{
glPolygonOffset(0.0f, 0.f);
}
}
// thickness

View File

@ -15,6 +15,8 @@ namespace irr
namespace video
{
bool COpenGLExtensionHandler::needsDSAFramebufferHack = true;
COpenGLExtensionHandler::COpenGLExtensionHandler() :
StencilBuffer(false), TextureCompressionExtension(false), MaxLights(1),
MaxAnisotropy(1), MaxUserClipPlanes(0), MaxAuxBuffers(0), MaxIndices(65535),
@ -22,6 +24,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
MaxTextureLODBias(0.f), Version(0), ShaderLanguageVersion(0),
OcclusionQuerySupport(false)
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
,pGlActiveTexture(0)
,pGlActiveTextureARB(0), pGlClientActiveTextureARB(0),
pGlGenProgramsARB(0), pGlGenProgramsNV(0),
pGlBindProgramARB(0), pGlBindProgramNV(0),
@ -57,6 +60,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
pGlCheckFramebufferStatusEXT(0), pGlFramebufferTexture2DEXT(0),
pGlBindRenderbufferEXT(0), pGlDeleteRenderbuffersEXT(0), pGlGenRenderbuffersEXT(0),
pGlRenderbufferStorageEXT(0), pGlFramebufferRenderbufferEXT(0), pGlGenerateMipmapEXT(0),
pGlActiveStencilFaceEXT(0),
// MRTs
pGlDrawBuffersARB(0), pGlDrawBuffersATI(0),
pGlGenBuffersARB(0), pGlBindBufferARB(0), pGlBufferDataARB(0), pGlDeleteBuffersARB(0),
@ -78,7 +82,13 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
pGlEnableIndexedEXT(0), pGlDisableIndexedEXT(0),
pGlColorMaskIndexedEXT(0),
pGlBlendFuncIndexedAMD(0), pGlBlendFunciARB(0), pGlBlendFuncSeparateIndexedAMD(0), pGlBlendFuncSeparateiARB(0),
pGlBlendEquationIndexedAMD(0), pGlBlendEquationiARB(0), pGlBlendEquationSeparateIndexedAMD(0), pGlBlendEquationSeparateiARB(0)
pGlBlendEquationIndexedAMD(0), pGlBlendEquationiARB(0), pGlBlendEquationSeparateIndexedAMD(0), pGlBlendEquationSeparateiARB(0),
// DSA
pGlTextureStorage2D(0), pGlTextureStorage3D(0), pGlTextureSubImage2D(0), pGlNamedFramebufferTexture(0),
pGlTextureParameteri(0), pGlCreateTextures(0), pGlCreateFramebuffers(0), pGlBindTextures(0), pGlGenerateTextureMipmap(0),
// DSA with EXT or functions to simulate it
pGlTextureSubImage2DEXT(0), pGlTextureStorage2DEXT(0), pGlTexStorage2D(0), pGlTextureStorage3DEXT(0),
pGlTexStorage3D(0), pGlNamedFramebufferTextureEXT(0), pGlFramebufferTexture(0), pGlGenerateTextureMipmapEXT(0)
#if defined(GLX_SGI_swap_control)
,pGlxSwapIntervalSGI(0)
#endif
@ -247,7 +257,7 @@ void COpenGLExtensionHandler::dumpFramebufferFormats() const
{
memset(vals,0,sizeof(vals));
#define tmplog(x,y) os::Printer::log(x, core::stringc(y).c_str())
const BOOL res = wglGetPixelFormatAttribiv_ARB(hdc,i,0,nums,atts,vals);
const BOOL res = wglGetPixelFormatAttribiv_ARB(hdc,i,0,(UINT)nums,atts,vals);
if (FALSE==res)
continue;
tmplog("Pixel format ",i);
@ -557,6 +567,26 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
pGlBlendEquationSeparateIndexedAMD = (PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) IRR_OGL_LOAD_EXTENSION("glBlendEquationSeparateIndexedAMD");
pGlBlendEquationSeparateiARB = (PFNGLBLENDEQUATIONSEPARATEIPROC) IRR_OGL_LOAD_EXTENSION("glBlendEquationSeparateiARB");
pGlTextureSubImage2D = (PFNGLTEXTURESUBIMAGE2DPROC)IRR_OGL_LOAD_EXTENSION("glTextureSubImage2D");
pGlTextureStorage2D = (PFNGLTEXTURESTORAGE2DPROC) IRR_OGL_LOAD_EXTENSION("glTextureStorage2D");
pGlTextureStorage3D = (PFNGLTEXTURESTORAGE3DPROC) IRR_OGL_LOAD_EXTENSION("glTextureStorage3D");
pGlNamedFramebufferTexture = (PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) IRR_OGL_LOAD_EXTENSION("glNamedFramebufferTexture");
pGlTextureParameteri = (PFNGLTEXTUREPARAMETERIPROC) IRR_OGL_LOAD_EXTENSION("glTextureParameteri");
pGlCreateTextures = (PFNGLCREATETEXTURESPROC) IRR_OGL_LOAD_EXTENSION("glCreateTextures");
pGlCreateFramebuffers = (PFNGLCREATEFRAMEBUFFERSPROC) IRR_OGL_LOAD_EXTENSION("glCreateFramebuffers");
pGlBindTextures = (PFNGLBINDTEXTURESPROC) IRR_OGL_LOAD_EXTENSION("glBindTextures");
pGlGenerateTextureMipmap = (PFNGLGENERATETEXTUREMIPMAPPROC) IRR_OGL_LOAD_EXTENSION("glGenerateTextureMipmap");
//==============================
pGlTextureSubImage2DEXT = (PFNGLTEXTURESUBIMAGE2DEXTPROC)IRR_OGL_LOAD_EXTENSION("glTextureSubImage2DEXT");
pGlTextureStorage2DEXT = (PFNGLTEXTURESTORAGE2DEXTPROC)IRR_OGL_LOAD_EXTENSION("glTextureStorage2DEXT");
pGlTexStorage2D = (PFNGLTEXSTORAGE2DPROC)IRR_OGL_LOAD_EXTENSION("glTexStorage2D");
pGlTextureStorage3DEXT = (PFNGLTEXTURESTORAGE3DEXTPROC)IRR_OGL_LOAD_EXTENSION("glTextureStorage3DEXT");
pGlTexStorage3D = (PFNGLTEXSTORAGE3DPROC)IRR_OGL_LOAD_EXTENSION("glTexStorage3D");
pGlNamedFramebufferTextureEXT = (PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC)IRR_OGL_LOAD_EXTENSION("glNamedFramebufferTextureEXT");
pGlFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)IRR_OGL_LOAD_EXTENSION("glFramebufferTexture");
pGlActiveTexture = (PFNGLACTIVETEXTUREPROC)IRR_OGL_LOAD_EXTENSION("glActiveTexture");
pGlGenerateTextureMipmapEXT = (PFNGLGENERATETEXTUREMIPMAPEXTPROC) IRR_OGL_LOAD_EXTENSION("glGenerateTextureMipmapEXT");
// get vsync extension
#if defined(WGL_EXT_swap_control) && !defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
pWglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) IRR_OGL_LOAD_EXTENSION("wglSwapIntervalEXT");

View File

@ -1050,6 +1050,11 @@ class COpenGLExtensionHandler
bool OcclusionQuerySupport;
//! Workaround until direct state access with framebuffers is stable enough in drivers
// https://devtalk.nvidia.com/default/topic/1030494/opengl/bug-amp-amp-spec-violation-checknamedframebufferstatus-returns-gl_framebuffer_incomplete_dimensions_ext-under-gl-4-5-core/
// https://stackoverflow.com/questions/51304706/problems-with-attaching-textures-of-different-sizes-to-fbo
static bool needsDSAFramebufferHack;
// public access to the (loaded) extensions.
// general functions
void irrGlActiveTexture(GLenum texture);
@ -1180,6 +1185,17 @@ class COpenGLExtensionHandler
void irrGlBlendEquationIndexed(GLuint buf, GLenum mode);
void irrGlBlendEquationSeparateIndexed(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
void extGlTextureSubImage2D(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);
void extGlTextureStorage2D(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
void extGlTextureStorage3D(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
void extGlNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
void extGlTextureParameteri(GLuint texture, GLenum pname, GLint param);
void extGlCreateTextures(GLenum target, GLsizei n, GLuint* textures);
void extGlCreateFramebuffers(GLsizei n, GLuint* framebuffers);
void extGlBindTextures(GLuint first, GLsizei count, const GLuint *textures, const GLenum* targets);
void extGlGenerateTextureMipmap(GLuint texture, GLenum target);
// generic vsync setting method for several extensions
void extGlSwapInterval(int interval);
@ -1190,6 +1206,7 @@ class COpenGLExtensionHandler
COpenGLCoreFeature Feature;
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
PFNGLACTIVETEXTUREPROC pGlActiveTexture;
PFNGLACTIVETEXTUREARBPROC pGlActiveTextureARB;
PFNGLCLIENTACTIVETEXTUREARBPROC pGlClientActiveTextureARB;
PFNGLGENPROGRAMSARBPROC pGlGenProgramsARB;
@ -1325,6 +1342,27 @@ class COpenGLExtensionHandler
PFNGLBLENDEQUATIONIPROC pGlBlendEquationiARB;
PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC pGlBlendEquationSeparateIndexedAMD;
PFNGLBLENDEQUATIONSEPARATEIPROC pGlBlendEquationSeparateiARB;
// DSA
PFNGLTEXTURESTORAGE2DPROC pGlTextureStorage2D;
PFNGLTEXTURESTORAGE3DPROC pGlTextureStorage3D;
PFNGLTEXTURESUBIMAGE2DPROC pGlTextureSubImage2D;
PFNGLNAMEDFRAMEBUFFERTEXTUREPROC pGlNamedFramebufferTexture;
PFNGLTEXTUREPARAMETERIPROC pGlTextureParameteri;
PFNGLCREATETEXTURESPROC pGlCreateTextures;
PFNGLCREATEFRAMEBUFFERSPROC pGlCreateFramebuffers;
PFNGLBINDTEXTURESPROC pGlBindTextures;
PFNGLGENERATETEXTUREMIPMAPPROC pGlGenerateTextureMipmap;
// DSA with EXT or functions to simulate it
PFNGLTEXTURESUBIMAGE2DEXTPROC pGlTextureSubImage2DEXT;
PFNGLTEXTURESTORAGE2DEXTPROC pGlTextureStorage2DEXT;
PFNGLTEXSTORAGE2DPROC pGlTexStorage2D;
PFNGLTEXTURESTORAGE3DEXTPROC pGlTextureStorage3DEXT;
PFNGLTEXSTORAGE3DPROC pGlTexStorage3D;
PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC pGlNamedFramebufferTextureEXT;
PFNGLFRAMEBUFFERTEXTUREPROC pGlFramebufferTexture;
PFNGLGENERATETEXTUREMIPMAPEXTPROC pGlGenerateTextureMipmapEXT;
#if defined(WGL_EXT_swap_control)
PFNWGLSWAPINTERVALEXTPROC pWglSwapIntervalEXT;
#endif
@ -1343,7 +1381,9 @@ class COpenGLExtensionHandler
inline void COpenGLExtensionHandler::irrGlActiveTexture(GLenum texture)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlActiveTextureARB)
if (pGlActiveTexture)
pGlActiveTexture(texture);
else if (pGlActiveTextureARB)
pGlActiveTextureARB(texture);
#else
#ifdef GL_ARB_multitexture
@ -2688,6 +2728,351 @@ inline void COpenGLExtensionHandler::irrGlBlendEquationSeparateIndexed(GLuint bu
#endif
}
inline void COpenGLExtensionHandler::extGlTextureSubImage2D(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
{
if (Version>=450)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlTextureSubImage2D)
pGlTextureSubImage2D(texture, level, xoffset, yoffset,width, height,format, type, pixels);
#else
glTextureSubImage2D(texture, level, xoffset, yoffset,width, height,format, type, pixels));
#endif // _IRR_OPENGL_USE_EXTPOINTER_
}
else if (FeatureAvailable[IRR_EXT_direct_state_access])
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlTextureSubImage2DEXT)
pGlTextureSubImage2DEXT(texture, target, level, xoffset, yoffset,width, height,format, type, pixels);
#else
glTextureSubImage2DEXT(texture, target, level, xoffset, yoffset,width, height,format, type, pixels));
#endif // _IRR_OPENGL_USE_EXTPOINTER_
}
else
{
GLint bound;
switch (target)
{
case GL_TEXTURE_1D_ARRAY:
glGetIntegerv(GL_TEXTURE_BINDING_1D_ARRAY, &bound);
break;
case GL_TEXTURE_2D:
glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound);
break;
case GL_TEXTURE_2D_MULTISAMPLE:
glGetIntegerv(GL_TEXTURE_BINDING_2D_MULTISAMPLE, &bound);
break;
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, &bound);
break;
case GL_TEXTURE_RECTANGLE:
glGetIntegerv(GL_TEXTURE_BINDING_RECTANGLE, &bound);
break;
default:
return;
}
glBindTexture(target, texture);
glTexSubImage2D(target, level, xoffset, yoffset,width, height,format, type, pixels);
glBindTexture(target, bound);
}
}
inline void COpenGLExtensionHandler::extGlTextureStorage2D(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
{
if (Version>=450)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlTextureStorage2D)
pGlTextureStorage2D(texture,levels,internalformat,width,height);
#else
glTextureStorage2D(texture,levels,internalformat,width,height);
#endif // _IRR_OPENGL_USE_EXTPOINTER_
}
else if (FeatureAvailable[IRR_EXT_direct_state_access])
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlTextureStorage2DEXT)
pGlTextureStorage2DEXT(texture,target,levels,internalformat,width,height);
#else
glTextureStorage2DEXT(texture,target,levels,internalformat,width,height);
#endif // _IRR_OPENGL_USE_EXTPOINTER_
}
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
else if (pGlTexStorage2D)
#else
else
#endif // _IRR_OPENGL_USE_EXTPOINTER_
{
GLint bound;
switch (target)
{
case GL_TEXTURE_1D_ARRAY:
glGetIntegerv(GL_TEXTURE_BINDING_1D_ARRAY, &bound);
break;
case GL_TEXTURE_2D:
glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound);
break;
case GL_TEXTURE_CUBE_MAP:
glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, &bound);
break;
case GL_TEXTURE_RECTANGLE:
glGetIntegerv(GL_TEXTURE_BINDING_RECTANGLE, &bound);
break;
default:
return;
}
glBindTexture(target, texture);
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
pGlTexStorage2D(target,levels,internalformat,width,height);
#else
glTexStorage2D(target,levels,internalformat,width,height);
#endif // _IRR_OPENGL_USE_EXTPOINTER_
glBindTexture(target, bound);
}
}
inline void COpenGLExtensionHandler::extGlTextureStorage3D(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
{
if (Version>=450)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlTextureStorage3D)
pGlTextureStorage3D(texture,levels,internalformat,width,height,depth);
#else
glTextureStorage3D(texture,levels,internalformat,width,height,depth);
#endif // _IRR_OPENGL_USE_EXTPOINTER_
}
else if (FeatureAvailable[IRR_EXT_direct_state_access])
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlTextureStorage3DEXT)
pGlTextureStorage3DEXT(texture,target,levels,internalformat,width,height,depth);
#else
glTextureStorage3DEXT(texture,target,levels,internalformat,width,height,depth);
#endif // _IRR_OPENGL_USE_EXTPOINTER_
}
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
else if (pGlTexStorage3D)
#else
else
#endif // _IRR_OPENGL_USE_EXTPOINTER_
{
GLint bound;
switch (target)
{
case GL_TEXTURE_2D_ARRAY:
glGetIntegerv(GL_TEXTURE_BINDING_2D_ARRAY, &bound);
break;
case GL_TEXTURE_3D:
glGetIntegerv(GL_TEXTURE_BINDING_3D, &bound);
break;
case GL_TEXTURE_CUBE_MAP_ARRAY:
glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP_ARRAY, &bound);
break;
default:
return;
}
glBindTexture(target, texture);
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
pGlTexStorage3D(target,levels,internalformat,width,height,depth);
#else
glTexStorage3D(target,levels,internalformat,width,height,depth);
#endif // _IRR_OPENGL_USE_EXTPOINTER_
glBindTexture(target, bound);
}
}
inline void COpenGLExtensionHandler::extGlNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level)
{
if (!needsDSAFramebufferHack)
{
if (Version>=450)
{
pGlNamedFramebufferTexture(framebuffer, attachment, texture, level);
return;
}
else if (FeatureAvailable[IRR_EXT_direct_state_access])
{
pGlNamedFramebufferTextureEXT(framebuffer, attachment, texture, level);
return;
}
}
GLuint bound;
glGetIntegerv(GL_FRAMEBUFFER_BINDING,reinterpret_cast<GLint*>(&bound));
if (bound!=framebuffer)
pGlBindFramebuffer(GL_FRAMEBUFFER,framebuffer);
pGlFramebufferTexture(GL_FRAMEBUFFER,attachment,texture,level);
if (bound!=framebuffer)
pGlBindFramebuffer(GL_FRAMEBUFFER,bound);
}
inline void COpenGLExtensionHandler::extGlTextureParameteri(GLuint texture, GLenum pname, GLint param)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlTextureParameteri)
pGlTextureParameteri(texture, pname, param);
#else
// TODO
#endif//_IRR_OPENGL_USE_EXTPOINTER_
}
inline void COpenGLExtensionHandler::extGlCreateTextures(GLenum target, GLsizei n, GLuint* textures)
{
if (Version>=450)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlCreateTextures)
pGlCreateTextures(target,n,textures);
else if (textures)
memset(textures,0,n*sizeof(GLuint));
#else
glCreateTextures(target,n,textures);
#endif // _IRR_OPENGL_USE_EXTPOINTER_
}
else
{
glGenTextures(n,textures);
}
}
inline void COpenGLExtensionHandler::extGlCreateFramebuffers(GLsizei n, GLuint* framebuffers)
{
if (!needsDSAFramebufferHack)
{
if (Version>=450)
{
pGlCreateFramebuffers(n, framebuffers);
return;
}
}
pGlGenFramebuffers(n, framebuffers);
}
inline void COpenGLExtensionHandler::extGlBindTextures(GLuint first, GLsizei count, const GLuint *textures, const GLenum* targets)
{
const GLenum supportedTargets[] = { GL_TEXTURE_1D,GL_TEXTURE_2D, // GL 1.x
GL_TEXTURE_3D,GL_TEXTURE_RECTANGLE,GL_TEXTURE_CUBE_MAP, // GL 2.x
GL_TEXTURE_1D_ARRAY,GL_TEXTURE_2D_ARRAY,GL_TEXTURE_BUFFER, // GL 3.x
GL_TEXTURE_CUBE_MAP_ARRAY,GL_TEXTURE_2D_MULTISAMPLE,GL_TEXTURE_2D_MULTISAMPLE_ARRAY}; // GL 4.x
if (Version>=440||FeatureAvailable[IRR_ARB_multi_bind])
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlBindTextures)
pGlBindTextures(first,count,textures);
#else
glBindTextures(first,count,textures);
#endif // _IRR_OPENGL_USE_EXTPOINTER_
}
else
{
GLint activeTex = 0;
glGetIntegerv(GL_ACTIVE_TEXTURE,&activeTex);
for (GLsizei i=0; i<count; i++)
{
GLuint texture = textures ? textures[i]:0;
GLuint unit = first+i;
irrGlActiveTexture(GL_TEXTURE0 + unit);
if (texture)
glBindTexture(targets[i],texture);
else
{
for (size_t j=0; j<sizeof(supportedTargets)/sizeof(GLenum); j++)
glBindTexture(supportedTargets[j],0);
}
}
irrGlActiveTexture(activeTex);
}
}
inline void COpenGLExtensionHandler::extGlGenerateTextureMipmap(GLuint texture, GLenum target)
{
if (Version>=450)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlGenerateTextureMipmap)
pGlGenerateTextureMipmap(texture);
#else
glGenerateTextureMipmap(texture);
#endif // _IRR_OPENGL_USE_EXTPOINTER_
}
else if (FeatureAvailable[IRR_EXT_direct_state_access])
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlGenerateTextureMipmapEXT)
pGlGenerateTextureMipmapEXT(texture,target);
#else
glGenerateTextureMipmapEXT(texture,target);
#endif // _IRR_OPENGL_USE_EXTPOINTER_
}
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
else if (pGlGenerateMipmap)
#else
else
#endif // _IRR_OPENGL_USE_EXTPOINTER_
{
GLint bound;
switch (target)
{
case GL_TEXTURE_1D:
glGetIntegerv(GL_TEXTURE_BINDING_1D, &bound);
break;
case GL_TEXTURE_1D_ARRAY:
glGetIntegerv(GL_TEXTURE_BINDING_1D_ARRAY, &bound);
break;
case GL_TEXTURE_2D:
glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound);
break;
case GL_TEXTURE_2D_ARRAY:
glGetIntegerv(GL_TEXTURE_BINDING_2D_ARRAY, &bound);
break;
case GL_TEXTURE_2D_MULTISAMPLE:
glGetIntegerv(GL_TEXTURE_BINDING_2D_MULTISAMPLE, &bound);
break;
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
glGetIntegerv(GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY, &bound);
break;
case GL_TEXTURE_3D:
glGetIntegerv(GL_TEXTURE_BINDING_3D, &bound);
break;
case GL_TEXTURE_BUFFER:
glGetIntegerv(GL_TEXTURE_BINDING_BUFFER, &bound);
break;
case GL_TEXTURE_CUBE_MAP:
glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, &bound);
break;
case GL_TEXTURE_CUBE_MAP_ARRAY:
glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP_ARRAY, &bound);
break;
case GL_TEXTURE_RECTANGLE:
glGetIntegerv(GL_TEXTURE_BINDING_RECTANGLE, &bound);
break;
default:
os::Printer::log("DevSH would like to ask you what are you doing!!??\n",ELL_ERROR);
return;
}
glBindTexture(target, texture);
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
pGlGenerateMipmap(target);
#else
glGenerateMipmap(target);
#endif // _IRR_OPENGL_USE_EXTPOINTER_
glBindTexture(target, bound);
}
}
inline void COpenGLExtensionHandler::extGlSwapInterval(int interval)
{
// we have wglext, so try to use that

View File

@ -58,32 +58,34 @@ bool CSceneNodeAnimatorCameraMaya::OnEvent(const SEvent& event)
{
case EMIE_LMOUSE_PRESSED_DOWN:
MouseKeys[0] = true;
updateMousePos();
break;
case EMIE_RMOUSE_PRESSED_DOWN:
MouseKeys[2] = true;
updateMousePos();
break;
case EMIE_MMOUSE_PRESSED_DOWN:
MouseKeys[1] = true;
updateMousePos();
break;
case EMIE_LMOUSE_LEFT_UP:
MouseKeys[0] = false;
updateMousePos();
break;
case EMIE_RMOUSE_LEFT_UP:
MouseKeys[2] = false;
updateMousePos();
break;
case EMIE_MMOUSE_LEFT_UP:
MouseKeys[1] = false;
updateMousePos();
break;
case EMIE_MOUSE_MOVED:
// check states again because sometimes the gui has already caught events
MouseKeys[0] = event.MouseInput.isLeftPressed();
MouseKeys[2] = event.MouseInput.isRightPressed();
MouseKeys[1] = event.MouseInput.isMiddlePressed();
if ( CursorControl )
{
MousePos = CursorControl->getRelativePosition();
}
updateMousePos();
break;
default:
return false;
@ -91,6 +93,13 @@ bool CSceneNodeAnimatorCameraMaya::OnEvent(const SEvent& event)
return true;
}
void CSceneNodeAnimatorCameraMaya::updateMousePos()
{
if ( CursorControl )
{
MousePos = CursorControl->getRelativePosition();
}
}
//! OnAnimate() is called just before rendering the whole scene.
void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs)

View File

@ -96,6 +96,7 @@ namespace scene
private:
void updateMousePos();
void allKeysUp();
void animate();
bool isMouseKeyDown(s32 key) const;

View File

@ -1471,8 +1471,8 @@ void CSkinnedMesh::calculateTangents(
core::vector3df& normal,
core::vector3df& tangent,
core::vector3df& binormal,
core::vector3df& vt1, core::vector3df& vt2, core::vector3df& vt3, // vertices
core::vector2df& tc1, core::vector2df& tc2, core::vector2df& tc3) // texture coords
const core::vector3df& vt1, const core::vector3df& vt2, const core::vector3df& vt3, // vertices
const core::vector2df& tc1, const core::vector2df& tc2, const core::vector2df& tc3) // texture coords
{
core::vector3df v1 = vt1 - vt2;
core::vector3df v2 = vt3 - vt1;

View File

@ -180,8 +180,8 @@ private:
void calculateTangents(core::vector3df& normal,
core::vector3df& tangent, core::vector3df& binormal,
core::vector3df& vt1, core::vector3df& vt2, core::vector3df& vt3,
core::vector2df& tc1, core::vector2df& tc2, core::vector2df& tc3);
const core::vector3df& vt1, const core::vector3df& vt2, const core::vector3df& vt3,
const core::vector2df& tc1, const core::vector2df& tc2, const core::vector2df& tc3);
core::array<SSkinMeshBuffer*> *SkinningBuffers; //Meshbuffer to skin, default is to skin localBuffers

View File

@ -0,0 +1,290 @@
#ifndef __khrplatform_h_
#define __khrplatform_h_
/*
** Copyright (c) 2008-2018 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.
*
* The master copy of khrplatform.h is maintained in the Khronos EGL
* Registry repository at https://github.com/KhronosGroup/EGL-Registry
* The last semantic modification to khrplatform.h was at commit ID:
* 67a3e0864c2d75ea5287b9f3d2eb74a745936692
*
* 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 filing pull requests or issues on
* the EGL Registry repository linked above.
*
*
* 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;
*/
#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
# define KHRONOS_STATIC 1
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APICALL
*-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype.
*/
#if defined(KHRONOS_STATIC)
/* If the preprocessor constant KHRONOS_STATIC is defined, make the
* header compatible with static linking. */
# define KHRONOS_APICALL
#elif defined(_WIN32)
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
#elif defined(__ANDROID__)
# define KHRONOS_APICALL __attribute__((visibility("default")))
#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(KHRONOS_STATIC)
/* 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(__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 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;
/*
* Types that differ between LLP64 and LP64 architectures - in LLP64,
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
* to be the only LLP64 architecture in current use.
*/
#ifdef _WIN64
typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t;
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
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;
#endif
#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

View File

@ -1,12 +1,12 @@
#ifndef __glxext_h_
#define __glxext_h_ 1
#ifndef __glx_glxext_h_
#define __glx_glxext_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2013 The Khronos Group Inc.
** Copyright (c) 2013-2018 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
@ -31,12 +31,10 @@ extern "C" {
** This header is generated from the Khronos OpenGL / OpenGL ES XML
** API Registry. The current version of the Registry, generator scripts
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
**
** Khronos $Revision: 23730 $ on $Date: 2013-10-28 15:16:34 -0700 (Mon, 28 Oct 2013) $
** https://github.com/KhronosGroup/OpenGL-Registry
*/
#define GLX_GLXEXT_VERSION 20131028
#define GLX_GLXEXT_VERSION 20190515
/* Generated C header for:
* API: glx
@ -49,6 +47,7 @@ extern "C" {
#ifndef GLX_VERSION_1_3
#define GLX_VERSION_1_3 1
typedef XID GLXContextID;
typedef struct __GLXFBConfigRec *GLXFBConfig;
typedef XID GLXWindow;
typedef XID GLXPbuffer;
@ -157,6 +156,13 @@ __GLXextFuncPtr glXGetProcAddress (const GLubyte *procName);
#endif
#endif /* GLX_VERSION_1_4 */
#ifndef GLX_ARB_context_flush_control
#define GLX_ARB_context_flush_control 1
#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
#endif /* GLX_ARB_context_flush_control */
#ifndef GLX_ARB_create_context
#define GLX_ARB_create_context 1
#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
@ -170,6 +176,11 @@ GLXContext glXCreateContextAttribsARB (Display *dpy, GLXFBConfig config, GLXCont
#endif
#endif /* GLX_ARB_create_context */
#ifndef GLX_ARB_create_context_no_error
#define GLX_ARB_create_context_no_error 1
#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3
#endif /* GLX_ARB_create_context_no_error */
#ifndef GLX_ARB_create_context_profile
#define GLX_ARB_create_context_profile 1
#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
@ -242,6 +253,26 @@ __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName);
#define GLX_GPU_NUM_SIMD_AMD 0x21A6
#define GLX_GPU_NUM_RB_AMD 0x21A7
#define GLX_GPU_NUM_SPI_AMD 0x21A8
typedef unsigned int ( *PFNGLXGETGPUIDSAMDPROC) (unsigned int maxCount, unsigned int *ids);
typedef int ( *PFNGLXGETGPUINFOAMDPROC) (unsigned int id, int property, GLenum dataType, unsigned int size, void *data);
typedef unsigned int ( *PFNGLXGETCONTEXTGPUIDAMDPROC) (GLXContext ctx);
typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC) (unsigned int id, GLXContext share_list);
typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (unsigned int id, GLXContext share_context, const int *attribList);
typedef Bool ( *PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC) (GLXContext ctx);
typedef Bool ( *PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (GLXContext ctx);
typedef GLXContext ( *PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
typedef void ( *PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC) (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#ifdef GLX_GLXEXT_PROTOTYPES
unsigned int glXGetGPUIDsAMD (unsigned int maxCount, unsigned int *ids);
int glXGetGPUInfoAMD (unsigned int id, int property, GLenum dataType, unsigned int size, void *data);
unsigned int glXGetContextGPUIDAMD (GLXContext ctx);
GLXContext glXCreateAssociatedContextAMD (unsigned int id, GLXContext share_list);
GLXContext glXCreateAssociatedContextAttribsAMD (unsigned int id, GLXContext share_context, const int *attribList);
Bool glXDeleteAssociatedContextAMD (GLXContext ctx);
Bool glXMakeAssociatedContextCurrentAMD (GLXContext ctx);
GLXContext glXGetCurrentAssociatedContextAMD (void);
void glXBlitContextFramebufferAMD (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#endif
#endif /* GLX_AMD_gpu_association */
#ifndef GLX_EXT_buffer_age
@ -249,6 +280,14 @@ __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName);
#define GLX_BACK_BUFFER_AGE_EXT 0x20F4
#endif /* GLX_EXT_buffer_age */
#ifndef GLX_EXT_context_priority
#define GLX_EXT_context_priority 1
#define GLX_CONTEXT_PRIORITY_LEVEL_EXT 0x3100
#define GLX_CONTEXT_PRIORITY_HIGH_EXT 0x3101
#define GLX_CONTEXT_PRIORITY_MEDIUM_EXT 0x3102
#define GLX_CONTEXT_PRIORITY_LOW_EXT 0x3103
#endif /* GLX_EXT_context_priority */
#ifndef GLX_EXT_create_context_es2_profile
#define GLX_EXT_create_context_es2_profile 1
#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
@ -272,7 +311,6 @@ __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName);
#ifndef GLX_EXT_import_context
#define GLX_EXT_import_context 1
typedef XID GLXContextID;
#define GLX_SHARE_CONTEXT_EXT 0x800A
#define GLX_VISUAL_ID_EXT 0x800B
#define GLX_SCREEN_EXT 0x800C
@ -290,6 +328,32 @@ void glXFreeContextEXT (Display *dpy, GLXContext context);
#endif
#endif /* GLX_EXT_import_context */
#ifndef GLX_EXT_libglvnd
#define GLX_EXT_libglvnd 1
#define GLX_VENDOR_NAMES_EXT 0x20F6
#endif /* GLX_EXT_libglvnd */
#ifndef GLX_EXT_no_config_context
#define GLX_EXT_no_config_context 1
#endif /* GLX_EXT_no_config_context */
#ifndef GLX_EXT_stereo_tree
#define GLX_EXT_stereo_tree 1
typedef struct {
int type;
unsigned long serial;
Bool send_event;
Display *display;
int extension;
int evtype;
GLXDrawable window;
Bool stereo_tree;
} GLXStereoNotifyEventEXT;
#define GLX_STEREO_TREE_EXT 0x20F5
#define GLX_STEREO_NOTIFY_MASK_EXT 0x00000001
#define GLX_STEREO_NOTIFY_EXT 0x00000000
#endif /* GLX_EXT_stereo_tree */
#ifndef GLX_EXT_swap_control
#define GLX_EXT_swap_control 1
#define GLX_SWAP_INTERVAL_EXT 0x20F1
@ -407,6 +471,31 @@ GLXPixmap glXCreateGLXPixmapMESA (Display *dpy, XVisualInfo *visual, Pixmap pixm
#endif
#endif /* GLX_MESA_pixmap_colormap */
#ifndef GLX_MESA_query_renderer
#define GLX_MESA_query_renderer 1
#define GLX_RENDERER_VENDOR_ID_MESA 0x8183
#define GLX_RENDERER_DEVICE_ID_MESA 0x8184
#define GLX_RENDERER_VERSION_MESA 0x8185
#define GLX_RENDERER_ACCELERATED_MESA 0x8186
#define GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187
#define GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188
#define GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189
#define GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A
#define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B
#define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C
#define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D
typedef Bool ( *PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int *value);
typedef const char *( *PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC) (int attribute);
typedef Bool ( *PFNGLXQUERYRENDERERINTEGERMESAPROC) (Display *dpy, int screen, int renderer, int attribute, unsigned int *value);
typedef const char *( *PFNGLXQUERYRENDERERSTRINGMESAPROC) (Display *dpy, int screen, int renderer, int attribute);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXQueryCurrentRendererIntegerMESA (int attribute, unsigned int *value);
const char *glXQueryCurrentRendererStringMESA (int attribute);
Bool glXQueryRendererIntegerMESA (Display *dpy, int screen, int renderer, int attribute, unsigned int *value);
const char *glXQueryRendererStringMESA (Display *dpy, int screen, int renderer, int attribute);
#endif
#endif /* GLX_MESA_query_renderer */
#ifndef GLX_MESA_release_buffers
#define GLX_MESA_release_buffers 1
typedef Bool ( *PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable);
@ -419,12 +508,32 @@ Bool glXReleaseBuffersMESA (Display *dpy, GLXDrawable drawable);
#define GLX_MESA_set_3dfx_mode 1
#define GLX_3DFX_WINDOW_MODE_MESA 0x1
#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
typedef Bool ( *PFNGLXSET3DFXMODEMESAPROC) (int mode);
typedef GLboolean ( *PFNGLXSET3DFXMODEMESAPROC) (GLint mode);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXSet3DfxModeMESA (int mode);
GLboolean glXSet3DfxModeMESA (GLint mode);
#endif
#endif /* GLX_MESA_set_3dfx_mode */
#ifndef GLX_MESA_swap_control
#define GLX_MESA_swap_control 1
typedef int ( *PFNGLXGETSWAPINTERVALMESAPROC) (void);
typedef int ( *PFNGLXSWAPINTERVALMESAPROC) (unsigned int interval);
#ifdef GLX_GLXEXT_PROTOTYPES
int glXGetSwapIntervalMESA (void);
int glXSwapIntervalMESA (unsigned int interval);
#endif
#endif /* GLX_MESA_swap_control */
#ifndef GLX_NV_copy_buffer
#define GLX_NV_copy_buffer 1
typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
typedef void ( *PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
void glXNamedCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
#endif
#endif /* GLX_NV_copy_buffer */
#ifndef GLX_NV_copy_image
#define GLX_NV_copy_image 1
typedef void ( *PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
@ -433,6 +542,14 @@ void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLe
#endif
#endif /* GLX_NV_copy_image */
#ifndef GLX_NV_delay_before_swap
#define GLX_NV_delay_before_swap 1
typedef Bool ( *PFNGLXDELAYBEFORESWAPNVPROC) (Display *dpy, GLXDrawable drawable, GLfloat seconds);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXDelayBeforeSwapNV (Display *dpy, GLXDrawable drawable, GLfloat seconds);
#endif
#endif /* GLX_NV_delay_before_swap */
#ifndef GLX_NV_float_buffer
#define GLX_NV_float_buffer 1
#define GLX_FLOAT_COMPONENTS_NV 0x20B0
@ -455,6 +572,11 @@ int glXBindVideoDeviceNV (Display *dpy, unsigned int video_slot, unsigned int vi
#endif
#endif /* GLX_NV_present_video */
#ifndef GLX_NV_robustness_video_memory_purge
#define GLX_NV_robustness_video_memory_purge 1
#define GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x20F7
#endif /* GLX_NV_robustness_video_memory_purge */
#ifndef GLX_NV_swap_group
#define GLX_NV_swap_group 1
typedef Bool ( *PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group);
@ -493,8 +615,8 @@ void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV devic
#endif
#endif /* GLX_NV_video_capture */
#ifndef GLX_NV_video_output
#define GLX_NV_video_output 1
#ifndef GLX_NV_video_out
#define GLX_NV_video_out 1
typedef unsigned int GLXVideoDeviceNV;
#define GLX_VIDEO_OUT_COLOR_NV 0x20C3
#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4
@ -520,7 +642,7 @@ int glXReleaseVideoImageNV (Display *dpy, GLXPbuffer pbuf);
int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#endif
#endif /* GLX_NV_video_output */
#endif /* GLX_NV_video_out */
#ifndef GLX_OML_swap_method
#define GLX_OML_swap_method 1
@ -721,13 +843,13 @@ int glXQueryHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int si
#define GLX_PBUFFER_SGIX 0x8023
typedef GLXPbufferSGIX ( *PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
typedef void ( *PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf);
typedef int ( *PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
typedef void ( *PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
typedef void ( *PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask);
typedef void ( *PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask);
#ifdef GLX_GLXEXT_PROTOTYPES
GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
void glXDestroyGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf);
int glXQueryGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
void glXQueryGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
void glXSelectEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long mask);
void glXGetSelectedEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long *mask);
#endif
@ -825,9 +947,9 @@ int glXWaitVideoSyncSGI (int divisor, int remainder, unsigned int *count);
#ifndef GLX_SUN_get_transparent_index
#define GLX_SUN_get_transparent_index 1
typedef Status ( *PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
typedef Status ( *PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, unsigned long *pTransparentIndex);
#ifdef GLX_GLXEXT_PROTOTYPES
Status glXGetTransparentIndexSUN (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
Status glXGetTransparentIndexSUN (Display *dpy, Window overlay, Window underlay, unsigned long *pTransparentIndex);
#endif
#endif /* GLX_SUN_get_transparent_index */

View File

@ -1,12 +1,12 @@
#ifndef __wglext_h_
#define __wglext_h_ 1
#ifndef __wgl_wglext_h_
#define __wgl_wglext_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2013 The Khronos Group Inc.
** Copyright (c) 2013-2018 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
@ -31,9 +31,7 @@ extern "C" {
** This header is generated from the Khronos OpenGL / OpenGL ES XML
** API Registry. The current version of the Registry, generator scripts
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
**
** Khronos $Revision: 23730 $ on $Date: 2013-10-28 15:16:34 -0700 (Mon, 28 Oct 2013) $
** https://github.com/KhronosGroup/OpenGL-Registry
*/
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
@ -41,7 +39,7 @@ extern "C" {
#include <windows.h>
#endif
#define WGL_WGLEXT_VERSION 20131028
#define WGL_WGLEXT_VERSION 20190515
/* Generated C header for:
* API: wgl
@ -70,6 +68,13 @@ BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width,
#endif
#endif /* WGL_ARB_buffer_region */
#ifndef WGL_ARB_context_flush_control
#define WGL_ARB_context_flush_control 1
#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
#endif /* WGL_ARB_context_flush_control */
#ifndef WGL_ARB_create_context
#define WGL_ARB_create_context 1
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
@ -85,6 +90,11 @@ HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int
#endif
#endif /* WGL_ARB_create_context */
#ifndef WGL_ARB_create_context_no_error
#define WGL_ARB_create_context_no_error 1
#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3
#endif /* WGL_ARB_create_context_no_error */
#ifndef WGL_ARB_create_context_profile
#define WGL_ARB_create_context_profile 1
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
@ -308,7 +318,7 @@ BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
#define WGL_GPU_NUM_RB_AMD 0x21A7
#define WGL_GPU_NUM_SPI_AMD 0x21A8
typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
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);
@ -318,7 +328,7 @@ 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);
#ifdef WGL_WGLEXT_PROTOTYPES
UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
INT WINAPI wglGetGPUInfoAMD (UINT id, INT property, GLenum dataType, UINT size, void *data);
UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
@ -334,6 +344,18 @@ VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
#endif /* WGL_ATI_pixel_format_float */
#ifndef WGL_ATI_render_texture_rectangle
#define WGL_ATI_render_texture_rectangle 1
#define WGL_TEXTURE_RECTANGLE_ATI 0x21A5
#endif /* WGL_ATI_render_texture_rectangle */
#ifndef WGL_EXT_colorspace
#define WGL_EXT_colorspace 1
#define WGL_COLORSPACE_EXT 0x309D
#define WGL_COLORSPACE_SRGB_EXT 0x3089
#define WGL_COLORSPACE_LINEAR_EXT 0x308A
#endif /* WGL_EXT_colorspace */
#ifndef WGL_EXT_create_context_es2_profile
#define WGL_EXT_create_context_es2_profile 1
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
@ -703,12 +725,12 @@ BOOL WINAPI wglDeleteDCNV (HDC hdc);
#define WGL_NV_present_video 1
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
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);
#ifdef WGL_WGLEXT_PROTOTYPES
int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
int WINAPI wglEnumerateVideoDevicesNV (HDC hDc, HVIDEOOUTPUTDEVICENV *phDeviceList);
BOOL WINAPI wglBindVideoDeviceNV (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
#endif
#endif /* WGL_NV_present_video */
@ -813,14 +835,14 @@ BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCount
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 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);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
#endif

View File

@ -43,8 +43,10 @@ static bool polygonOffset(video::E_DRIVER_TYPE type)
smgr->addCameraSceneNode();
// test back plane to back
plane->getMaterial(0).PolygonOffsetDirection=video::EPO_BACK;
plane->getMaterial(0).PolygonOffsetFactor=7;
plane->getMaterial(0).PolygonOffsetSlopeScale = 1.f;
plane->getMaterial(0).PolygonOffsetDepthBias = 1.f;
if ( type == video::EDT_DIRECT3D9 )
plane->getMaterial(0).PolygonOffsetDepthBias *= 2.f*4.8e-7f;
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,113,113,133));
smgr->drawAll();
@ -52,10 +54,12 @@ static bool polygonOffset(video::E_DRIVER_TYPE type)
bool result = takeScreenshotAndCompareAgainstReference(driver, "-polygonBack.png");
//reset back plane
plane->getMaterial(0).PolygonOffsetFactor=0;
plane->getMaterial(0).PolygonOffsetDepthBias=0;
// test front plane to front
plane2->getMaterial(0).PolygonOffsetDirection=video::EPO_FRONT;
plane2->getMaterial(0).PolygonOffsetFactor=7;
plane2->getMaterial(0).PolygonOffsetSlopeScale=-1.f;
plane2->getMaterial(0).PolygonOffsetDepthBias=-1.f;
if ( type == video::EDT_DIRECT3D9 )
plane2->getMaterial(0).PolygonOffsetDepthBias *= 2.f*4.8e-7f;
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,113,113,133));
smgr->drawAll();
driver->endScene();

Binary file not shown.

Binary file not shown.

View File

@ -36,6 +36,15 @@ static bool doTests()
return false;
}
otherVec = vector2d<T>(1,2);
otherVec[0] = vec[0];
otherVec[1] = vec[1];
if(!vec.equals(otherVec))
{
logTestString("vector2d::operator[] failed\n");
assert_log(0);
return false;
}
vec.rotateBy(45); // Test implicit (0, 0) center
COMPARE_VECTORS(vec, vector2d<T>(0, (T)7.0710678118654755));

View File

@ -208,6 +208,7 @@ static bool doTests()
{
vector3d<T> vec(-5, 5, 0);
vector3d<T> otherVec((T)-5.1, 5, 0);
if(!vec.equals(otherVec, (T)0.1))
{
logTestString("vector3d::equals failed\n");
@ -215,6 +216,17 @@ static bool doTests()
return false;
}
otherVec = vector3d<T>(1,2,3);
otherVec[0] = vec[0];
otherVec[1] = vec[1];
otherVec[2] = vec[2];
if(!vec.equals(otherVec))
{
logTestString("vector3d::operator[] failed\n");
assert_log(0);
return false;
}
vec.set(5, 5, 0);
otherVec.set(10, 20, 0);
if(!equals(vec.getDistanceFrom(otherVec), (T)15.8113883))

View File

@ -1,4 +1,4 @@
Tests finished. 1 test of 1 passed.
Compiled as DEBUG
Test suite pass at GMT Fri Mar 15 13:00:55 2019
Test suite pass at GMT Thu May 30 10:19:28 2019

View File

@ -85,7 +85,8 @@ bool octree()
video::SMaterial unlit;
unlit.Lighting = false;
unlit.Thickness = 3.f;
unlit.PolygonOffsetFactor=1;
unlit.PolygonOffsetSlopeScale= -1.f;
unlit.PolygonOffsetDepthBias = -1.f;
bool result = true;
{
@ -199,7 +200,8 @@ bool triangle()
video::SMaterial unlit;
unlit.Lighting = false;
unlit.Thickness = 3.f;
unlit.PolygonOffsetFactor=1;
unlit.PolygonOffsetSlopeScale= -1.f;
unlit.PolygonOffsetDepthBias = -1.f;
bool result = true;
{