|
From: <cap...@us...> - 2007-08-22 23:11:05
|
Revision: 2882
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2882&view=rev
Author: captainjester
Date: 2007-08-22 16:11:02 -0700 (Wed, 22 Aug 2007)
Log Message:
-----------
First commit of Direct3D extension.
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/d3d/
trunk/LWJGL/src/java/org/lwjgl/d3d/Context.java
trunk/LWJGL/src/java/org/lwjgl/d3d/ContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DAdapterIdentifier9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DBox.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DCaps9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DClipStatus9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DColorValue.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDeviceCreationParameters.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDisplaymode.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDisplaymodeEx.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDisplaymodeFilter.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DGammaRamp.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DIndexBufferDesc.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DLight9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DLockedBox.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DLockedRect.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DMaterial9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DMatrix.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DPShaderCaps2_0.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DPresentParameters.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DPresentStats.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DRasterStatus.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DRectPatchInfo.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DRegionData.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DRegionDataHeader.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DSsurfaceDesc.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DSurfaceDesc.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DTriPatchInfo.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DUtil.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DVShaderCaps2_0.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DVector.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DVertexBufferDesc.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DVertexElement9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DViewport9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/D3DVolumeDesc.java
trunk/LWJGL/src/java/org/lwjgl/d3d/Direct3DConstants.java
trunk/LWJGL/src/java/org/lwjgl/d3d/Display.java
trunk/LWJGL/src/java/org/lwjgl/d3d/DisplayImplementation.java
trunk/LWJGL/src/java/org/lwjgl/d3d/DisplayMode.java
trunk/LWJGL/src/java/org/lwjgl/d3d/Drawable.java
trunk/LWJGL/src/java/org/lwjgl/d3d/EventQueue.java
trunk/LWJGL/src/java/org/lwjgl/d3d/GUID.java
trunk/LWJGL/src/java/org/lwjgl/d3d/GlobalLock.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3D9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3D9Ex.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DBaseTexture9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DCubeTexture9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DDevice9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DDevice9Ex.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DIndexBuffer9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DPixelShader9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DQuery9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DResource9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DStateBlock9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DSurface9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DSwapChain9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DSwapChain9Ex.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DTexture9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DVertexBuffer9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DVertexDeclaration9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DVertexShader9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DVolume9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/IDirect3DVolumeTexture9.java
trunk/LWJGL/src/java/org/lwjgl/d3d/InputImplementation.java
trunk/LWJGL/src/java/org/lwjgl/d3d/LUID.java
trunk/LWJGL/src/java/org/lwjgl/d3d/NewDisplay.java
trunk/LWJGL/src/java/org/lwjgl/d3d/PaletteEntry.java
trunk/LWJGL/src/java/org/lwjgl/d3d/PeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/d3d/PixelFormat.java
trunk/LWJGL/src/java/org/lwjgl/d3d/Point.java
trunk/LWJGL/src/java/org/lwjgl/d3d/Rectangle.java
trunk/LWJGL/src/java/org/lwjgl/d3d/RegionData.java
trunk/LWJGL/src/java/org/lwjgl/d3d/RegionDataHeader.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsDirectInput.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsDirectInput3.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsDirectInput8.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsDirectInputDevice.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsDirectInputDevice3.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsDirectInputDevice8.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsDirectInputDeviceObjectCallback.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsDisplay.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsDisplayPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsFileVersion.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsKeyboard.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsKeycodes.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsMouse.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/d3d/WindowsRegistry.java
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/Context.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/Context.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/Context.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2002-2004 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+
+import org.lwjgl.LWJGLException;
+import org.lwjgl.LWJGLUtil;
+import org.lwjgl.Sys;
+
+/**
+ * <p/>
+ * Context encapsulates an OpenGL context.
+ * <p/>
+ *
+ * This class is thread-safe.
+ *
+ * @author elias_naur <eli...@us...>
+ * @version $Revision: 2730 $
+ * $Id: Context.java 2730 2007-01-17 12:58:38Z elias_naur $
+ */
+final class Context {
+ /**
+ * The platform specific implementation of context methods
+ */
+ private final static ContextImplementation implementation;
+
+ /** The current Context */
+ private final static ThreadLocal current_context_local = new ThreadLocal();
+
+ /**
+ * Handle to the native GL rendering context
+ */
+ private final ByteBuffer handle;
+ private final PeerInfo peer_info;
+
+ /** Whether the context has been destroyed */
+ private boolean destroyed;
+
+ private boolean destroy_requested;
+
+ /** The thread that has this context current, or null. */
+ private Thread thread;
+
+ static {
+ Sys.initialize();
+ implementation = createImplementation();
+ }
+
+ private static ContextImplementation createImplementation() {
+ switch (LWJGLUtil.getPlatform()) {
+ case LWJGLUtil.PLATFORM_WINDOWS:
+ return new WindowsContextImplementation();
+ default:
+ throw new IllegalStateException("Unsupported platform");
+ }
+ }
+
+ PeerInfo getPeerInfo() {
+ return peer_info;
+ }
+
+ static Context getCurrentContext() {
+ return (Context)current_context_local.get();
+ }
+
+ /**
+ * Create a context with the specified peer info and shared context
+ */
+ public Context(PeerInfo peer_info, Context shared_context) throws LWJGLException {
+ Context context_lock = shared_context != null ? shared_context : this;
+ // If shared_context is not null, synchronize on it to make sure it is not deleted
+ // while this context is created. Otherwise, simply synchronize on ourself to avoid NPE
+ synchronized (context_lock) {
+ if (shared_context != null && shared_context.destroyed)
+ throw new IllegalArgumentException("Shared context is destroyed");
+// GLContext.loadOpenGLLibrary();
+ try {
+ this.peer_info = peer_info;
+ this.handle = implementation.create(peer_info, shared_context != null ? shared_context.handle : null);
+ } catch (LWJGLException e) {
+// GLContext.unloadOpenGLLibrary();
+ throw e;
+ }
+ }
+ }
+
+ /**
+ * Release the current context (if any). After this call, no context is current.
+ */
+ public static void releaseCurrentContext() throws LWJGLException {
+ Context current_context = getCurrentContext();
+ if (current_context != null) {
+ implementation.releaseCurrentContext();
+// GLContext.useContext(null);
+ current_context_local.set(null);
+ synchronized (current_context) {
+ current_context.thread = null;
+ current_context.checkDestroy();
+ }
+ }
+ }
+
+ /**
+ * Release the context from its drawable. This is necessary on some platforms,
+ * like Mac OS X, where binding the context to a drawable and binding the context
+ * for rendering are two distinct actions and where calling releaseDrawable
+ * on every releaseCurrentContext results in artifacts.
+ */
+ public synchronized void releaseDrawable() throws LWJGLException {
+ if (destroyed)
+ throw new IllegalStateException("Context is destroyed");
+ implementation.releaseDrawable(getHandle());
+ }
+
+ /**
+ * Update the context. Should be called whenever it's drawable is moved or resized
+ */
+ public synchronized void update() {
+ if (destroyed)
+ throw new IllegalStateException("Context is destroyed");
+ implementation.update(getHandle());
+ }
+
+ /**
+ * Swap the buffers on the current context. Only valid for double-buffered contexts
+ */
+ public static void swapBuffers(PeerInfo peerInfo) throws LWJGLException {
+ implementation.swapBuffers(peerInfo);
+ }
+
+ private boolean canAccess() {
+ return thread == null || Thread.currentThread() == thread;
+ }
+
+ private void checkAccess() {
+ if (!canAccess())
+ throw new IllegalStateException("From thread " + Thread.currentThread() + ": " + thread + " already has the context current");
+ }
+
+ /**
+ * Make the context current
+ */
+ public synchronized void makeCurrent() throws LWJGLException {
+ checkAccess();
+ if (destroyed)
+ throw new IllegalStateException("Context is destroyed");
+ thread = Thread.currentThread();
+ current_context_local.set(this);
+ implementation.makeCurrent(peer_info, handle);
+// GLContext.useContext(this);
+ }
+
+ ByteBuffer getHandle() {
+ return handle;
+ }
+
+ /**
+ * Query whether the context is current
+ */
+ public synchronized boolean isCurrent() throws LWJGLException {
+ if (destroyed)
+ throw new IllegalStateException("Context is destroyed");
+ return implementation.isCurrent(handle);
+ }
+
+ private void checkDestroy() {
+ if (!destroyed && destroy_requested) {
+ try {
+ releaseDrawable();
+ implementation.destroy(peer_info, handle);
+ destroyed = true;
+ thread = null;
+// GLContext.unloadOpenGLLibrary();
+ } catch (LWJGLException e) {
+ LWJGLUtil.log("Exception occurred while destroying context: " + e);
+ }
+ }
+ }
+
+ /**
+ * Set the buffer swap interval. This call is a best-attempt at changing
+ * the monitor swap interval, which is the minimum periodicity of color buffer swaps,
+ * measured in video frame periods, and is not guaranteed to be successful.
+ *
+ * A video frame period is the time required to display a full frame of video data.
+ *
+ * @param sync true to synchronize; false to ignore synchronization
+ */
+ public static void setSwapInterval(int value) {
+ implementation.setSwapInterval(value);
+ }
+
+
+ /**
+ * Destroy the context. This method behaves the same as destroy() with the extra
+ * requirement that the context must be either current to the current thread or not
+ * current at all.
+ */
+ public synchronized void forceDestroy() throws LWJGLException {
+ checkAccess();
+ destroy();
+ }
+
+ /**
+ * Request destruction of the Context. If the context is current, no context will be current after this call.
+ * The context is destroyed when no thread has it current.
+ */
+ public synchronized void destroy() throws LWJGLException {
+ if (destroyed)
+ return;
+ destroy_requested = true;
+ boolean was_current = isCurrent();
+// int error = GL11.GL_NO_ERROR;
+ if (was_current) {
+// if (GLContext.getCapabilities() != null && GLContext.getCapabilities().OpenGL11)
+// error = GL11.glGetError();
+ releaseCurrentContext();
+ }
+ checkDestroy();
+// if (was_current && error != GL11.GL_NO_ERROR)
+// throw new OpenGLException(error);
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/ContextImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/ContextImplementation.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/ContextImplementation.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2002-2004 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+
+import org.lwjgl.LWJGLException;
+
+/**
+ * <p/>
+ * Context implementation interface.
+ * <p/>
+ *
+ * @author elias_naur <eli...@us...>
+ * @version $Revision: 2356 $
+ * $Id: ContextImplementation.java 2356 2006-06-07 06:35:52Z elias_naur $
+ */
+interface ContextImplementation {
+ /**
+ * Create a context.
+ */
+ public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException;
+
+ /**
+ * Swap the buffers of the current context. Only valid for double-buffered contexts.
+ */
+ public void swapBuffers(PeerInfo peerInfo) throws LWJGLException;
+
+ /**
+ * Release the context from its drawable, if any.
+ */
+ public void releaseDrawable(ByteBuffer context_handle) throws LWJGLException;
+
+ /**
+ * Release the current context (if any). After this call, no context is current.
+ */
+ public void releaseCurrentContext() throws LWJGLException;
+
+ /**
+ * Update the context. Should be called whenever it's drawable is moved or resized
+ */
+ public void update(ByteBuffer context_handle);
+
+ /**
+ * Query whether the context is current
+ */
+ public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException;
+
+ /**
+ * Query whether the context is current
+ */
+ public boolean isCurrent(ByteBuffer handle) throws LWJGLException;
+
+ public void setSwapInterval(int value);
+
+ /**
+ * Destroys the Context.
+ */
+ public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException;
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DAdapterIdentifier9.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DAdapterIdentifier9.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DAdapterIdentifier9.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,81 @@
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+public class D3DAdapterIdentifier9 {
+ public byte Driver[] = new byte[Direct3DConstants.MAX_DEVICE_IDENTIFIER_STRING];//512 char [MAX_DEVICE_IDENTIFIER_STRING]
+ public byte Description[] = new byte[Direct3DConstants.MAX_DEVICE_IDENTIFIER_STRING];//512 char [MAX_DEVICE_IDENTIFIER_STRING]
+ public byte DeviceName[] = new byte[32]; //32 char [32]
+ public long DriverVersion; //8 LARGE_INTEGER
+ public long VendorId; //4 DWORD
+ public long DeviceId; //4 DWORD
+ public long SubSysId; //4 DWORD
+ public long Revision; //4 DWORD
+ public GUID DeviceIdentifier = new GUID(); //16 GUID
+ public long WHQLLevel; //4 DWORD
+ private static final int D3D_ADAPTER_IDENTIFIER_BYTE_SIZE = 1100;
+ private ByteBuffer buffer;
+
+ public D3DAdapterIdentifier9() {
+ buffer = ByteBuffer.allocateDirect(D3D_ADAPTER_IDENTIFIER_BYTE_SIZE);
+ buffer.order(ByteOrder.nativeOrder());
+ }
+
+ public ByteBuffer getEmptyBuffer() {
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public ByteBuffer getBuffer() {
+ buffer.rewind();
+ buffer.put(Driver);
+ buffer.put(Description);
+ buffer.put(DeviceName);
+ buffer.putLong(DriverVersion);
+ buffer.putInt((int)VendorId);
+ buffer.putInt((int)DeviceId);
+ buffer.putInt((int)SubSysId);
+ buffer.putInt((int)Revision);
+ buffer.putInt((int)DeviceIdentifier.Data1);
+ buffer.putShort(DeviceIdentifier.Data2);
+ buffer.putShort(DeviceIdentifier.Data3);
+ buffer.put(DeviceIdentifier.Data4);
+ buffer.putInt((int)WHQLLevel);
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public void setBuffer(ByteBuffer buffer) {
+ buffer.rewind();
+ buffer.get(Driver);
+ buffer.get(Description);
+ buffer.get(DeviceName);
+ DriverVersion = buffer.getLong();
+ VendorId = buffer.getInt();
+ DeviceId = buffer.getInt();
+ SubSysId = buffer.getInt();
+ Revision = buffer.getInt();
+ DeviceIdentifier.Data1 = buffer.getInt();
+ DeviceIdentifier.Data2 = buffer.getShort();
+ DeviceIdentifier.Data3 = buffer.getShort();
+ buffer.get(DeviceIdentifier.Data4);
+ WHQLLevel = buffer.getInt();
+ }
+
+ public String toString() {
+ return
+ "\n Driver = " + new String(Driver) +
+ "\n Description = " + new String(Description) +
+ "\n DeviceName = " + new String(DeviceName) +
+ "\nDriverVersion = " + DriverVersion +
+ "\n VendorId = " + VendorId +
+ "\n DeviceId = " + DeviceId +
+ "\n SubSysId = " + SubSysId +
+ "\n Revision = " + Revision +
+ "\n WHQLLevel = " + WHQLLevel +
+ DeviceIdentifier;
+ }
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DBox.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DBox.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DBox.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,10 @@
+package org.lwjgl.d3d;
+
+public class D3DBox {
+ public int Left; //UINT
+ public int Top; //UINT
+ public int Right; //UINT
+ public int Bottom; //UINT
+ public int Front; //UINT
+ public int Back; //UINT
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DCaps9.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DCaps9.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DCaps9.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,327 @@
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+public class D3DCaps9 {
+ public int DeviceType; //4 D3DDEVTYPE
+ public int AdapterOrdinal; //4 UINT
+ public long Caps; //4 DWORD
+ public long Caps2; //4 DWORD
+ public long Caps3; //4 DWORD
+ public long PresentationIntervals; //4 DWORD
+ public long CursorCaps; //4 DWORD
+ public long DevCaps; //4 DWORD
+ public long PrimitiveMiscCaps; //4 DWORD
+ public long RasterCaps; //4 DWORD
+ public long ZCmpCaps; //4 DWORD
+ public long SrcBlendCaps; //4 DWORD
+ public long DestBlendCaps; //4 DWORD
+ public long AlphaCmpCaps; //4 DWORD
+ public long ShadeCaps; //4 DWORD
+ public long TextureCaps; //4 DWORD
+ public long TextureFilterCaps; //4 DWORD
+ public long CubeTextureFilterCaps; //4 DWORD
+ public long VolumeTextureFilterCaps; //4 DWORD
+ public long TextureAddressCaps; //4 DWORD
+ public long VolumeTextureAddressCaps; //4 DWORD
+ public long LineCaps; //4 DWORD
+ public long MaxTextureWidth; //4 DWORD
+ public long MaxTextureHeight; //4 DWORD
+ public long MaxVolumeExtent; //4 DWORD
+ public long MaxTextureRepeat; //4 DWORD
+ public long MaxTextureAspectRatio; //4 DWORD
+ public long MaxAnisotropy; //4 DWORD
+ public float MaxVertexW; //4
+ public float GuardBandLeft; //4
+ public float GuardBandTop; //4
+ public float GuardBandRight; //4
+ public float GuardBandBottom; //4
+ public float ExtentsAdjust; //4
+ public long StencilCaps; //4 DWORD
+ public long FVFCaps; //4 DWORD
+ public long TextureOpCaps; //4 DWORD
+ public long MaxTextureBlendStages; //4 DWORD
+ public long MaxSimultaneousTextures; //4 DWORD
+ public long VertexProcessingCaps; //4 DWORD
+ public long MaxActiveLights; //4 DWORD
+ public long MaxUserClipPlanes; //4 DWORD
+ public long MaxVertexBlendMatrices; //4 DWORD
+ public long MaxVertexBlendMatrixIndex; //4 DWORD
+ public float MaxPointSize; //4
+ public long MaxPrimitiveCount; //4 DWORD
+ public long MaxVertexIndex; //4 DWORD
+ public long MaxStreams; //4 DWORD
+ public long MaxStreamStride; //4 DWORD
+ public long VertexShaderVersion; //4 DWORD
+ public long MaxVertexShaderConst; //4 DWORD
+ public long PixelShaderVersion; //4 DWORD
+ public float PixelShader1xMaxValue; //4
+ public long DevCaps2; //4 DWORD
+ public float MaxNpatchTessellationLevel; //4
+ public long Reserved5; //4 DWORD
+ public int MasterAdapterOrdinal; //4 UINT
+ public int AdapterOrdinalInGroup; //4 UINT
+ public int NumberOfAdaptersInGroup; //4 UINT
+ public long DeclTypes; //4 DWORD
+ public long NumSimultaneousRTs; //4 DWORD
+ public long StretchRectFilterCaps; //4 DWORD
+ public D3DVShaderCaps2_0 VS20Caps = new D3DVShaderCaps2_0(); //16 D3DVSHADERCAPS2_0
+ public D3DPShaderCaps2_0 D3DPSHADERCAPS2_0 = new D3DPShaderCaps2_0(); //20 D3DPSHADERCAPS2_0
+ public long VertexTextureFilterCaps; //4 DWORD
+ public long MaxVShaderInstructionsExecuted; //4 DWORD
+ public long MaxPShaderInstructionsExecuted; //4 DWORD
+ public long MaxVertexShader30InstructionSlots; //4 DWORD
+ public long MaxPixelShader30InstructionSlots; //4 DWORD
+ private static final int D3D_CAPS_BYTE_SIZE = 304;
+
+ private ByteBuffer buffer;
+
+ public D3DCaps9() {
+ buffer = ByteBuffer.allocateDirect(D3D_CAPS_BYTE_SIZE);
+ buffer.order(ByteOrder.nativeOrder());
+ buffer.clear();
+ }
+
+ public ByteBuffer getEmptyBuffer() {
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public ByteBuffer getBuffer() {
+ buffer.rewind();
+ buffer.putInt(DeviceType);
+ buffer.putInt(AdapterOrdinal);
+ buffer.putInt((int)Caps);
+ buffer.putInt((int)Caps2);
+ buffer.putInt((int)Caps3);
+ buffer.putInt((int)PresentationIntervals);
+ buffer.putInt((int)CursorCaps);
+ buffer.putInt((int)DevCaps);
+ buffer.putInt((int)PrimitiveMiscCaps);
+ buffer.putInt((int)RasterCaps);
+ buffer.putInt((int)ZCmpCaps);
+ buffer.putInt((int)SrcBlendCaps);
+ buffer.putInt((int)DestBlendCaps);
+ buffer.putInt((int)AlphaCmpCaps);
+ buffer.putInt((int)ShadeCaps);
+ buffer.putInt((int)TextureCaps);
+ buffer.putInt((int)TextureFilterCaps);
+ buffer.putInt((int)CubeTextureFilterCaps);
+ buffer.putInt((int)VolumeTextureFilterCaps);
+ buffer.putInt((int)TextureAddressCaps);
+ buffer.putInt((int)VolumeTextureAddressCaps);
+ buffer.putInt((int)LineCaps);
+ buffer.putInt((int)MaxTextureWidth);
+ buffer.putInt((int)MaxTextureHeight);
+ buffer.putInt((int)MaxVolumeExtent);
+ buffer.putInt((int)MaxTextureRepeat);
+ buffer.putInt((int)MaxTextureAspectRatio);
+ buffer.putInt((int)MaxAnisotropy);
+ buffer.putFloat(MaxVertexW);
+ buffer.putFloat(GuardBandLeft);
+ buffer.putFloat(GuardBandTop);
+ buffer.putFloat(GuardBandRight);
+ buffer.putFloat(GuardBandBottom);
+ buffer.putFloat(ExtentsAdjust);
+ buffer.putInt((int)StencilCaps);
+ buffer.putInt((int)FVFCaps);
+ buffer.putInt((int)TextureOpCaps);
+ buffer.putInt((int)MaxTextureBlendStages);
+ buffer.putInt((int)MaxSimultaneousTextures);
+ buffer.putInt((int)VertexProcessingCaps);
+ buffer.putInt((int)MaxActiveLights);
+ buffer.putInt((int)MaxUserClipPlanes);
+ buffer.putInt((int)MaxVertexBlendMatrices);
+ buffer.putInt((int)MaxVertexBlendMatrixIndex);
+ buffer.putFloat(MaxPointSize);
+ buffer.putInt((int)MaxPrimitiveCount);
+ buffer.putInt((int)MaxVertexIndex);
+ buffer.putInt((int)MaxStreams);
+ buffer.putInt((int)MaxStreamStride);
+ buffer.putInt((int)VertexShaderVersion);
+ buffer.putInt((int)MaxVertexShaderConst);
+ buffer.putInt((int)PixelShaderVersion);
+ buffer.putFloat(PixelShader1xMaxValue);
+ buffer.putInt((int)DevCaps2);
+ buffer.putFloat(MaxNpatchTessellationLevel);
+ buffer.putInt((int)Reserved5);
+ buffer.putInt(MasterAdapterOrdinal);
+ buffer.putInt(AdapterOrdinalInGroup);
+ buffer.putInt(NumberOfAdaptersInGroup);
+ buffer.putInt((int)DeclTypes);
+ buffer.putInt((int)NumSimultaneousRTs);
+ buffer.putInt((int)StretchRectFilterCaps);
+ buffer.putInt((int)VS20Caps.Caps);
+ buffer.putInt(VS20Caps.DynamicFlowControlDepth);
+ buffer.putInt(VS20Caps.NumTemps);
+ buffer.putInt(VS20Caps.StaticFlowControlDepth);
+ buffer.putInt((int)D3DPSHADERCAPS2_0.Caps);
+ buffer.putInt(D3DPSHADERCAPS2_0.DynamicFlowControlDepth);
+ buffer.putInt(D3DPSHADERCAPS2_0.NumTemps);
+ buffer.putInt(D3DPSHADERCAPS2_0.StaticFlowControlDepth);
+ buffer.putInt(D3DPSHADERCAPS2_0.NumInstructionSlots);
+ buffer.putInt((int)VertexTextureFilterCaps);
+ buffer.putInt((int)MaxVShaderInstructionsExecuted);
+ buffer.putInt((int)MaxPShaderInstructionsExecuted);
+ buffer.putInt((int)MaxVertexShader30InstructionSlots);
+ buffer.putInt((int)MaxPixelShader30InstructionSlots);
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public void setBuffer(ByteBuffer buffer) {
+ buffer.rewind();
+ DeviceType = buffer.getInt();
+ AdapterOrdinal = buffer.getInt();
+ Caps = buffer.getInt();
+ Caps2 = buffer.getInt();
+ Caps3 = buffer.getInt();
+ PresentationIntervals = buffer.getInt();
+ CursorCaps = buffer.getInt();
+ DevCaps = buffer.getInt();
+ PrimitiveMiscCaps = buffer.getInt();
+ RasterCaps = buffer.getInt();
+ ZCmpCaps = buffer.getInt();
+ SrcBlendCaps = buffer.getInt();
+ DestBlendCaps = buffer.getInt();
+ AlphaCmpCaps = buffer.getInt();
+ ShadeCaps = buffer.getInt();
+ TextureCaps = buffer.getInt();
+ TextureFilterCaps = buffer.getInt();
+ CubeTextureFilterCaps = buffer.getInt();
+ VolumeTextureFilterCaps = buffer.getInt();
+ TextureAddressCaps = buffer.getInt();
+ VolumeTextureAddressCaps = buffer.getInt();
+ LineCaps = buffer.getInt();
+ MaxTextureWidth = buffer.getInt();
+ MaxTextureHeight = buffer.getInt();
+ MaxVolumeExtent = buffer.getInt();
+ MaxTextureRepeat = buffer.getInt();
+ MaxTextureAspectRatio = buffer.getInt();
+ MaxAnisotropy = buffer.getInt();
+ MaxVertexW = buffer.getFloat();
+ GuardBandLeft = buffer.getFloat();
+ GuardBandTop = buffer.getFloat();
+ GuardBandRight = buffer.getFloat();
+ GuardBandBottom = buffer.getFloat();
+ ExtentsAdjust = buffer.getFloat();
+ StencilCaps = buffer.getInt();
+ FVFCaps = buffer.getInt();
+ TextureOpCaps = buffer.getInt();
+ MaxTextureBlendStages = buffer.getInt();
+ MaxSimultaneousTextures = buffer.getInt();
+ VertexProcessingCaps = buffer.getInt();
+ MaxActiveLights = buffer.getInt();
+ MaxUserClipPlanes = buffer.getInt();
+ MaxVertexBlendMatrices = buffer.getInt();
+ MaxVertexBlendMatrixIndex = buffer.getInt();
+ MaxPointSize = buffer.getFloat();
+ MaxPrimitiveCount = buffer.getInt();
+ MaxVertexIndex = buffer.getInt();
+ MaxStreams = buffer.getInt();
+ MaxStreamStride = buffer.getInt();
+ VertexShaderVersion = buffer.getInt();
+ MaxVertexShaderConst = buffer.getInt();
+ PixelShaderVersion = buffer.getInt();
+ PixelShader1xMaxValue = buffer.getFloat();
+ DevCaps2 = buffer.getInt();
+ MaxNpatchTessellationLevel = buffer.getFloat();
+ Reserved5 = buffer.getInt();
+ MasterAdapterOrdinal = buffer.getInt();
+ AdapterOrdinalInGroup = buffer.getInt();
+ NumberOfAdaptersInGroup = buffer.getInt();
+ DeclTypes = buffer.getInt();
+ NumSimultaneousRTs = buffer.getInt();
+ StretchRectFilterCaps = buffer.getInt();
+ VS20Caps.Caps = buffer.getInt();
+ VS20Caps.DynamicFlowControlDepth = buffer.getInt();
+ VS20Caps.NumTemps = buffer.getInt();
+ VS20Caps.StaticFlowControlDepth = buffer.getInt();
+ D3DPSHADERCAPS2_0.Caps = buffer.getInt();
+ D3DPSHADERCAPS2_0.DynamicFlowControlDepth = buffer.getInt();
+ D3DPSHADERCAPS2_0.NumTemps = buffer.getInt();
+ D3DPSHADERCAPS2_0.StaticFlowControlDepth = buffer.getInt();
+ D3DPSHADERCAPS2_0.NumInstructionSlots = buffer.getInt();
+ VertexTextureFilterCaps = buffer.getInt();
+ MaxVShaderInstructionsExecuted = buffer.getInt();
+ MaxPShaderInstructionsExecuted = buffer.getInt();
+ MaxVertexShader30InstructionSlots = buffer.getInt() & 0x00000000ffffffffL;
+ MaxPixelShader30InstructionSlots = buffer.getInt();
+ }
+
+ public String toString() {
+ return
+ "\n DeviceType = " + DeviceType +
+ "\n AdapterOrdinal = " + AdapterOrdinal +
+ "\n Caps = " + Caps +
+ "\n Caps2 = " + Caps2 +
+ "\n Caps3 = " + Caps3 +
+ "\n PresentationIntervals = " + PresentationIntervals +
+ "\n CursorCaps = " + CursorCaps +
+ "\n DevCaps = " + DevCaps +
+ "\n PrimitiveMiscCaps = " + PrimitiveMiscCaps +
+ "\n RasterCaps = " + RasterCaps +
+ "\n ZCmpCaps = " + ZCmpCaps +
+ "\n SrcBlendCaps = " + SrcBlendCaps +
+ "\n DestBlendCaps = " + DestBlendCaps +
+ "\n AlphaCmpCaps = " + AlphaCmpCaps +
+ "\n ShadeCaps = " + ShadeCaps +
+ "\n TextureCaps = " + TextureCaps +
+ "\n TextureFilterCaps = " + TextureFilterCaps +
+ "\n CubeTextureFilterCaps = " + CubeTextureFilterCaps +
+ "\n VolumeTextureFilterCaps = " + VolumeTextureFilterCaps +
+ "\n TextureAddressCaps = " + TextureAddressCaps +
+ "\n VolumeTextureAddressCaps = " + VolumeTextureAddressCaps +
+ "\n LineCaps = " + LineCaps +
+ "\n MaxTextureWidth = " + MaxTextureWidth +
+ "\n MaxTextureHeight = " + MaxTextureHeight +
+ "\n MaxVolumeExtent = " + MaxVolumeExtent +
+ "\n MaxTextureRepeat = " + MaxTextureRepeat +
+ "\n MaxTextureAspectRatio = " + MaxTextureAspectRatio +
+ "\n MaxAnisotropy = " + MaxAnisotropy +
+ "\n MaxVertexW = " + MaxVertexW +
+ "\n GuardBandLeft = " + GuardBandLeft +
+ "\n GuardBandTop = " + GuardBandTop +
+ "\n GuardBandRight = " + GuardBandRight +
+ "\n GuardBandBottom = " + GuardBandBottom +
+ "\n ExtentsAdjust = " + ExtentsAdjust +
+ "\n StencilCaps = " + StencilCaps +
+ "\n FVFCaps = " + FVFCaps +
+ "\n TextureOpCaps = " + TextureOpCaps +
+ "\n MaxTextureBlendStages = " + MaxTextureBlendStages +
+ "\n MaxSimultaneousTextures = " + MaxSimultaneousTextures +
+ "\n VertexProcessingCaps = " + VertexProcessingCaps +
+ "\n MaxActiveLights = " + MaxActiveLights +
+ "\n MaxUserClipPlanes = " + MaxUserClipPlanes +
+ "\n MaxVertexBlendMatrices = " + MaxVertexBlendMatrices +
+ "\n MaxVertexBlendMatrixIndex = " + MaxVertexBlendMatrixIndex +
+ "\n MaxPointSize = " + MaxPointSize +
+ "\n MaxPrimitiveCount = " + MaxPrimitiveCount +
+ "\n MaxVertexIndex = " + MaxVertexIndex +
+ "\n MaxStreams = " + MaxStreams +
+ "\n MaxStreamStride = " + MaxStreamStride +
+ "\n VertexShaderVersion = " + VertexShaderVersion +
+ "\n MaxVertexShaderConst = " + MaxVertexShaderConst +
+ "\n PixelShaderVersion = " + PixelShaderVersion +
+ "\n PixelShader1xMaxValue = " + PixelShader1xMaxValue +
+ "\n DevCaps2 = " + DevCaps2 +
+ "\n MaxNpatchTessellationLevel = " + MaxNpatchTessellationLevel +
+ "\n Reserved5 = " + Reserved5 +
+ "\n MasterAdapterOrdinal = " + MasterAdapterOrdinal +
+ "\n AdapterOrdinalInGroup = " + AdapterOrdinalInGroup +
+ "\n NumberOfAdaptersInGroup = " + NumberOfAdaptersInGroup +
+ "\n DeclTypes = " + DeclTypes +
+ "\n NumSimultaneousRTs = " + NumSimultaneousRTs +
+ "\n StretchRectFilterCaps = " + StretchRectFilterCaps +
+ VS20Caps.toString() +
+ D3DPSHADERCAPS2_0.toString() +
+ "\n VertexTextureFilterCaps = " + VertexTextureFilterCaps +
+ "\n MaxVShaderInstructionsExecuted = " + MaxVShaderInstructionsExecuted +
+ "\n MaxPShaderInstructionsExecuted = " + MaxPShaderInstructionsExecuted +
+ "\nMaxVertexShader30InstructionSlots = " + MaxVertexShader30InstructionSlots +
+ "\n MaxPixelShader30InstructionSlots = " + MaxPixelShader30InstructionSlots;
+ }
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DClipStatus9.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DClipStatus9.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DClipStatus9.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,42 @@
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+public class D3DClipStatus9 {
+ public long ClipUnion; //4 DWORD
+ public long ClipIntersection; //4 DWORD
+ private static final int D3D_CLIP_STATUS_BYTE_SIZE = 8;
+
+ private ByteBuffer buffer;
+
+ public D3DClipStatus9() {
+ buffer = ByteBuffer.allocateDirect(D3D_CLIP_STATUS_BYTE_SIZE);
+ buffer.order(ByteOrder.nativeOrder());
+ buffer.clear();
+ }
+
+ public ByteBuffer getEmptyBuffer() {
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public ByteBuffer getBuffer() {
+ buffer.rewind();
+ buffer.putInt((int)ClipUnion);
+ buffer.putInt((int)ClipIntersection);
+
+ return buffer;
+ }
+ public void setBuffer(ByteBuffer buffer) {
+ buffer.rewind();
+ ClipUnion = buffer.getInt();
+ ClipIntersection = buffer.getInt();
+ }
+ public String toString() {
+ return
+ "\n ClipUnion = " + ClipUnion +
+ "\nClipIntersection = " + ClipIntersection;
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DColorValue.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DColorValue.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DColorValue.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,44 @@
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+public class D3DColorValue {
+ public float r;
+ public float g;
+ public float b;
+ public float a;
+
+ private static final int D3D_COLOR_VALUE_BYTE_SIZE = 16;
+ private ByteBuffer buffer;
+
+ public D3DColorValue() {
+ buffer = ByteBuffer.allocateDirect(D3D_COLOR_VALUE_BYTE_SIZE);
+ buffer.order(ByteOrder.nativeOrder());
+ }
+
+ public ByteBuffer getEmptyBuffer() {
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public ByteBuffer getBuffer() {
+ buffer.rewind();
+ buffer.putFloat(r);
+ buffer.putFloat(g);
+ buffer.putFloat(b);
+ buffer.putFloat(a);
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public void setBuffer(ByteBuffer buffer) {
+ buffer.rewind();
+ r = buffer.getFloat();
+ g = buffer.getFloat();
+ b = buffer.getFloat();
+ a = buffer.getFloat();
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDeviceCreationParameters.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDeviceCreationParameters.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDeviceCreationParameters.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,50 @@
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+public class D3DDeviceCreationParameters {
+ public int AdapterOrdinal; //4 UINT
+ public int DeviceType; //4 D3DDEVTYPE
+ public long hFocusWindow; //4 HWND
+ public long BehaviorFlags; //4 DWORD
+ private static final int D3D_CREATION_PARAMETERS_STATUS_BYTE_SIZE = 16;
+
+ private ByteBuffer buffer;
+
+ public D3DDeviceCreationParameters() {
+ buffer = ByteBuffer.allocateDirect(D3D_CREATION_PARAMETERS_STATUS_BYTE_SIZE);
+ buffer.order(ByteOrder.nativeOrder());
+ buffer.clear();
+ }
+
+ public ByteBuffer getEmptyBuffer() {
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public ByteBuffer getBuffer() {
+ buffer.rewind();
+ buffer.putInt(AdapterOrdinal);
+ buffer.putInt(DeviceType);
+ buffer.putInt((int)hFocusWindow);
+ buffer.putInt((int)BehaviorFlags);
+
+ return buffer;
+ }
+ public void setBuffer(ByteBuffer buffer) {
+ buffer.rewind();
+ AdapterOrdinal = buffer.getInt();
+ DeviceType = buffer.getInt();
+ hFocusWindow = buffer.getInt();
+ BehaviorFlags = buffer.getInt();
+ }
+ public String toString() {
+ return
+ "\nAdapterOrdinal = " + AdapterOrdinal +
+ "\n DeviceType = " + DeviceType +
+ "\n hFocusWindow = " + hFocusWindow +
+ "\n BehaviorFlags = " + BehaviorFlags;
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDisplaymode.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDisplaymode.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDisplaymode.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,51 @@
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+public class D3DDisplaymode {
+ public int Width; //4 UINT
+ public int Height; //4 UINT
+ public int RefreshRate; //4 UINT
+ public int Format; //4 D3DFORMAT
+ private static final int D3D_DISPLAYMODE_BYTE_SIZE = 16;
+ private ByteBuffer buffer;
+
+ public D3DDisplaymode() {
+ buffer = ByteBuffer.allocateDirect(D3D_DISPLAYMODE_BYTE_SIZE);
+ buffer.order(ByteOrder.nativeOrder());
+ }
+
+ public ByteBuffer getEmptyBuffer() {
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public ByteBuffer getBuffer() {
+ buffer.rewind();
+ buffer.putInt(Width);
+ buffer.putInt(Height);
+ buffer.putInt(RefreshRate);
+ buffer.putInt(Format);
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public void setBuffer(ByteBuffer buffer) {
+ buffer.rewind();
+ Width = buffer.getInt();
+ Height = buffer.getInt();
+ RefreshRate = buffer.getInt();
+ Format = buffer.getInt();
+ }
+
+ public String toString() {
+ return
+ "\n width = " + Width +
+ "\n height = " + Height +
+ "\nrefreshRate = " + RefreshRate +
+ "\n format = " + Format;
+ }
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDisplaymodeEx.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDisplaymodeEx.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDisplaymodeEx.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,11 @@
+package org.lwjgl.d3d;
+
+public class D3DDisplaymodeEx {
+ public int Size; //UINT
+ public int Width; //UINT
+ public int Height; //UINT
+ public int RefreshRate; //UINT
+ public int Format; //D3DFORMAT
+ public int ScanLineOrdering; //D3DSCANLINEORDERING
+
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDisplaymodeFilter.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDisplaymodeFilter.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DDisplaymodeFilter.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,8 @@
+package org.lwjgl.d3d;
+
+public class D3DDisplaymodeFilter {
+ public int Size; //UINT
+ public int Format; //D3DFORMAT
+ public int ScanLineOrdering; //D3DSCANLINEORDERING
+
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DGammaRamp.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DGammaRamp.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DGammaRamp.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,51 @@
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.ShortBuffer;
+
+public class D3DGammaRamp {
+ private ByteBuffer redForNative = ByteBuffer.allocateDirect(512).order(ByteOrder.nativeOrder()); //2 WORD
+ private ByteBuffer greenForNative = ByteBuffer.allocateDirect(512).order(ByteOrder.nativeOrder()); //2 WORD
+ private ByteBuffer blueForNative = ByteBuffer.allocateDirect(512).order(ByteOrder.nativeOrder()); //2 WORD
+ public ShortBuffer red = redForNative.asShortBuffer();
+ public ShortBuffer green = greenForNative.asShortBuffer();
+ public ShortBuffer blue = blueForNative.asShortBuffer();
+
+ private static final int D3D_GAMMA_RAMP_BYTE_SIZE = 1536;
+ private ByteBuffer buffer;
+
+ public D3DGammaRamp() {
+ buffer = ByteBuffer.allocateDirect(D3D_GAMMA_RAMP_BYTE_SIZE);
+ buffer.order(ByteOrder.nativeOrder());
+ }
+
+ public ByteBuffer getEmptyBuffer() {
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public ByteBuffer getBuffer() {
+ buffer.rewind();
+ redForNative.rewind();
+ buffer.put(redForNative);
+ greenForNative.rewind();
+ buffer.put(greenForNative);
+ blueForNative.rewind();
+ buffer.put(blueForNative);
+
+ return buffer;
+ }
+
+ public void setBuffer(ByteBuffer buffer) {
+ buffer.rewind();
+ byte temp[] = new byte[512];
+ buffer.get(temp);
+ redForNative.put(temp);
+ buffer.get(temp);
+ greenForNative.put(temp);
+ buffer.get(temp);
+ blueForNative.put(temp);
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DIndexBufferDesc.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DIndexBufferDesc.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DIndexBufferDesc.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,9 @@
+package org.lwjgl.d3d;
+
+public class D3DIndexBufferDesc {
+ public int Format; //D3DFORMAT
+ public int Type; //D3DRESOURCETYPE
+ public long Usage; //DWORD
+ public int Pool; //D3DPOOL
+ public int Size; //UINT
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DLight9.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DLight9.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DLight9.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,78 @@
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+public class D3DLight9 {
+ public int Type; //2 D3DLIGHTTYPE
+ public D3DColorValue Diffuse; //16 D3DCOLORVALUE
+ public D3DColorValue Specular; //16 D3DCOLORVALUE
+ public D3DColorValue Ambient; //16 D3DCOLORVALUE
+ public D3DVector Position; //12 D3DVECTOR
+ public D3DVector Direction; //12 D3DVECTOR
+ public float Range; //4
+ public float Falloff; //4
+ public float Attenuation0; //4
+ public float Attenuation1; //4
+ public float Attenuation2; //4
+ public float Theta; //4
+ public float Phi; //4
+
+ private static final int D3D_LIGHT_BYTE_SIZE = 102;
+ private ByteBuffer buffer;
+
+ public D3DLight9() {
+ buffer = ByteBuffer.allocateDirect(D3D_LIGHT_BYTE_SIZE);
+ buffer.order(ByteOrder.nativeOrder());
+ }
+
+ public ByteBuffer getEmptyBuffer() {
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public ByteBuffer getBuffer() {
+ buffer.rewind();
+ buffer.putShort((short)Type);
+ buffer.put(Diffuse.getBuffer());
+ buffer.put(Specular.getBuffer());
+ buffer.put(Ambient.getBuffer());
+ buffer.put(Position.getBuffer());
+ buffer.put(Direction.getBuffer());
+ buffer.putFloat(Range);
+ buffer.putFloat(Falloff);
+ buffer.putFloat(Attenuation1);
+ buffer.putFloat(Attenuation1);
+ buffer.putFloat(Attenuation2);
+ buffer.putFloat(Theta);
+ buffer.putFloat(Phi);
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public void setBuffer(ByteBuffer buffer) {
+ buffer.rewind();
+ Type = buffer.getShort();
+ byte temp[] = new byte[16];
+ buffer.get(temp);
+ Diffuse.setBuffer(Diffuse.getEmptyBuffer().put(temp));
+ buffer.get(temp);
+ Specular.setBuffer(Specular.getEmptyBuffer().put(temp));
+ buffer.get(temp);
+ Ambient.setBuffer(Ambient.getEmptyBuffer().put(temp));
+ temp = new byte[12];
+ buffer.get(temp);
+ Position.setBuffer(Position.getEmptyBuffer().put(temp));
+ buffer.get(temp);
+ Direction.setBuffer(Direction.getEmptyBuffer().put(temp));
+ Range = buffer.getFloat();
+ Falloff = buffer.getFloat();
+ Attenuation1 = buffer.getFloat();
+ Attenuation1 = buffer.getFloat();
+ Attenuation2 = buffer.getFloat();
+ Theta = buffer.getFloat();
+ Phi = buffer.getFloat();
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DLockedBox.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DLockedBox.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DLockedBox.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,9 @@
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+
+public class D3DLockedBox {
+ public int RowPitch;
+ public int SlicePitch;
+ public ByteBuffer pBits;
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DLockedRect.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DLockedRect.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DLockedRect.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,9 @@
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+
+public class D3DLockedRect {
+ int Pitch;
+ public ByteBuffer pBits; //void *
+
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DMaterial9.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DMaterial9.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DMaterial9.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,51 @@
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+public class D3DMaterial9 {
+ public D3DColorValue Diffuse; //16
+ public D3DColorValue Ambient; //16
+ public D3DColorValue Specular; //16
+ public D3DColorValue Emissive; //16
+ public float Power; //4
+
+ private static final int D3D_MATERIAL_BYTE_SIZE = 68;
+ private ByteBuffer buffer;
+
+ public D3DMaterial9() {
+ buffer = ByteBuffer.allocateDirect(D3D_MATERIAL_BYTE_SIZE);
+ buffer.order(ByteOrder.nativeOrder());
+ }
+
+ public ByteBuffer getEmptyBuffer() {
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public ByteBuffer getBuffer() {
+ buffer.rewind();
+ buffer.put(Diffuse.getBuffer());
+ buffer.put(Ambient.getBuffer());
+ buffer.put(Specular.getBuffer());
+ buffer.put(Emissive.getBuffer());
+ buffer.putFloat(Power);
+
+ return buffer;
+ }
+
+ public void setBuffer(ByteBuffer buffer) {
+ buffer.rewind();
+ byte temp[] = new byte[16];
+ buffer.get(temp);
+ Diffuse.setBuffer(Diffuse.getEmptyBuffer().put(temp));
+ buffer.get(temp);
+ Ambient.setBuffer(Ambient.getEmptyBuffer().put(temp));
+ buffer.get(temp);
+ Specular.setBuffer(Specular.getEmptyBuffer().put(temp));
+ buffer.get(temp);
+ Emissive.setBuffer(Emissive.getEmptyBuffer().put(temp));
+ Power = buffer.getFloat();
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DMatrix.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DMatrix.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DMatrix.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,42 @@
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.FloatBuffer;
+
+public class D3DMatrix {
+ public float m[][] = new float[4][4];
+
+ private static final int D3D_MATRIX_BYTE_SIZE = 64;
+ private ByteBuffer buffer;
+
+ public D3DMatrix() {
+ buffer = ByteBuffer.allocateDirect(D3D_MATRIX_BYTE_SIZE);
+ buffer.order(ByteOrder.nativeOrder());
+ buffer.clear();
+ }
+
+ public ByteBuffer getEmptyBuffer() {
+ buffer.rewind();
+
+ return buffer;
+ }
+
+ public ByteBuffer getBuffer() {
+ buffer.rewind();
+ FloatBuffer temp = buffer.asFloatBuffer();
+ for(int i=0;i<4;i++) {
+ temp.put(m[i]);
+ }
+
+ return buffer;
+ }
+
+ public void setBuffer(ByteBuffer buffer) {
+ buffer.rewind();
+ FloatBuffer temp = buffer.asFloatBuffer();
+ for(int i=0;i<4;i++) {
+ temp.get(m[i]);
+ }
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DPShaderCaps2_0.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DPShaderCaps2_0.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DPShaderCaps2_0.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,18 @@
+package org.lwjgl.d3d;
+
+public class D3DPShaderCaps2_0 {
+ public long Caps; //4 DWORD
+ public int DynamicFlowControlDepth; //4 INT
+ public int NumTemps; //4 INT
+ public int StaticFlowControlDepth; //4 INT
+ public int NumInstructionSlots; //4 INT
+
+ public String toString() {
+ return
+ "\n Caps = " + Caps +
+ "\nDynamicFlowControlDepth = " + DynamicFlowControlDepth +
+ "\n NumTemps = " + NumTemps +
+ "\n StaticFlowControlDepth = " + StaticFlowControlDepth +
+ "\n NumInstructionSlots = " + NumInstructionSlots;
+ }
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/d3d/D3DPresentParameters.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/d3d/D3DPresentParameters.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/d3d/D3DPresentParameters.java 2007-08-22 23:11:02 UTC (rev 2882)
@@ -0,0 +1,88 @@
+package org.lwjgl.d3d;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+public class D3DPresentParameters {
+ public int BackBufferWidth; //4 UINT
+ public int BackBufferHeight; //4 UINT
+ public int BackBufferFormat; //4 D3DFORMAT
+ public int BackBufferCount; //4 UINT
+ public int MultiSampleType; //4 D3DMULTISAMPLE_TYPE
+ public int MultiSampleQuality; //4 DWORD
+ public int SwapEffect; //4 D3DSWAPEFFECT
+ public long hDeviceWindow; //4 HWND
+ public boolean Windowed; //4
+ public boolean EnableAutoDepthStencil; //4
+ public int AutoDepthStencilFormat; //4 D3DFORMAT
+ public long Flags; //4 DWORD
+ public int FullScreen_RefreshRateInHz; //4 UINT
+ public int PresentationInterval; //4 UI...
[truncated message content] |