gecko-dev/extensions/canvas3d/public/nsICanvasRenderingContextGL...

218 строки
8.3 KiB
Plaintext
Исходник Обычный вид История

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is canvas 3D.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
2007-04-05 07:47:20 +04:00
#include "nsICanvasRenderingContextGL.idl"
#include "nsICanvasRenderingContextGLBuffer.idl"
interface nsIDOMHTMLElement;
interface nsIDOMHTMLCanvasElement;
[scriptable, uuid(619a102d-6c58-4660-ba35-60d9b8de92ab)]
2007-04-05 07:47:20 +04:00
interface nsICanvasRenderingContextGLES11 : nsICanvasRenderingContextGL
{
/**
** GL ES 1.1 API
**
** Section numbers refer to the GL ES Common/Common-Lite Profile Specification 1.0 document
**/
void enable (in PRUint32 mode);
void disable (in PRUint32 mode);
void clientActiveTexture (in PRUint32 texture);
void enableClientState (in PRUint32 mode);
void disableClientState (in PRUint32 mode);
// 2.5 GL Errors
PRUint32 getError ();
// 2.7 Vertex Specification
void normal (in float nx, in float ny, in float nz);
void multiTexCoord (in PRUint32 target, in float s, in float t, in float r, in float q);
void color (in float r, in float g, in float b, in float a);
// 2.8 Vertex Arrays
// Note: these are handled via scriptable helpers to avoid unnencessary type conversions
//X void vertexPointer (in PRUint8 size, in PRUint32 type, in object [] vertexArray);
void vertexPointer ();
//X void normalPointer (in PRUint32 type, in object [] normalArray);
void normalPointer ();
//X void texCoordPointer (in PRUint8 size, in PRUint32 type, in object [] texCoordArray);
void texCoordPointer ();
//X void colorPointer (in PRUint8 size, in PRUint32 type, in object [] colorArray);
void colorPointer ();
//X void drawElements (in PRUint32 mode, in PRUint32 count, in PRUint32 type, in object [] indices);
void drawElements ();
void drawArrays (in PRUint32 mode, in PRUint32 first, in PRUint32 count);
// 2.9 Buffer Objects
void genBuffers (in PRUint32 n);
/* [array of buffers] */
void deleteBuffers ();
void bindBuffer (in PRUint32 target, in PRUint32 buffer);
/* array, type, usage */
void bufferData ();
/* offset, array, type */
void bufferSubData ();
// JS buffer objects; will use buffer objects extension if available,
// otherwise will just store in client memeory
//void bindBufferObject (in PRUint32 target, in nsICanvasRenderingContextGLES11Buffer obj);
//X nsICanvasRenderingContextGLES11Buffer
//X createBuffer(in PRInt32 usage, in PRInt32 componentSize, in PRInt32 type, in [] array);
2007-04-05 07:47:20 +04:00
nsICanvasRenderingContextGLBuffer createBuffer();
// 2.11 Coordinate Transformations
void depthRange (in float zNear, in float zFar);
void viewport (in PRInt32 x, in PRInt32 y, in PRInt32 width, in PRInt32 height);
void matrixMode (in PRUint32 mode);
//X void loadMatrix (in float [] matrix);
void loadMatrix ();
//X void multMatrix (in float [] matrix);
void multMatrix ();
void loadIdentity ();
void rotate (in float angle, in float x, in float y, in float z);
void scale (in float x, in float y, in float z);
void translate (in float x, in float y, in float z);
void frustum (in float left, in float right, in float bottom, in float top, in float zNear, in float zFar);
void ortho (in float left, in float right, in float bottom, in float top, in float zNear, in float zFar);
void pushMatrix ();
void popMatrix ();
// 2.12 Clipping
//void clipPlane (in PRUint32 plane, in float [] equation);
//void getClipPlane (in PRUint32 pname, out float [] equation);
// 2.14 Colors and Coloring
void frontFace (in PRUint32 face);
void material ();
void getMaterial ();
void light ();
void getLight ();
void lightModel ();
void shadeModel (in PRUint32 pname);
// 3.3 Points
void pointSize (in float size);
void pointParameter ();
void lineWidth (in float width);
// 3.5 Polygons
void cullFace (in PRUint32 mode);
void polygonOffset (in float factor, in float units);
// 3.6 Pixel Rectangles
// glReadPixels is not supported (XXX well, it might be)
// and TexImage2D behaves differently, so no need for PixelStore[i]
// 3.8.5 Texture State
void activeTexture (in PRUint32 texture);
2007-04-05 07:47:20 +04:00
nsICanvasRenderingContextGLTexture createTextureObject (in nsIDOMHTMLElement imageOrCanvas);
void bindTextureObject (in nsICanvasRenderingContextGLTexture texture);
void deleteTextureObject (in nsICanvasRenderingContextGLTexture texture);
// This needs some work; we need to allow specifying the internal format, so that
// we can load A/L/LA images as well as RGB/RGBA, which is all we'd get from a DOM Image
void texImage2DHTML (in PRUint32 target, in nsIDOMHTMLElement imageOrCanvas);
//void texSubImage2DHTML (...);
void texParameter();
void getTexParameter();
void bindTexture (in PRUint32 target, in PRUint32 texid);
void deleteTextures ();
void genTextures (in PRUint32 n);
//boolean isTexture (in PRUint32 texture);
void texEnv();
void getTexEnv();
// 3.9 Fog
//X (this is called glFog{fi}[v], but we can't call it "fog" because
// we have FOG as a glEnable const already)
void fogParameter ();
// 4.1 Per-Fragment Operations
void scissor (in PRInt32 x, in PRInt32 y, in PRInt32 width, in PRInt32 height);
void sampleCoverage (in float value, in boolean invert);
void alphaFunc (in PRUint32 func, in float ref);
void stencilFunc (in PRUint32 func, in PRInt32 ref, in PRUint32 mask);
void stencilMask (in PRUint32 mask);
void stencilOp (in PRUint32 fail, in PRUint32 zfail, in PRUint32 zpass);
void depthFunc (in PRUint32 func);
void depthMask (in boolean flag);
void blendFunc (in PRUint32 sfactor, in PRUint32 dfactor);
void logicOp (in PRUint32 opcode);
// 4.2 Whole Framebuffer Operations
void colorMask (in boolean red, in boolean green, in boolean blue, in boolean alpha);
void clear (in PRUint32 mask);
void clearColor (in float red, in float green, in float blue, in float alpha);
void clearDepth (in float depth);
void clearStencil (in PRInt32 s);
// 4.3 Drawing, Reading, and Copying Pixels
// we should support ReadPixels at some point
// 5.5 Flush and Finish
// I'm not sure if this is useful for our purposes; we can't block the UI, soo...
// 5.6 Hints
void hint (in PRUint32 target, in PRUint32 mode);
// 6.1 Querying GL State
// getBooleanv, getIntegerv, getFloatv, getDoublev, getString
// are all rolled into a single function that uses scriptable
// magic to return the right type of jsobj. Colors are always
// returned as normalized floats (0.0 .. 1.0).
void getParameter (in PRUint32 pname);
// More other
void gluPerspective (in float fovy, in float aspect, in float znear, in float zfar);
void gluLookAt (in float eyex, in float eyey, in float eyez,
in float ctrx, in float ctry, in float ctrz,
in float upx, in float upy, in float upz);
};