Coder Social home page Coder Social logo

coryborek / php-minecraft-3d-skin-renderer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ryanhecht/php-minecraft-3d-skin-renderer

0.0 1.0 0.0 182 KB

Render a 3D view of a Minecraft skin. Updated by RyanHecht to include GUI with sliders

PHP 87.46% HTML 12.54%

php-minecraft-3d-skin-renderer's Introduction

GUI with sliders for "php Minecraft 3D Skin Renderer", Made with Google's Materialize

Use the GUI here: https://ryanhecht.github.io/php-Minecraft-3D-Skin-Renderer/

Also setup Google App Engine support and caching

forked from https://github.com/Gyzie/php-Minecraft-3D-Skin-Renderer


Project first developed by supermamie. Later transalated to English by cajogos. My goal was to fix some issues and hopefully create full support for the 1.8 skins (1.8 support is partly done).

I'm no longer working on this project. I will however look into your pull-requests.

Example of URL:

The URL containing most of the options:
http://example.com/3d.php?vr=-25&hr=-25&hrh=10&vrla=5&vrra=-2&vrll=-20&vrrl=2&ratio=12&format=png&displayHair=true&headOnly=false&user=Notch
Note: The old parameters by supermamie will still work.

With less parameters:
http://example.com/3d.php?user=Notch&hrh=-20&aa=true
This example will only set the user to Notch, head rotation to -20 and AA (image smoothing) to true. You can add parameters by adding &<parameter>=<value> to the end of your URL.

Parameters

Supermamie's old parameters will still work.

Parameters are now optional (exept for user), so you can now only add those you need.

  • user = Minecraft's username for the skin to be rendered. Required
  • vr = Vertical Rotation -25 by default
  • hr = Horizontal Rotation 35 by default
  • hrh = Horizontal Rotation Head 0 by default
  • vrll = Vertical Rotation Left Leg 0 by default
  • vrrl = Vertical Rotation Right Leg 0 by default
  • vrla = Vertical Rotation Left Arm 0 by default
  • vrra = Vertical Rotation Right Arm 0 by default
  • displayHair = Either or not to display hairs. Set to "false" to NOT display hairs. true by default
  • headOnly = Either or not to display the ONLY the head. Set to "true" to display ONLY the head (and the hair, based on displayHair). false by default
  • format = The format in which the image is to be rendered. PNG ("png") is used by default. Set to "svg" to use a vector version and "base64" for an encoded base64 string of the png image. png by default
  • ratio = The size of the "png" image. The default and minimum value is 2. 12 by default
  • aa = Anti-aliasing (Not real AA, fake AA). When set to "true" the image will be smoother. false by default
  • layers = Apply extra skin layers. true by default

Using it as class

You can use the script for direct browser output (via the URL method as mentioned above), but also as a class for your scripts. Example:

include_once realpath(dirname(__FILE__) . '/3d.php');
	
$player = new render3DPlayer('Notch', '-25', '-25', '10', '5', '-2', '-20', '2', 'true', 'false', 'png', '12', 'true', 'true'); //render3DPlayer(user, vr, hr, hrh, vrll, vrrl, vrla, vrra, displayHair, headOnly, format, ratio, aa, layers)
$png = $player->get3DRender();
echo "<br/>====<br/>PNG:<br/>====<br/>";
echo $png; // TrueColor image

$player = new render3DPlayer('Notch', '-25', '-25', '10', '5', '-2', '-20', '2', 'true', 'false', 'base64', '12', 'true', 'true'); //render3DPlayer(user, vr, hr, hrh, vrll, vrrl, vrla, vrra, displayHair, headOnly, format, ratio, aa, layers)
$base64 = $player->get3DRender();
echo "<br/>========<br/>Base 64:<br/>========<br/>";
echo $base64; // Base64 string

$player = new render3DPlayer('Notch', '-25', '-25', '10', '5', '-2', '-20', '2', 'true', 'false', 'svg', '12', 'true', 'true'); //render3DPlayer(user, vr, hr, hrh, vrll, vrrl, vrla, vrra, displayHair, headOnly, format, ratio, aa, layers)
$svg = $player->get3DRender();
echo "<br/>====<br/>SVG:<br/>====<br/>";
echo $svg; // SVG String

// As above (svg example) but with a locally provided file
$player = new render3DPlayer('', '-25', '-25', '10', '5', '-2', '-20', '2', 'true', 'false', 'svg', '12', 'true', 'true', 'someskinfile.png');
$svg = $player->get3DRender();
echo "<br/>====<br/>SVG:<br/>====<br/>";
echo $svg; // SVG String

Changes Made

  • Fixed dark blue skins;
  • Fixed not working SVG images (Bug in cajogos fork);
  • Fixed non-transparent PNG images rendering incorrect (Fix is a bit experimental);
  • Fixed incorrect rendering texture parts;
  • Made the old parameters by supermamie work again;
  • Made 1.8 skins work;
  • Made 1.8 skins base layers render;
  • Added QUICK fix for 1.8 extra skin layers;
  • Added ability to output an encoded base64 string of the image;
  • Added optional AA (image smoothing) parameter;
  • Added UUID support. (Mojang does not want too many UUID requests so it might fail when you use it a lot);
  • Reformatted the entire code;
  • Made it possible to use the script as class;
  • Made all parameters optional;
  • Made Steve the fallback image.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.