
// FILE GENERATED BY generate-api-bindings.py

import * as ode from "./exports.js";

/** Pixel format of 4 channels - red, green, blue, alpha, each channel represented by 8-bit unsigned integer (0 to 255 range) */
export const PIXEL_FORMAT_RGBA: ode.Int;
/** Pixel format of 4 channels - red, green, blue, alpha, color channels are alpha-premultiplied, each channel represented by 8-bit unsigned integer (0 to 255 range) */
export const PIXEL_FORMAT_PREMULTIPLIED_RGBA: ode.Int;

/** Representation of a bitmap with its own storage. Deallocate with ode_destroyBitmap */
export type Bitmap = {
    /** The pixel format (see ODE_PIXEL_FORMAT_... constants) */
    format: ode.Int;
    /** Pointer to the first (top-left) pixel. Pixels are stored contiguously in memory in row-major order */
    pixels: ode.VarDataPtr;
    /** Dimensions of bitmap */
    width: ode.Int;
    /** Dimensions of bitmap */
    height: ode.Int;
};


/** Reference to an immutable bitmap - does not hold or change ownership */
export type BitmapRef = {
    /** The pixel format (see ODE_PIXEL_FORMAT_... constants) */
    format: ode.Int;
    /** Pointer to the first (top-left) pixel. Pixels are stored contiguously in memory in row-major order */
    pixels: ode.ConstDataPtr;
    /** Dimensions of bitmap */
    width: ode.Int;
    /** Dimensions of bitmap */
    height: ode.Int;
};

/** PROTOTYPE - specification of frame view */
export type PR1_FrameView = {
    /** Viewport dimensions */
    width: ode.Int;
    /** Viewport dimensions */
    height: ode.Int;
    /** Offset of top-left corner (not scaled by scale) */
    offset: ode.Vector2;
    /** View scale (zoom) */
    scale: ode.Scalar;
};

/** Represents a renderer context. Renderer context manages a GL context */
export type RendererContextHandle = {
    RendererContextHandle: number;
};

/** Represents a design's image base. Image base manages storage of image assets of the design */
export type DesignImageBaseHandle = {
    DesignImageBaseHandle: number;
};

/** PROTOTYPE - Represents an animation renderer. A renderer facilitates rendering of components or designs in a way specific to the renderer class */
export type PR1_AnimationRendererHandle = {
    PR1_AnimationRendererHandle: number;
};

/** Deallocates the data held by an ODE_Bitmap */
export function destroyBitmap(
    bitmap: ode.Bitmap,
): void;

/**
 * Creates a new renderer context - destroy with ode_destroyRendererContext
 * @param engine existing engine handle
 * @param target identifies the target window or WebGL canvas (platform-specific)
 * @returns rendererContext output argument for the new renderer context handle
 */
export function createRendererContext(
    engine: ode.EngineHandle,
    target: ode.StringRef,
): ode.RendererContextHandle;

/** Destroys the renderer context */
export function destroyRendererContext(
    rendererContext: ode.RendererContextHandle,
): void;

/**
 * Creates a new empty image base for a design - deallocate with ode_destroyDesignImageBase
 * @param rendererContext handle to parent rendererContext
 * @param design design whose image assets will be managed by the new image base
 * @returns designImageBase output argument for the new image base handle
 */
export function createDesignImageBase(
    rendererContext: ode.RendererContextHandle,
    design: ode.DesignHandle,
): ode.DesignImageBaseHandle;

/** Destroys a design image base and deallocates its image data */
export function destroyDesignImageBase(
    designImageBase: ode.DesignImageBaseHandle,
): void;

/**
 * Loads a design's image asset as pixels in physical memory
 * @param designImageBase target design image base
 * @param key identifying key of the image asset
 * @param bitmap bitmap reference to the image data - does not have to remain in memory after this call
 */
export function design_loadImagePixels(
    designImageBase: ode.DesignImageBaseHandle,
    key: ode.StringRef,
    bitmap: ode.BitmapRef,
): void;

/**
 * PROTOTYPE - draws a component into a bitmap in physical memory
 * @param rendererContext target renderer context
 * @param component component to be rendered
 * @param designImageBase image base of the component's parent design to be used to provide image assets
 * @param frameView pointer to frame view object, which specifies the parameters of the render
 * @returns outputBitmap output argument for the newly created bitmap - deallocate with ode_destroyBitmap
 */
export function pr1_drawComponent(
    rendererContext: ode.RendererContextHandle,
    component: ode.ComponentHandle,
    designImageBase: ode.DesignImageBaseHandle,
    frameView: ode.PR1_FrameView,
): ode.Bitmap;

/**
 * PROTOTYPE - creates a new animation renderer for a given component - destroy with ode_pr1_destroyAnimationRenderer
 * @param rendererContext handle to parent rendererContext
 * @param component component to be rendered by the renderer
 * @param imageBase image base of the component's parent design to be used to provide image assets
 * @returns animationRenderer output argument for the new animation renderer handle
 */
export function pr1_createAnimationRenderer(
    rendererContext: ode.RendererContextHandle,
    component: ode.ComponentHandle,
    imageBase: ode.DesignImageBaseHandle,
): ode.PR1_AnimationRendererHandle;

/** Destroys the animation renderer */
export function pr1_destroyAnimationRenderer(
    animationRenderer: ode.PR1_AnimationRendererHandle,
): void;

/**
 * Draw a frame of an animation into the renderer context framebuffer using an animation renderer
 * @param renderer the animation renderer to be used for this operation
 * @param frameView pointer to frame view object, which specifies the parameters of the render
 * @param time the timepoint of the animation in seconds
 */
export function pr1_animation_drawFrame(
    renderer: ode.PR1_AnimationRendererHandle,
    frameView: ode.PR1_FrameView,
    time: ode.Scalar,
): void;
