MCPcopy
hub / github.com/processing/p5.js / processStrandsFunctions

Function processStrandsFunctions

utils/typescript.mjs:39–194  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37
38// Process strands functions to extract p5 methods
39function processStrandsFunctions() {
40 const strandsMethods = [
41 {
42 name: 'instanceID',
43 overloads: [{
44 params: [],
45 return: {
46 type: { type: 'NameExpression', name: 'any' } // Return 'any' for strands nodes
47 }
48 }],
49 description: `Returns the ID when drawing many instances`,
50 static: false
51 },
52 {
53 name: 'discard',
54 overloads: [{
55 params: [],
56 }],
57 description: `Discards the current pixel`,
58 static: false
59 },
60 {
61 name: 'getTexture',
62 overloads: [{
63 params: [
64 {
65 name: 'tex',
66 type: { type: 'NameExpression', name: 'any' },
67 optional: false,
68 },
69 {
70 name: 'coord',
71 type: { type: 'NameExpression', name: 'any' },
72 optional: false,
73 },
74 ],
75 return: {
76 type: { type: 'NameExpression', name: 'any' } // Return 'any' for strands nodes
77 }
78 }],
79 }
80 ];
81
82 // Add ALL GLSL builtin functions (both isp5Function: true and false)
83 for (const [functionName, overloads] of Object.entries(builtInGLSLFunctions)) {
84 // Create method definition with simplified any types for all overloads
85 const method = {
86 name: functionName,
87 overloads: overloads.map(overload => ({
88 params: overload.params.map((paramType, index) => ({
89 name: `param${index}`,
90 type: { type: 'NameExpression', name: 'any' }, // Use 'any' for strands node types
91 optional: false
92 })),
93 return: {
94 type: { type: 'NameExpression', name: 'any' } // Return 'any' for strands nodes
95 }
96 })),

Callers 1

generateTypeDefinitionsFunction · 0.85

Calls 2

sliceMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected