Lines Matching refs:self
11 def __init__(self, name, description, children): argument
12 self.name = name
13 self.description = description
14 self.children = children
17 def __init__(self): argument
122 def __init__(self): argument
125 def uniformVec4(self, count, mn, mx): argument
132 def uniformBVec4(self, count): argument
207 def __init__(self, x): argument
208 self.x = x
210 def applyUnary(self, func): return Scalar(func(self.x)) argument
211 def applyBinary(self, func, other): return Scalar(func(self.x, other.x)) argument
213 def isEqual(self, other): assert isinstance(other, Scalar); return (self.x == other.x) argument
215 def expandVec(self, val): return val argument
216 def toScalar(self): return Scalar(self.x) argument
217 def toVec2(self): return Vec2(self.x, self.x) argument
218 def toVec3(self): return Vec3(self.x, self.x, self.x) argument
219 def toVec4(self): return Vec4(self.x, self.x, self.x, self.x) argument
220 def toUVec2(self): return UVec2(self.x, self.x) argument
221 def toUVec3(self): return UVec3(self.x, self.x, self.x) argument
222 def toUVec4(self): return UVec4(self.x, self.x, self.x, self.x) argument
223 def toMat2(self): return Mat.fromScalar(2, 2, float(self.x)) argument
224 def toMat2x3(self): return Mat.fromScalar(2, 3, float(self.x)) argument
225 def toMat2x4(self): return Mat.fromScalar(2, 4, float(self.x)) argument
226 def toMat3x2(self): return Mat.fromScalar(3, 2, float(self.x)) argument
227 def toMat3(self): return Mat.fromScalar(3, 3, float(self.x)) argument
228 def toMat3x4(self): return Mat.fromScalar(3, 4, float(self.x)) argument
229 def toMat4x2(self): return Mat.fromScalar(4, 2, float(self.x)) argument
230 def toMat4x3(self): return Mat.fromScalar(4, 3, float(self.x)) argument
231 def toMat4(self): return Mat.fromScalar(4, 4, float(self.x)) argument
233 def toFloat(self): return Scalar(float(self.x)) argument
234 def toInt(self): return Scalar(int(self.x)) argument
235 def toUint(self): return Uint(int(self.x)) argument
236 def toBool(self): return Scalar(bool(self.x)) argument
238 def getNumScalars(self): return 1 argument
239 def getScalars(self): return [self.x] argument
241 def typeString(self): argument
242 if isinstance(self.x, bool):
244 elif isinstance(self.x, int):
246 elif isinstance(self.x, float):
251 def vec4Swizzle(self): argument
254 def __str__(self): argument
255 return str(self.x).lower()
257 def __float__(self): argument
258 return float(self.x)
260 def length(self): argument
261 return Scalar(abs(self.x))
263 def distance(self, v): argument
265 return Scalar(abs(self.x - v.x))
267 def dot(self, v): argument
269 return Scalar(self.x * v.x)
271 def normalize(self): argument
272 return Scalar(glslSign(self.x))
274 def abs(self): argument
275 if isinstance(self.x, bool):
276 return Scalar(self.x)
278 return Scalar(abs(self.x))
280 def __neg__(self): argument
281 return Scalar(-self.x)
283 def __add__(self, val): argument
285 return Scalar(self.x + val.x)
287 def __sub__(self, val): argument
288 return self + (-val)
290 def __mul__(self, val): argument
292 return Scalar(self.x * val.x)
294 return Vec2(self.x * val.x, self.x * val.y)
296 return Vec3(self.x * val.x, self.x * val.y, self.x * val.z)
298 return Vec4(self.x * val.x, self.x * val.y, self.x * val.z, self.x * val.w)
302 def __div__(self, val): argument
304 return Scalar(self.x / val.x)
306 return Vec2(self.x / val.x, self.x / val.y)
308 return Vec3(self.x / val.x, self.x / val.y, self.x / val.z)
310 return Vec4(self.x / val.x, self.x / val.y, self.x / val.z, self.x / val.w)
315 def __init__(self, x): argument
317 self.x = x
319 def typeString(self): argument
322 def abs(self): argument
323 return Scalar.abs(self).toUint()
325 def __neg__(self): argument
326 return Scalar.__neg__(self).toUint()
328 def __add__(self, val): argument
329 return Scalar.__add__(self, val).toUint()
331 def __sub__(self, val): argument
332 return self + (-val)
334 def __mul__(self, val): argument
335 return Scalar.__mul__(self, val).toUint()
337 def __div__(self, val): argument
338 return Scalar.__div__(self, val).toUint()
349 def isEqual(self, other): argument
351 return (self.getScalars() == other.getScalars())
353 def length(self): argument
354 return Scalar(math.sqrt(self.dot(self).x))
356 def normalize(self): argument
357 return self * Scalar(1.0 / self.length().x)
359 def swizzle(self, indexList): argument
360 inScalars = self.getScalars()
364 def __init__(self): argument
367 def __eq__(self, other): argument
368 return self.isEqual(other)
370 def __ne__(self, other): argument
371 return not self.isEqual(other)
374 def __init__(self, x, y): argument
376 self.x = x
377 self.y = y
379 def applyUnary(self, func): return Vec2(func(self.x), func(self.y)) argument
380 def applyBinary(self, func, other): return Vec2(func(self.x, other.x), func(self.y, other.y)) argument
382 def expandVec(self, val): return val.toVec2() argument
383 def toScalar(self): return Scalar(self.x) argument
384 def toVec2(self): return Vec2(self.x, self.y) argument
385 def toVec3(self): return Vec3(self.x, self.y, 0.0) argument
386 def toVec4(self): return Vec4(self.x, self.y, 0.0, 0.0) argument
387 def toUVec2(self): return UVec2(self.x, self.y) argument
388 def toUVec3(self): return UVec3(self.x, self.y, 0.0) argument
389 def toUVec4(self): return UVec4(self.x, self.y, 0.0, 0.0) argument
390 def toMat2(self): return Mat2(float(self.x), 0.0, 0.0, float(self.y)); argument
392 def toFloat(self): return Vec2(float(self.x), float(self.y)) argument
393 def toInt(self): return Vec2(int(self.x), int(self.y)) argument
394 def toUint(self): return UVec2(int(self.x), int(self.y)) argument
395 def toBool(self): return Vec2(bool(self.x), bool(self.y)) argument
397 def getNumScalars(self): return 2 argument
398 def getScalars(self): return [self.x, self.y] argument
400 def typeString(self): argument
401 if isinstance(self.x, bool):
403 elif isinstance(self.x, int):
405 elif isinstance(self.x, float):
410 def vec4Swizzle(self): argument
413 def __str__(self): argument
414 if isinstance(self.x, bool):
415 return "bvec2(%s, %s)" % (str(self.x).lower(), str(self.y).lower())
416 elif isinstance(self.x, int):
417 return "ivec2(%i, %i)" % (self.x, self.y)
418 elif isinstance(self.x, float):
419 return "vec2(%s, %s)" % (self.x, self.y)
423 def distance(self, v): argument
425 return (self - v).length()
427 def dot(self, v): argument
429 return Scalar(self.x*v.x + self.y*v.y)
431 def abs(self): argument
432 if isinstance(self.x, bool):
433 return Vec2(self.x, self.y)
435 return Vec2(abs(self.x), abs(self.y))
437 def __neg__(self): argument
438 return Vec2(-self.x, -self.y)
440 def __add__(self, val): argument
442 return Vec2(self.x + val, self.y + val)
444 return Vec2(self.x + val.x, self.y + val.y)
448 def __sub__(self, val): argument
449 return self + (-val)
451 def __mul__(self, val): argument
455 return Vec2(self.x * val.x, self.y * val.y)
457 def __div__(self, val): argument
459 return Vec2(self.x / val.x, self.y / val.x)
462 return Vec2(self.x / val.x, self.y / val.y)
464 def boolAny(self): return Scalar(self.x or self.y) argument
465 def boolAll(self): return Scalar(self.x and self.y) argument
466 def boolNot(self): return Vec2(not self.x, not self.y) argument
469 def __init__(self, x, y): argument
472 Vec2.__init__(self, x, y)
474 def typeString(self): argument
477 def __str__(self): argument
478 return "uvec2(%i, %i)" % (self.x, self.y)
480 def abs(self): argument
481 return Vec2.abs(self).toUint()
484 def __init__(self, x, y, z): argument
486 self.x = x
487 self.y = y
488 self.z = z
490 def applyUnary(self, func): return Vec3(func(self.x), func(self.y), func(self.z)) argument
491 …def applyBinary(self, func, other): return Vec3(func(self.x, other.x), func(self.y, other.y), func… argument
493 def expandVec(self, val): return val.toVec3() argument
494 def toScalar(self): return Scalar(self.x) argument
495 def toVec2(self): return Vec2(self.x, self.y) argument
496 def toVec3(self): return Vec3(self.x, self.y, self.z) argument
497 def toVec4(self): return Vec4(self.x, self.y, self.z, 0.0) argument
498 def toUVec2(self): return UVec2(self.x, self.y) argument
499 def toUVec3(self): return UVec3(self.x, self.y, self.z) argument
500 def toUVec4(self): return UVec4(self.x, self.y, self.z, 0.0) argument
501 …def toMat3(self): return Mat3(float(self.x), 0.0, 0.0, 0.0, float(self.y), 0.0, 0.0, 0.0, floa… argument
503 def toFloat(self): return Vec3(float(self.x), float(self.y), float(self.z)) argument
504 def toInt(self): return Vec3(int(self.x), int(self.y), int(self.z)) argument
505 def toUint(self): return UVec3(int(self.x), int(self.y), int(self.z)) argument
506 def toBool(self): return Vec3(bool(self.x), bool(self.y), bool(self.z)) argument
508 def getNumScalars(self): return 3 argument
509 def getScalars(self): return [self.x, self.y, self.z] argument
511 def typeString(self): argument
512 if isinstance(self.x, bool):
514 elif isinstance(self.x, int):
516 elif isinstance(self.x, float):
521 def vec4Swizzle(self): argument
524 def __str__(self): argument
525 if isinstance(self.x, bool):
526 return "bvec3(%s, %s, %s)" % (str(self.x).lower(), str(self.y).lower(), str(self.z).lower())
527 elif isinstance(self.x, int):
528 return "ivec3(%i, %i, %i)" % (self.x, self.y, self.z)
529 elif isinstance(self.x, float):
530 return "vec3(%s, %s, %s)" % (self.x, self.y, self.z)
534 def distance(self, v): argument
536 return (self - v).length()
538 def dot(self, v): argument
540 return Scalar(self.x*v.x + self.y*v.y + self.z*v.z)
542 def cross(self, v): argument
544 return Vec3(self.y*v.z - v.y*self.z,
545 self.z*v.x - v.z*self.x,
546 self.x*v.y - v.x*self.y)
548 def abs(self): argument
549 if isinstance(self.x, bool):
550 return Vec3(self.x, self.y, self.z)
552 return Vec3(abs(self.x), abs(self.y), abs(self.z))
554 def __neg__(self): argument
555 return Vec3(-self.x, -self.y, -self.z)
557 def __add__(self, val): argument
559 return Vec3(self.x + val, self.y + val)
561 return Vec3(self.x + val.x, self.y + val.y, self.z + val.z)
565 def __sub__(self, val): argument
566 return self + (-val)
568 def __mul__(self, val): argument
572 return Vec3(self.x * val.x, self.y * val.y, self.z * val.z)
574 def __div__(self, val): argument
576 return Vec3(self.x / val.x, self.y / val.x, self.z / val.x)
578 return Vec3(self.x / val.x, self.y / val.y, self.z / val.z)
582 def boolAny(self): return Scalar(self.x or self.y or self.z) argument
583 def boolAll(self): return Scalar(self.x and self.y and self.z) argument
584 def boolNot(self): return Vec3(not self.x, not self.y, not self.z) argument
587 def __init__(self, x, y, z): argument
590 Vec3.__init__(self, x, y, z)
592 def typeString(self): argument
595 def __str__(self): argument
596 return "uvec3(%i, %i, %i)" % (self.x, self.y, self.z)
598 def abs(self): argument
599 return Vec3.abs(self).toUint()
602 def __init__(self, x, y, z, w): argument
604 self.x = x
605 self.y = y
606 self.z = z
607 self.w = w
609 def applyUnary(self, func): return Vec4(func(self.x), func(self.y), func(self.z), func(self.w)) argument
610 …def applyBinary(self, func, other): return Vec4(func(self.x, other.x), func(self.y, other.y), func… argument
612 def expandVec(self, val): return val.toVec4() argument
613 def toScalar(self): return Scalar(self.x) argument
614 def toVec2(self): return Vec2(self.x, self.y) argument
615 def toVec3(self): return Vec3(self.x, self.y, self.z) argument
616 def toVec4(self): return Vec4(self.x, self.y, self.z, self.w) argument
617 def toUVec2(self): return UVec2(self.x, self.y) argument
618 def toUVec3(self): return UVec3(self.x, self.y, self.z) argument
619 def toUVec4(self): return UVec4(self.x, self.y, self.z, self.w) argument
620 def toMat2(self): return Mat2(float(self.x), float(self.y), float(self.z), float(self.w)) argument
621 …toMat4(self): return Mat4(float(self.x), 0.0, 0.0, 0.0, 0.0, float(self.y), 0.0, 0.0, 0.0, 0.0… argument
623 def toFloat(self): return Vec4(float(self.x), float(self.y), float(self.z), float(self.w)) argument
624 def toInt(self): return Vec4(int(self.x), int(self.y), int(self.z), int(self.w)) argument
625 def toUint(self): return UVec4(int(self.x), int(self.y), int(self.z), int(self.w)) argument
626 def toBool(self): return Vec4(bool(self.x), bool(self.y), bool(self.z), bool(self.w)) argument
628 def getNumScalars(self): return 4 argument
629 def getScalars(self): return [self.x, self.y, self.z, self.w] argument
631 def typeString(self): argument
632 if isinstance(self.x, bool):
634 elif isinstance(self.x, int):
636 elif isinstance(self.x, float):
641 def vec4Swizzle(self): argument
644 def __str__(self): argument
645 if isinstance(self.x, bool):
646 …return "bvec4(%s, %s, %s, %s)" % (str(self.x).lower(), str(self.y).lower(), str(self.z).lower(), s…
647 elif isinstance(self.x, int):
648 return "ivec4(%i, %i, %i, %i)" % (self.x, self.y, self.z, self.w)
649 elif isinstance(self.x, float):
650 return "vec4(%s, %s, %s, %s)" % (self.x, self.y, self.z, self.w)
654 def distance(self, v): argument
656 return (self - v).length()
658 def dot(self, v): argument
660 return Scalar(self.x*v.x + self.y*v.y + self.z*v.z + self.w*v.w)
662 def abs(self): argument
663 if isinstance(self.x, bool):
664 return Vec4(self.x, self.y, self.z, self.w)
666 return Vec4(abs(self.x), abs(self.y), abs(self.z), abs(self.w))
668 def __neg__(self): argument
669 return Vec4(-self.x, -self.y, -self.z, -self.w)
671 def __add__(self, val): argument
673 return Vec3(self.x + val, self.y + val)
675 return Vec4(self.x + val.x, self.y + val.y, self.z + val.z, self.w + val.w)
679 def __sub__(self, val): argument
680 return self + (-val)
682 def __mul__(self, val): argument
686 return Vec4(self.x * val.x, self.y * val.y, self.z * val.z, self.w * val.w)
688 def __div__(self, val): argument
690 return Vec4(self.x / val.x, self.y / val.x, self.z / val.x, self.w / val.x)
692 return Vec4(self.x / val.x, self.y / val.y, self.z / val.z, self.w / val.w)
696 def boolAny(self): return Scalar(self.x or self.y or self.z or self.w) argument
697 def boolAll(self): return Scalar(self.x and self.y and self.z and self.w) argument
698 def boolNot(self): return Vec4(not self.x, not self.y, not self.z, not self.w) argument
701 def __init__(self, x, y, z, w): argument
704 Vec4.__init__(self, x, y, z, w)
706 def typeString(self): argument
709 def __str__(self): argument
710 return "uvec4(%i, %i, %i, %i)" % (self.x, self.y, self.z, self.w)
712 def abs(self): argument
713 return Vec4.abs(self).toUint()
717 def __init__ (self, numCols, numRows, scalars): argument
719 self.numCols = numCols
720 self.numRows = numRows
721 self.scalars = scalars
735 def get (self, colNdx, rowNdx): argument
736 assert 0 <= colNdx and colNdx < self.numCols
737 assert 0 <= rowNdx and rowNdx < self.numRows
738 return self.scalars[colNdx*self.numRows + rowNdx]
740 def set (self, colNdx, rowNdx, scalar): argument
741 assert 0 <= colNdx and colNdx < self.numCols
742 assert 0 <= rowNdx and rowNdx < self.numRows
743 self.scalars[colNdx*self.numRows + rowNdx] = scalar
745 def toMatrix (self, numCols, numRows): argument
747 for col in range(0, min(self.numCols, numCols)):
748 for row in range(0, min(self.numRows, numRows)):
749 res.set(col, row, self.get(col, row))
752 def toMat2 (self): return self.toMatrix(2, 2) argument
753 def toMat2x3 (self): return self.toMatrix(2, 3) argument
754 def toMat2x4 (self): return self.toMatrix(2, 4) argument
755 def toMat3x2 (self): return self.toMatrix(3, 2) argument
756 def toMat3 (self): return self.toMatrix(3, 3) argument
757 def toMat3x4 (self): return self.toMatrix(3, 4) argument
758 def toMat4x2 (self): return self.toMatrix(4, 2) argument
759 def toMat4x3 (self): return self.toMatrix(4, 3) argument
760 def toMat4 (self): return self.toMatrix(4, 4) argument
762 def typeString(self): argument
763 if self.numRows == self.numCols:
764 return "mat%d" % self.numRows
766 return "mat%dx%d" % (self.numCols, self.numRows)
768 def __str__(self): argument
769 return "%s(%s)" % (self.typeString(), ", ".join(["%s" % s for s in self.scalars]))
771 def isTypeEqual (self, other): argument
772 return isinstance(other, Mat) and self.numRows == other.numRows and self.numCols == other.numCols
774 def isEqual(self, other): argument
775 assert self.isTypeEqual(other)
776 return (self.scalars == other.scalars)
778 def compMul(self, val): argument
779 assert self.isTypeEqual(val)
780 …return Mat(self.numRows, self.numCols, [self.scalars(i) * val.scalars(i) for i in range(self.numRo…
783 def __init__(self, m00, m01, m10, m11): argument
784 Mat.__init__(self, 2, 2, [m00, m10, m01, m11])
787 def __init__(self, m00, m01, m02, m10, m11, m12, m20, m21, m22): argument
788 Mat.__init__(self, 3, 3, [m00, m10, m20,
793 def __init__(self, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33): argument
794 Mat.__init__(self, 4, 4, [m00, m10, m20, m30,