Guest User

Untitled

a guest
Dec 14th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1. WEBGL // p5 WEBGL rendering mode.
  2. createCanvas(w, h, renderer) // Creates a 3D canvas (if renderer is WEBGL).
  3.  
  4. // Primitives
  5. plane(width, height) // Creates a plane in 3D space. Equivalent to rect() in the default rendering mode.
  6. plane(width, height, detailX, detailY) // Creates a plane in 3D space with the number of triangle subdivisions specified.
  7. box(width) // Creates a cube in 3D space.
  8. box(width, height, depth) // Creates a cuboid in 3D space.
  9. box(width, height, depth, detailX, detailY) // Creates a cuboid in 3D space with triangle subdivisions.
  10. sphere(radius) // Creates a sphere in 3D space.
  11. sphere(radius, detailX, detailY) // Creates a sphere in 3D space with the number of triangle subdivisions specified.
  12. cylinder(radius, height) // Creates a cylinder in 3D space.
  13. cylinder(radius, height, detailX, detailY) // Creates a cylinder in 3D space with the number of segments specified.
  14. cone(radius, height) // Creates a cone in 3D space.
  15. cone(radius, height, detailX, detailY) // Creates a cone in 3D space with the number of segments specified.
  16. ellipsoid(radiusx, radiusy, radiusz) // Creates an ellipsoid in 3D space.
  17. ellipsoid(radiusx, radiusy, radiusz, detailX, detailY) // Creates an ellipsoid in 3D space with the number of triangle subdivisions specified.
  18. torus(radius, tubeRadius) // Creates a torus in 3D space.
  19. torus(radius, tubeRadius, detailX, detailY) // Creates a torus in 3D space with the number of triangle subdivisions specified.
  20.  
  21. // Models
  22. loadModel(path) // Loads a model.
  23. loadModel(path, successCallback) // Loads a model.
  24. loadModel(path, successCallback, failureCallback) // Loads a model.
  25. model(model) // Draws a model
  26.  
  27. // Transformations
  28. translate(x, y, z) // Moves the origin by x,y,z.
  29. rotateX(rad) // Rotates the view along the x-axis.
  30. rotateY(rad) // Rotates the view along the y-axis.
  31. rotateZ(rad) // Rotates the view along the z-axis.
  32. rotate(angle, axis) // Rotates the view along the axis specified.
  33.  
  34. // Camera
  35. camera(x, y, z, centerX, centerY, centerZ, upX, upY, upZ) // Moves the camera to the points specified.
  36. perspective(fov, aspect, near, far) // Changes the perspective to the numbers specified.
  37. ortho() // Changes the perspective to an ortho perspective with the numbers specified.
  38. ortho(left, right, bottom, top, near, far) // Changes the perspective to an ortho perspective with the numbers specified.
  39.  
  40. // Lights
  41. ambientLight(v1, v2, v3) // Adds an ambient light (RGB or HSB color).
  42. ambientLight(v1, v2, v3, alpha) // Adds an ambient light (RGB or HSB color).
  43. ambientLight(value) // Adds an ambient light (color string).
  44. ambientLight(value, alpha) // Adds an ambient light (color string).
  45. ambientLight(values) // Adds an ambient light (color array).
  46. ambientLight(color) // Adds an ambient light (color object).
  47. directionalLight(v1, v2, v3, x, y, z) // Adds a directional light (RGB or HSB color).
  48. directionalLight(v1, v2, v3, direction) // Adds a directional light (RGB or HSB color).
  49. directionalLight(color, x, y, z) // Adds a directional light (color object).
  50. directionalLight(color, direction) // Adds a directional light (color object).
  51. pointLight(v1, v2, v3, position) // Adds a point light (RGB or HSB color).
  52. pointLight(v1, v2, v3, x, y, z) // Adds a point light (RGB or HSB color).
  53. pointLight(color, x, y, z) // Adds a point light (color object).
  54. pointLight(color, position) // Adds a point light (color object).
  55.  
  56. // Material
  57. loadShader(vertFilename, fragFilename) // Loads a shader.
  58. shader(s) // Applys a shader.
  59. normalMaterial() // Maps normal vectors to RGB colors.
  60. texture(tex) // Textures shapes in 3D shapes with the specified image.
  61. ambientMaterial(v1) // Adds an ambient material (grayscale).
  62. ambientMaterial(v1, v2, v3) // Adds an ambient material (RGB or HSB color).
  63. ambientMaterial(v1, v2, v3, a) // Adds an ambient material (RGB or HSB color).
  64. ambientMaterial(color) // Adds an ambient material (color object).
  65. specularMaterial(v1) // Adds a specular material (grayscale).
  66. specularMaterial(v1, v2, v3) // Adds an specular material (RGB or HSB color).
  67. specularMaterial(v1, v2, v3, a) // Adds an specular material (RGB or HSB color).
  68. specularMaterial(color) // Adds an specular material (color object).
Add Comment
Please, Sign In to add comment