All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lwjgl.bgfx.BGFXCallbackInterface Maven / Gradle / Ivy

Go to download

A cross-platform, graphics API agnostic rendering library. It provides a high performance, low level abstraction for common platform graphics APIs like OpenGL, Direct3D and Apple Metal.

There is a newer version: 3.3.4
Show newest version
/*
 * Copyright LWJGL. All rights reserved.
 * License terms: https://www.lwjgl.org/license
 * MACHINE GENERATED FILE, DO NOT EDIT
 */
package org.lwjgl.bgfx;

import javax.annotation.*;

import java.nio.*;

import org.lwjgl.*;
import org.lwjgl.system.*;

import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryStack.*;

/**
 * Callback interface to implement application specific behavior.
 * 
 * 

Cached items are currently used for OpenGL and Direct3D 12 binary shaders.

* *

{@code fatal} and {@code trace_vargs} callbacks can be called from any thread. Other callbacks are called from the render thread.

* *

Member documentation

* *
    *
  • {@code vtbl} – the callback virtual table
  • *
* *

Layout

* *

 * struct bgfx_callback_interface_t {
 *     {@link BGFXCallbackVtbl bgfx_callback_vtbl_t} const * vtbl;
 * }
*/ @NativeType("struct bgfx_callback_interface_t") public class BGFXCallbackInterface extends Struct implements NativeResource { /** The struct size in bytes. */ public static final int SIZEOF; /** The struct alignment in bytes. */ public static final int ALIGNOF; /** The struct member offsets. */ public static final int VTBL; static { Layout layout = __struct( __member(POINTER_SIZE) ); SIZEOF = layout.getSize(); ALIGNOF = layout.getAlignment(); VTBL = layout.offsetof(0); } /** * Creates a {@code BGFXCallbackInterface} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be * visible to the struct instance and vice versa. * *

The created instance holds a strong reference to the container object.

*/ public BGFXCallbackInterface(ByteBuffer container) { super(memAddress(container), __checkContainer(container, SIZEOF)); } @Override public int sizeof() { return SIZEOF; } /** Returns a {@link BGFXCallbackVtbl} view of the struct pointed to by the {@code vtbl} field. */ @NativeType("bgfx_callback_vtbl_t const *") public BGFXCallbackVtbl vtbl() { return nvtbl(address()); } /** Sets the address of the specified {@link BGFXCallbackVtbl} to the {@code vtbl} field. */ public BGFXCallbackInterface vtbl(@NativeType("bgfx_callback_vtbl_t const *") BGFXCallbackVtbl value) { nvtbl(address(), value); return this; } /** * Copies the specified struct data to this struct. * * @param src the source struct * * @return this struct */ public BGFXCallbackInterface set(BGFXCallbackInterface src) { memCopy(src.address(), address(), SIZEOF); return this; } // ----------------------------------- /** Returns a new {@code BGFXCallbackInterface} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */ public static BGFXCallbackInterface malloc() { return wrap(BGFXCallbackInterface.class, nmemAllocChecked(SIZEOF)); } /** Returns a new {@code BGFXCallbackInterface} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */ public static BGFXCallbackInterface calloc() { return wrap(BGFXCallbackInterface.class, nmemCallocChecked(1, SIZEOF)); } /** Returns a new {@code BGFXCallbackInterface} instance allocated with {@link BufferUtils}. */ public static BGFXCallbackInterface create() { ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF); return wrap(BGFXCallbackInterface.class, memAddress(container), container); } /** Returns a new {@code BGFXCallbackInterface} instance for the specified memory address. */ public static BGFXCallbackInterface create(long address) { return wrap(BGFXCallbackInterface.class, address); } /** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */ @Nullable public static BGFXCallbackInterface createSafe(long address) { return address == NULL ? null : wrap(BGFXCallbackInterface.class, address); } // ----------------------------------- /** Returns a new {@code BGFXCallbackInterface} instance allocated on the thread-local {@link MemoryStack}. */ public static BGFXCallbackInterface mallocStack() { return mallocStack(stackGet()); } /** Returns a new {@code BGFXCallbackInterface} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. */ public static BGFXCallbackInterface callocStack() { return callocStack(stackGet()); } /** * Returns a new {@code BGFXCallbackInterface} instance allocated on the specified {@link MemoryStack}. * * @param stack the stack from which to allocate */ public static BGFXCallbackInterface mallocStack(MemoryStack stack) { return wrap(BGFXCallbackInterface.class, stack.nmalloc(ALIGNOF, SIZEOF)); } /** * Returns a new {@code BGFXCallbackInterface} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. * * @param stack the stack from which to allocate */ public static BGFXCallbackInterface callocStack(MemoryStack stack) { return wrap(BGFXCallbackInterface.class, stack.ncalloc(ALIGNOF, 1, SIZEOF)); } // ----------------------------------- /** Unsafe version of {@link #vtbl}. */ public static BGFXCallbackVtbl nvtbl(long struct) { return BGFXCallbackVtbl.create(memGetAddress(struct + BGFXCallbackInterface.VTBL)); } /** Unsafe version of {@link #vtbl(BGFXCallbackVtbl) vtbl}. */ public static void nvtbl(long struct, BGFXCallbackVtbl value) { memPutAddress(struct + BGFXCallbackInterface.VTBL, value.address()); } /** * Validates pointer members that should not be {@code NULL}. * * @param struct the struct to validate */ public static void validate(long struct) { long vtbl = memGetAddress(struct + BGFXCallbackInterface.VTBL); check(vtbl); BGFXCallbackVtbl.validate(vtbl); } /** * Calls {@link #validate(long)} for each struct contained in the specified struct array. * * @param array the struct array to validate * @param count the number of structs in {@code array} */ public static void validate(long array, int count) { for (int i = 0; i < count; i++) { validate(array + Integer.toUnsignedLong(i) * SIZEOF); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy