Skip to content

Commit

Permalink
Add GPU renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam- committed Nov 15, 2018
1 parent 3c84d98 commit 3f5e273
Show file tree
Hide file tree
Showing 74 changed files with 6,201 additions and 22 deletions.
Expand Up @@ -29,4 +29,9 @@
*/
public interface BufferProvider
{
int[] getPixels();

int getWidth();

int getHeight();
}
49 changes: 49 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/Client.java
Expand Up @@ -34,6 +34,7 @@
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;
Expand All @@ -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.
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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
*
Expand All @@ -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);
}
2 changes: 2 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/Constants.java
Expand Up @@ -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;
}
Expand Up @@ -38,4 +38,7 @@ public interface DecorativeObject extends TileObject
* @see net.runelite.api.model.Jarvis
*/
Polygon getConvexHull();

Renderable getRenderable();
Renderable getRenderable2();
}
2 changes: 2 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/GameEngine.java
Expand Up @@ -51,4 +51,6 @@ public interface GameEngine
* @return true if on the main thread, false otherwise
*/
boolean isClientThread();

void resizeCanvas();
}
2 changes: 2 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/GameObject.java
Expand Up @@ -67,4 +67,6 @@ public interface GameObject extends TileObject
* @return the orientation
*/
Angle getOrientation();

Renderable getRenderable();
}
Expand Up @@ -29,4 +29,5 @@
*/
public interface GroundObject extends TileObject
{
Renderable getRenderable();
}
57 changes: 57 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/Model.java
Expand Up @@ -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();
}
4 changes: 4 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/NodeCache.java
Expand Up @@ -33,4 +33,8 @@ public interface NodeCache
* Resets cache.
*/
void reset();

void setCapacity(int capacity);

void setRemainingCapacity(int remainingCapacity);
}
3 changes: 1 addition & 2 deletions runelite-api/src/main/java/net/runelite/api/Perspective.java
Expand Up @@ -36,6 +36,7 @@
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;
Expand All @@ -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

Expand Down
4 changes: 4 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/Renderable.java
Expand Up @@ -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);
}
3 changes: 3 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/Scene.java
Expand Up @@ -35,4 +35,7 @@ public interface Scene
* @return the tiles in [plane][x][y]
*/
Tile[][][] getTiles();

int getDrawDistance();
void setDrawDistance(int drawDistance);
}
29 changes: 29 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/SceneTileModel.java
Expand Up @@ -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);
}
19 changes: 19 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/SceneTilePaint.java
Expand Up @@ -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);
}
42 changes: 42 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/Texture.java
@@ -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);
}
22 changes: 21 additions & 1 deletion runelite-api/src/main/java/net/runelite/api/TextureProvider.java
Expand Up @@ -26,5 +26,25 @@

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);
}
14 changes: 14 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/Tile.java
Expand Up @@ -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.
*
Expand All @@ -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();
}
3 changes: 3 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/WallObject.java
Expand Up @@ -49,4 +49,7 @@ public interface WallObject extends TileObject
* @return the boundary configuration
*/
int getConfig();

Renderable getRenderable1();
Renderable getRenderable2();
}

1 comment on commit 3f5e273

@dosier
Copy link

@dosier dosier commented on 3f5e273 Nov 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3

Please sign in to comment.