2014-09-18 08:08:41 +10:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
#ifndef WEBGL_SAMPLER_H_
|
|
|
|
#define WEBGL_SAMPLER_H_
|
2014-09-18 08:08:41 +10:00
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
#include "mozilla/LinkedList.h"
|
|
|
|
#include "nsWrapperCache.h"
|
2014-09-18 08:08:41 +10:00
|
|
|
#include "WebGLObjectModel.h"
|
2016-07-21 23:25:41 -07:00
|
|
|
#include "WebGLStrongTypes.h"
|
2014-09-18 08:08:41 +10:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2015-03-21 12:28:04 -04:00
|
|
|
class WebGLSampler final
|
2014-11-17 12:21:04 +10:00
|
|
|
: public nsWrapperCache
|
2014-09-18 08:08:41 +10:00
|
|
|
, public WebGLRefCountedObject<WebGLSampler>
|
|
|
|
, public LinkedListElement<WebGLSampler>
|
|
|
|
{
|
|
|
|
friend class WebGLContext2;
|
2016-01-21 14:49:41 +08:00
|
|
|
friend class WebGLTexture;
|
2014-09-18 08:08:41 +10:00
|
|
|
|
|
|
|
public:
|
2016-07-21 23:29:19 -07:00
|
|
|
WebGLSampler(WebGLContext* webgl, GLuint sampler);
|
2014-09-18 08:08:41 +10:00
|
|
|
|
2015-05-21 09:54:05 +10:00
|
|
|
const GLuint mGLName;
|
|
|
|
|
2014-09-18 08:08:41 +10:00
|
|
|
void Delete();
|
|
|
|
WebGLContext* GetParentObject() const;
|
|
|
|
|
2015-07-14 17:37:28 -07:00
|
|
|
virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto) override;
|
2014-09-18 08:08:41 +10:00
|
|
|
|
2016-12-22 13:52:53 -08:00
|
|
|
void SamplerParameter(const char* funcName, GLenum pname, const FloatOrInt& param);
|
2016-01-21 14:49:41 +08:00
|
|
|
|
2014-10-27 09:40:37 +10:00
|
|
|
private:
|
2014-09-18 08:08:41 +10:00
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLSampler)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLSampler)
|
|
|
|
|
2016-01-21 14:49:41 +08:00
|
|
|
TexMinFilter mMinFilter;
|
|
|
|
TexMagFilter mMagFilter;
|
|
|
|
TexWrap mWrapS;
|
|
|
|
TexWrap mWrapT;
|
|
|
|
TexWrap mWrapR;
|
2016-12-22 13:52:53 -08:00
|
|
|
GLfloat mMinLod;
|
|
|
|
GLfloat mMaxLod;
|
2016-01-21 14:49:41 +08:00
|
|
|
TexCompareMode mCompareMode;
|
|
|
|
TexCompareFunc mCompareFunc;
|
|
|
|
|
2014-09-18 08:08:41 +10:00
|
|
|
private:
|
|
|
|
~WebGLSampler();
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
#endif // WEBGL_SAMPLER_H_
|