1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-07 18:30:55 +03:00
occt/src/OpenGl/OpenGl_AspectsSprite.hxx
kgv 737e9a8da4 0030571: Visualization, TKOpenGl - mapped texture is ignored while drawing points
OpenGl_AspectsTextureSet now appends Sprite texture to the end of texture set.
OpenGl_Context::init() - fixed usage of GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS on too old GL context.

Default sampler names occSampler0, occActiveSampler and occSamplerBaseColor
are now excluded from header with common declarations for build-in GLSL programs.

OpenGl_ShaderObject::LoadAndCompile() and OpenGl_ShaderProgram::Link()
now includes program Id within error log.

OpenGl_ShaderManager now supports mapping texture onto point primitive within built-in programs
(texture transformation is ignored).
2019-03-16 16:48:21 +03:00

87 lines
3.3 KiB
C++

// Copyright (c) 2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _OpenGl_AspectsSprite_Header
#define _OpenGl_AspectsSprite_Header
#include <Graphic3d_Aspects.hxx>
#include <Graphic3d_TextureMap.hxx>
class OpenGl_Context;
class OpenGl_PointSprite;
//! OpenGl resources for custom point sprites.
class OpenGl_AspectsSprite
{
public:
DEFINE_STANDARD_ALLOC
public:
//! Empty constructor.
OpenGl_AspectsSprite() : myMarkerSize (1.0f), myIsSpriteReady (Standard_False) {}
Standard_ShortReal MarkerSize() const { return myMarkerSize; }
//! Return TRUE if resource is up-to-date.
bool IsReady() const { return myIsSpriteReady; }
//! Invalidate resource state.
void Invalidate() { myIsSpriteReady = false; }
//! Return TRUE if OpenGl point sprite resource defines texture.
Standard_EXPORT bool HasPointSprite (const Handle(OpenGl_Context)& theCtx,
const Handle(Graphic3d_Aspects)& theAspects);
//! Return TRUE if OpenGl point sprite resource defined by obsolete Display List (bitmap).
Standard_EXPORT bool IsDisplayListSprite (const Handle(OpenGl_Context)& theCtx,
const Handle(Graphic3d_Aspects)& theAspects);
//! Return sprite.
Standard_EXPORT const Handle(OpenGl_PointSprite)& Sprite (const Handle(OpenGl_Context)& theCtx,
const Handle(Graphic3d_Aspects)& theAspects,
bool theIsAlphaSprite);
//! Update texture resource up-to-date state.
Standard_EXPORT void UpdateRediness (const Handle(Graphic3d_Aspects)& theAspect);
//! Release texture resource.
Standard_EXPORT void Release (OpenGl_Context* theCtx);
private:
//! Build texture resources.
Standard_EXPORT void build (const Handle(OpenGl_Context)& theCtx,
const Handle(Graphic3d_MarkerImage)& theMarkerImage,
Aspect_TypeOfMarker theType,
Standard_ShortReal theScale,
const Graphic3d_Vec4& theColor,
Standard_ShortReal& theMarkerSize);
//! Generate resource keys for a sprite.
static void spriteKeys (const Handle(Graphic3d_MarkerImage)& theMarkerImage,
Aspect_TypeOfMarker theType,
Standard_ShortReal theScale,
const Graphic3d_Vec4& theColor,
TCollection_AsciiString& theKey,
TCollection_AsciiString& theKeyA);
private:
Handle(OpenGl_PointSprite) mySprite;
Handle(OpenGl_PointSprite) mySpriteA;
Standard_ShortReal myMarkerSize;
Standard_Boolean myIsSpriteReady;
};
#endif // _OpenGl_Aspects_Header