npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

real_api

v1.1.31

Published

This is a RealAPI plugin for three.js rendering. Now you can render three.js scene at runtime by using API calls.

Downloads

15

Readme

real_api

npm release Documentation License

Render three.js scene at run time

alt output2 alt output2

Installation

npm install real_api

Documentation

Documentation

Requirements:

  • Signup free account at https://realistic3.com (You will need this for API Key Authorization)
  • App Key
  • Product Key
  • Instance ID (Optional, default is 0)
  • Kindly check the details at https://docs.realistic3.com/getting-started

Getting started

Import:

import * as REAL from "real_api";

Area light

const width = 1;
const height = 1;
const intensity = 1;
const color = new THREE.Color(0xFFFFFF);
const areaLight = new REAL.AreaLight(width, height, color, intensity);
scene.add(areaLight);

Sunlight

const config = {
    intensity: 1,
    castShadow: true,
    color: new THREE.Color(0xFFFFFF),
};
const sunLight = new REAL.SunLight(config);
scene.add(sunLight);

Spotlight

const config = {
    intensity: 1,
    distance: 5.0,
    castShadow: true,
    angle: Math.PI/12,
    color: new THREE.Color(0xFFFFFF),
};
const spotLight = new REAL.SpotLight(config);
scene.add(spotLight);

Point light

const config = {
    intensity: 1,
    distance: 5.0,
    castShadow: true,
    color: new THREE.Color(0xFFFFFF),
};
const pointLight = new REAL.PointLight(config);
scene.add(pointLight);

Render a job

Step 1: Get render scene
const eye = threeCamera; // Optional
const renderScene = await REAL.Scene(scene, eye);
Step 2: Create new job
const api = REAL.API;

const params = {
    "cred": {
        "insID": 0,
        "appKey": "ABC",
        "prodKey": "XYZ"
    },
    "type": "new",
    "render": {
        "expFrom": "app",
        "output": "PNG",
    }
}

const response = await axios.post(api, params);

Response:

{
    "msg": "SUCCESS",
    "data": {
        "jobID": "1711638968_373829",
        "expFrom": "app",
        "finished": false,
        "status": "NEW",
        "url": "https://....."
    }
}
Note: You can also render .blend, .gltf, .glb or .fbx directly by changing render parameter in request body

For example:

{
  "cred": {
    "insID": 0,
    "appKey": "ABC",
    "prodKey": "XYZ"
  },
  "type": "new",
  "render": {
    "ext": "glb",
    "expFrom": "app",
    "output": "PNG"
  }
}
Step 3: Upload scene
const uploadUri = response.data.url;
const request = await axios.put(uploadUri, realScene);
Step 4: Submit job
const params = {
    "cred": {
        "insID": 0,
        "appKey": "ABC",
        "prodKey": "XYZ"
    },
    "jobID": "1711638968_373829",
    "type": "render"
}

const response = await axios.post(api, params);

Response:

{
    "msg": "SUCCESS",
    "data": {
        "jobID": "1711638968_373829",
        "expFrom": "app",
        "finished": false,
        "status": "WAITING"
    }
}
Step 5: Check job status

You can either check live status or jobs through socket or by using API request

  • Using SOCKET: https://docs.realistic3.com/using-socket
  • Using REST API: https://docs.realistic3.com/rest-api
const params = {
    "cred": {
        "insID": 0,
        "appKey": "ABC",
        "prodKey": "XYZ"
    },
    "jobID": "1711638968_373829",
    "type": "result"
}

const response = await axios.post(api, params);

Response:

{
  "msg": "SUCCESS",
  "data": {
    "jobID": "1711638968_373829",
    "expFrom": "app",
    "finished": true,
    "result": "https://.....",
    "status": "COMPLETED"
  }
}