OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WebGLSampler_h | 5 #ifndef WebGLSampler_h |
6 #define WebGLSampler_h | 6 #define WebGLSampler_h |
7 | 7 |
8 #include "modules/webgl/WebGLSharedPlatform3DObject.h" | 8 #include "modules/webgl/WebGLSharedPlatform3DObject.h" |
| 9 #include "modules/webgl/WebGLTexture.h" |
9 | 10 |
10 namespace blink { | 11 namespace blink { |
11 | 12 |
12 class WebGL2RenderingContextBase; | 13 class WebGL2RenderingContextBase; |
13 | 14 |
14 class WebGLSampler : public WebGLSharedPlatform3DObject { | 15 class WebGLSampler : public WebGLSharedPlatform3DObject { |
15 DEFINE_WRAPPERTYPEINFO(); | 16 DEFINE_WRAPPERTYPEINFO(); |
16 public: | 17 public: |
17 ~WebGLSampler() override; | 18 ~WebGLSampler() override; |
18 | 19 |
19 static WebGLSampler* create(WebGL2RenderingContextBase*); | 20 static WebGLSampler* create(WebGL2RenderingContextBase*); |
20 | 21 |
21 void setParameteri(GLenum pname, GLint param); | 22 void setParameteri(GLenum pname, GLint param); |
22 void setParameterf(GLenum pname, GLfloat param); | 23 void setParameterf(GLenum pname, GLfloat param); |
23 GLenum getCompareFunc() const { return m_compreFunc; } | 24 GLenum getCompareFunc() const { return m_state.compreFunc; } |
24 GLenum getCompareMode() const { return m_compreMode; } | 25 GLenum getCompareMode() const { return m_state.compreMode; } |
25 GLenum getMagFilter() const { return m_magFilter; } | 26 GLenum getMagFilter() const { return m_state.magFilter; } |
26 GLenum getMinFilter() const { return m_minFilter; } | 27 GLenum getMinFilter() const { return m_state.minFilter; } |
27 GLenum getWrapR() const { return m_wrapR; } | 28 GLenum getWrapR() const { return m_state.wrapR; } |
28 GLenum getWrapS() const { return m_wrapS; } | 29 GLenum getWrapS() const { return m_state.wrapS; } |
29 GLenum getWrapT() const { return m_wrapT; } | 30 GLenum getWrapT() const { return m_state.wrapT; } |
30 GLfloat getMaxLod() const { return m_maxLod; } | 31 GLfloat getMaxLod() const { return m_state.maxLod; } |
31 GLfloat getMinLod() const { return m_minLod; } | 32 GLfloat getMinLod() const { return m_state.minLod; } |
| 33 |
| 34 const WebGLSamplerState* getSamplerState() const { return &m_state; } |
32 | 35 |
33 protected: | 36 protected: |
34 explicit WebGLSampler(WebGL2RenderingContextBase*); | 37 explicit WebGLSampler(WebGL2RenderingContextBase*); |
35 | 38 |
36 void deleteObjectImpl(WebGraphicsContext3D*) override; | 39 void deleteObjectImpl(WebGraphicsContext3D*) override; |
37 | 40 |
38 private: | 41 private: |
39 bool isSampler() const override { return true; } | 42 bool isSampler() const override { return true; } |
40 | 43 |
41 GLenum m_compreFunc; | 44 WebGLSamplerState m_state; |
42 GLenum m_compreMode; | |
43 GLenum m_magFilter; | |
44 GLenum m_minFilter; | |
45 GLenum m_wrapR; | |
46 GLenum m_wrapS; | |
47 GLenum m_wrapT; | |
48 GLfloat m_maxLod; | |
49 GLfloat m_minLod; | |
50 }; | 45 }; |
51 | 46 |
52 } // namespace blink | 47 } // namespace blink |
53 | 48 |
54 #endif // WebGLSampler_h | 49 #endif // WebGLSampler_h |
OLD | NEW |