Add GPU renderer

This commit is contained in:
Adam
2018-11-15 09:19:37 -05:00
parent 3c84d98638
commit 3f5e273349
74 changed files with 6201 additions and 22 deletions

View File

@@ -29,4 +29,9 @@ package net.runelite.api;
*/
public interface BufferProvider
{
int[] getPixels();
int getWidth();
int getHeight();
}

View File

@@ -34,6 +34,7 @@ import net.runelite.api.annotations.VisibleForDevtools;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.hooks.Callbacks;
import net.runelite.api.hooks.DrawCallbacks;
import net.runelite.api.vars.AccountType;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
@@ -50,6 +51,10 @@ public interface Client extends GameEngine
*/
Callbacks getCallbacks();
DrawCallbacks getDrawCallbacks();
void setDrawCallbacks(DrawCallbacks drawCallbacks);
/**
* Retrieve a global logger for the client.
* This is most useful for mixins which can't have their own.
@@ -210,6 +215,18 @@ public interface Client extends GameEngine
*/
int getWorld();
/**
* Gets the canvas height
* @return
*/
int getCanvasHeight();
/**
* Gets the canvas width
* @return
*/
int getCanvasWidth();
/**
* Gets the height of the viewport.
*
@@ -1485,6 +1502,13 @@ public interface Client extends GameEngine
*/
EnumSet<WorldType> getWorldType();
/**
* Gets the enabled state for the Oculus orb mode
*
* @return
*/
int getOculusOrbState();
/**
* Sets the enabled state for the Oculus orb state
*
@@ -1509,4 +1533,29 @@ public interface Client extends GameEngine
* @param world target world to hop to
*/
void hopToWorld(World world);
boolean isGpu();
void setGpu(boolean gpu);
int get3dZoom();
int getCenterX();
int getCenterY();
int getCameraX2();
int getCameraY2();
int getCameraZ2();
TextureProvider getTextureProvider();
NodeCache getCachedModels2();
void setRenderArea(boolean[][] renderArea);
int getRasterizer3D_clipMidX2();
int getRasterizer3D_clipNegativeMidX();
int getRasterizer3D_clipNegativeMidY();
int getRasterizer3D_clipMidY2();
void checkClickbox(Model model, int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, long hash);
}

View File

@@ -67,4 +67,6 @@ public class Constants
* the plane value to 0-3.
*/
public static final int MAX_Z = 4;
public static final int TILE_FLAG_BRIDGE = 2;
}

View File

@@ -38,4 +38,7 @@ public interface DecorativeObject extends TileObject
* @see net.runelite.api.model.Jarvis
*/
Polygon getConvexHull();
Renderable getRenderable();
Renderable getRenderable2();
}

View File

@@ -51,4 +51,6 @@ public interface GameEngine
* @return true if on the main thread, false otherwise
*/
boolean isClientThread();
void resizeCanvas();
}

View File

@@ -67,4 +67,6 @@ public interface GameObject extends TileObject
* @return the orientation
*/
Angle getOrientation();
Renderable getRenderable();
}

View File

@@ -29,4 +29,5 @@ package net.runelite.api;
*/
public interface GroundObject extends TileObject
{
Renderable getRenderable();
}

View File

@@ -46,4 +46,61 @@ public interface Model extends Renderable
* @return the triangle
*/
List<Triangle> getTriangles();
int getVerticesCount();
int[] getVerticesX();
int[] getVerticesY();
int[] getVerticesZ();
int getTrianglesCount();
int[] getTrianglesX();
int[] getTrianglesY();
int[] getTrianglesZ();
int[] getFaceColors1();
int[] getFaceColors2();
int[] getFaceColors3();
byte[] getTriangleTransparencies();
int getSceneId();
void setSceneId(int sceneId);
int getBufferOffset();
void setBufferOffset(int bufferOffset);
int getUvBufferOffset();
void setUvBufferOffset(int bufferOffset);
int getModelHeight();
void calculateBoundsCylinder();
byte[] getFaceRenderPriorities();
int getRadius();
short[] getFaceTextures();
float[][] getFaceTextureUCoordinates();
float[][] getFaceTextureVCoordinates();
void calculateExtreme(int orientation);
int getCenterX();
int getCenterY();
int getCenterZ();
int getExtremeX();
int getExtremeY();
int getExtremeZ();
int getXYZMag();
}

View File

@@ -33,4 +33,8 @@ public interface NodeCache
* Resets cache.
*/
void reset();
void setCapacity(int capacity);
void setRemainingCapacity(int remainingCapacity);
}

View File

@@ -36,6 +36,7 @@ import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static net.runelite.api.Constants.TILE_FLAG_BRIDGE;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.model.Jarvis;
import net.runelite.api.model.Triangle;
@@ -56,8 +57,6 @@ public class Perspective
public static final int SCENE_SIZE = Constants.SCENE_SIZE; // in tiles
private static final int TILE_FLAG_BRIDGE = 2;
public static final int[] SINE = new int[2048]; // sine angles for each of the 2048 units, * 65536 and stored as an int
public static final int[] COSINE = new int[2048]; // cosine

View File

@@ -35,4 +35,8 @@ public interface Renderable extends Node
* @return the model
*/
Model getModel();
void setModelHeight(int modelHeight);
void draw(int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, long hash);
}

View File

@@ -35,4 +35,7 @@ public interface Scene
* @return the tiles in [plane][x][y]
*/
Tile[][][] getTiles();
int getDrawDistance();
void setDrawDistance(int drawDistance);
}

View File

@@ -56,4 +56,33 @@ public interface SceneTileModel
* @return the rotation
*/
int getRotation();
int[] getFaceX();
int[] getFaceY();
int[] getFaceZ();
int[] getVertexX();
int[] getVertexY();
int[] getVertexZ();
int[] getTriangleColorA();
int[] getTriangleColorB();
int[] getTriangleColorC();
int[] getTriangleTextureId();
int getBufferOffset();
void setBufferOffset(int bufferOffset);
int getUvBufferOffset();
void setUvBufferOffset(int bufferOffset);
int getBufferLen();
void setBufferLen(int bufferLen);
}

View File

@@ -35,4 +35,23 @@ public interface SceneTilePaint
* @return the paint RGB
*/
int getRBG();
int getSwColor();
int getSeColor();
int getNwColor();
int getNeColor();
int getTexture();
int getBufferOffset();
void setBufferOffset(int bufferOffset);
int getUvBufferOffset();
void setUvBufferOffset(int bufferOffset);
int getBufferLen();
void setBufferLen(int bufferLen);
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. 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.
*
* 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 net.runelite.api;
public interface Texture extends Node
{
int[] getPixels();
int getAnimationDirection();
int getAnimationSpeed();
boolean isLoaded();
float getU();
void setU(float u);
float getV();
void setV(float v);
}

View File

@@ -26,5 +26,25 @@ package net.runelite.api;
public interface TextureProvider
{
void checkTextures(int var1);
double getBrightness();
/**
* Set the brightness for textures, clearing the texture cache.
* @param brightness
*/
void setBrightness(double brightness);
/**
* Get all textures
*
* @return
*/
Texture[] getTextures();
/**
* Get the pixels for a texture
* @param textureId
* @return
*/
int[] load(int textureId);
}

View File

@@ -110,6 +110,13 @@ public interface Tile
*/
int getPlane();
/**
* Get the plane this tile is rendered on, which is where the tile heights are from.
*
* @return
*/
int getRenderLevel();
/**
* Computes and returns whether this tile has line of sight to another.
*
@@ -124,4 +131,11 @@ public interface Tile
* @return the ground items
*/
List<Item> getGroundItems();
/**
* Return the tile under this one, if this tile is a bridge
*
* @return
*/
Tile getBridge();
}

View File

@@ -49,4 +49,7 @@ public interface WallObject extends TileObject
* @return the boundary configuration
*/
int getConfig();
Renderable getRenderable1();
Renderable getRenderable2();
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. 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.
*
* 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 net.runelite.api.hooks;
import net.runelite.api.Renderable;
import net.runelite.api.SceneTileModel;
import net.runelite.api.SceneTilePaint;
import net.runelite.api.Texture;
public interface DrawCallbacks
{
void draw(Renderable renderable, int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, long hash);
void drawScenePaint(int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z,
SceneTilePaint paint, int tileZ, int tileX, int tileY,
int zoom, int centerX, int centerY);
void drawSceneModel(int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z,
SceneTileModel model, int tileZ, int tileX, int tileY,
int zoom, int centerX, int centerY);
void draw();
void drawScene(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane);
void animate(Texture texture, int diff);
}