Skip to content

Instantly share code, notes, and snippets.

@SableRaf
Created November 21, 2020 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SableRaf/d467afdbbb8302a57f93e1bc44e46525 to your computer and use it in GitHub Desktop.
Save SableRaf/d467afdbbb8302a57f93e1bc44e46525 to your computer and use it in GitHub Desktop.
Possible Unhandled Promise Rejection: ReferenceError: Property 'VertexAttribute' doesn't exist
const Materials = require('Materials');
const Textures = require('Textures');
const Shaders = require('Shaders');
const Time = require('Time');
const Reactive = require('Reactive');
const Diagnostics = require("Diagnostics");
const {log} = require('Diagnostics');
async function main()
{
const myMaterial = await Materials.findFirst('material0');
const myCameraTexture = await (await Textures.findFirst('cameraTexture0')).signal;
log('this prints');
let uvs = await Shaders.vertexAttribute(VertexAttribute.TEX_COORDS).catch(err => log(err));
log('this does not print');
let ct = Reactive.mul(Time.ms,0.001);
let curve = Reactive.abs(Reactive.sin(ct));
let color = await Shaders.textureSampler(myCameraTexture, uvs).catch(err => log(err));
let modulationColor = Reactive.pack4(curve,0,0,1);
let finalColor = Reactive.mul(color, modulationColor);
myMaterial.setTextureSlot('DIFFUSE', finalColor);
};
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment