-
-
interface CanvasRenderingContextOpera3D {
-
-
// state
-
void save(); // push state on state stack
-
void restore(); // pop state stack and restore state
-
-
// scene/frame
-
void beginScene(); // start rendering a new frame
-
void endScene(); // finish rendering of the scene and present the result
-
-
// transformations
-
void translate(in float x, in float y, in float z);
-
void scale(in float x, in float y, in float z);
-
void rotateX(in float rotation);
-
void rotateY(in float rotation);
-
void rotateZ(in float rotation);
-
-
// rendering operation
-
void drawTriangle(in float x1, in float y1, in float z1, in float tex_s1, in float tex_t1,
-
in float x2, in float y2, in float z2, in float tex_s2, in float tex_t2,
-
in float x3, in float y3, in float z3, in float tex_s3, in float tex_t3);
-
void draw3DModel(in Canvas3DModel model);
-
-
// create objects
-
CanvasTexture createTexture(in Image img);
-
Canvas3DModel create3DModel();
-
-
// collision detection
-
string checkIntersection(in float x, in float y, in float z, in float radius, in Canvas3DModel model);
-
-
// rendering state
-
attribute CanvasTexture texture; // current texture or null for no texture, default is null
-
attribute string color; // current color, default is transparent black
-
attribute float fov; // field of view of the scene in degrees, default is 45
-
attribute float nearPlane; // distance to the near clipping plane, default is 0.1
-
attribute float farPlane; // distance to the far clipping plane, default is 100
-
attribute string ztest; // "none", "less", "lessequal", "greater", "greaterequal", "equal", "notequal". Default is "lessequal"
-
attribute string blend; // "replace", "add", "srcalpha", "multiply". Default is "replace"
-
};
-
-
interface Canvas3DModel {
-
void addVertex(in float x, in float y, in float z, in float s, in float t);
-
void addTriangle(in integer vertex1, in integer vertex2, in integer vertex3);
-
};
-
-
interface CanvasTexture{
-
};
-