0023544: Texture management in TKOpenGl should be redesigned
[occt.git] / src / OpenGl / OpenGl_AspectFace.hxx
CommitLineData
b311480e 1// Created on: 2011-07-13
2// Created by: Sergey ZERCHANINOV
3// Copyright (c) 2011-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
2166f0fa
SK
20#ifndef _OpenGl_AspectFace_Header
21#define _OpenGl_AspectFace_Header
22
23#include <InterfaceGraphic_telem.hxx>
24#include <Aspect_InteriorStyle.hxx>
bf75be98 25#include <TCollection_AsciiString.hxx>
26#include <Handle_Graphic3d_TextureParams.hxx>
2166f0fa
SK
27
28#include <OpenGl_AspectLine.hxx>
bf75be98 29#include <OpenGl_Element.hxx>
30#include <Handle_OpenGl_Texture.hxx>
2166f0fa
SK
31
32#define OPENGL_AMBIENT_MASK (1<<0)
33#define OPENGL_DIFFUSE_MASK (1<<1)
34#define OPENGL_SPECULAR_MASK (1<<2)
35#define OPENGL_EMISSIVE_MASK (1<<3)
36
bf75be98 37class CALL_DEF_CONTEXTFILLAREA;
38
2166f0fa
SK
39struct OPENGL_SURF_PROP
40{
41 float amb, diff, spec, emsv;
42 float trans, shine;
43 float env_reflexion;
44 int isphysic;
45 unsigned int color_mask;
46 TEL_COLOUR speccol, difcol, ambcol, emscol, matcol;
1c35b92f 47 DEFINE_STANDARD_ALLOC
2166f0fa
SK
48};
49
2166f0fa
SK
50class OpenGl_AspectFace : public OpenGl_Element
51{
2166f0fa 52
bf75be98 53public:
2166f0fa 54
bf75be98 55 OpenGl_AspectFace();
2166f0fa 56
bf75be98 57 void Init (const Handle(OpenGl_Context)& theContext,
58 const CALL_DEF_CONTEXTFILLAREA& theAspect);
2166f0fa 59
bf75be98 60 void SetAspectEdge (const OpenGl_AspectLine* theAspectEdge) { myAspectEdge = *theAspectEdge; }
61
62 const OpenGl_AspectLine* AspectEdge() const { return &myAspectEdge; }
2166f0fa 63
5e27df78 64 virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
65 virtual void Release (const Handle(OpenGl_Context)& theContext);
2166f0fa 66
bf75be98 67private:
68
69 void convertMaterial (const CALL_DEF_MATERIAL& theMat,
70 OPENGL_SURF_PROP& theSurf);
71
72public:
73
74 Aspect_InteriorStyle InteriorStyle;
75 int Edge;
76 int Hatch;
77 int DistinguishingMode;
78 int CullingMode;
79 OPENGL_SURF_PROP IntFront;
80 OPENGL_SURF_PROP IntBack;
81 TEL_POFFSET_PARAM PolygonOffset;
2166f0fa 82
bf75be98 83 int doTextureMap;
84 Handle(OpenGl_Texture) TextureRes;
85 Handle(Graphic3d_TextureParams) TextureParams;
86
87protected:
88
89 TCollection_AsciiString myTextureId;
90 OpenGl_AspectLine myAspectEdge;
91
92public:
2166f0fa 93
1c35b92f 94 DEFINE_STANDARD_ALLOC
bf75be98 95
2166f0fa
SK
96};
97
98#endif //_OpenGl_AspectFace_Header