Skip to content

Commit beab187

Browse files
committed
Convert from tables to sections for builtins.
This Cl changes the builtin functions to use titles sections and code blocks instead of tables. This spaces things out a bit more and fixes issues where there was wrapping in the function declarations due to the size of the table columns.
1 parent 9ea9890 commit beab187

File tree

1 file changed

+100
-81
lines changed

1 file changed

+100
-81
lines changed

chapters/builtinfunctions.adoc

+100-81
Original file line numberDiff line numberDiff line change
@@ -639,114 +639,130 @@ endif::GLSL[]
639639

640640
These operate on vectors as vectors, not component-wise.
641641

642-
[options="header"]
643-
|====
644-
| Syntax | Description
642+
=== Length
643+
[source,glsl]
644+
----
645645
ifdef::GLSL[]
646-
| float *length*(genFType _x_) +
647-
double *length*(genDType _x_)
646+
float length(genFType x)
647+
double length(genDType x)
648648
endif::GLSL[]
649649
ifdef::ESSL[]
650-
| float *length*(genFType _x_)
650+
float length(genFType x)
651651
endif::ESSL[]
652-
a| Returns the length of vector _x_, i.e.,
653-
[eq]#sqrt( x~0~^2^ + x~1~^2^ + ... )#.
652+
----
653+
654+
Returns the length of vector _x_, i.e., [eq]#sqrt( x~0~^2^ + x~1~^2^ + ... )#.
655+
656+
=== Distance
657+
[source,glsl]
658+
----
654659
ifdef::GLSL[]
655-
| float *distance*(genFType _p0_, genFType _p1_) +
656-
double *distance*(genDType _p0_, genDType _p1_)
660+
float distance(genFType p0, genFType p1)
661+
double distance(genDType p0, genDType p1)
657662
endif::GLSL[]
658663
ifdef::ESSL[]
659-
| float *distance*(genFType _p0_, genFType _p1_)
664+
float distance(genFType p0, genFType p1)
660665
endif::ESSL[]
661-
| Returns the distance between _p0_ and _p1_, i.e.,
662-
*length*(_p0_ - _p1_)
666+
----
667+
668+
Returns the distance between _p0_ and _p1_, i.e., *length*(_p0_ - _p1_)
669+
670+
=== Dot
671+
[source,glsl]
672+
----
673+
float dot(genFType x, genFType y)
663674
ifdef::GLSL[]
664-
| float *dot*(genFType _x_, genFType _y_) +
665-
double *dot*(genDType _x_, genDType _y_)
675+
double dot(genDType x, genDType y)
666676
endif::GLSL[]
667-
ifdef::ESSL[]
668-
| float *dot*(genFType _x_, genFType _y_)
669-
endif::ESSL[]
670-
| Returns the dot product of _x_ and _y_, i.e.,
671-
[eq]#x~0~ {cdot} y~0~ + x~1~ {cdot} y~1~ + ...#
677+
----
678+
679+
Returns the dot product of _x_ and _y_, i.e., [eq]#x~0~ {cdot} y~0~ + x~1~ {cdot} y~1~ + ...#
680+
681+
=== Cross
682+
[source,glsl]
683+
----
684+
vec3 cross(vec3 x, vec3 y)
672685
ifdef::GLSL[]
673-
| vec3 *cross*(vec3 _x_, vec3 _y_) +
674-
dvec3 *cross*(dvec3 _x_, dvec3 _y_)
686+
dvec3 cross(dvec3 x, dvec3 y)
675687
endif::GLSL[]
676-
ifdef::ESSL[]
677-
| vec3 *cross*(vec3 _x_, vec3 _y_)
678-
endif::ESSL[]
679-
a| Returns the cross product of _x_ and _y_, i.e.,
688+
----
689+
690+
Returns the cross product of _x_ and _y_, i.e.,
680691
[eq]#(x~1~ {cdot} y~2~ - y~1~ {cdot} x~2~,
681692
x~2~ {cdot} y~0~ - y~2~ {cdot} x~0~,
682693
x~0~ {cdot} y~1~ - y~0~ {cdot} x~1~)#.
694+
695+
=== Normalize
696+
[source,glsl]
697+
----
698+
genFType normalize(genFType x)
683699
ifdef::GLSL[]
684-
| genFType *normalize*(genFType _x_) +
685-
genDType *normalize*(genDType _x_)
700+
genDType normalize(genDType x)
686701
endif::GLSL[]
687-
ifdef::ESSL[]
688-
| genFType *normalize*(genFType _x_)
689-
endif::ESSL[]
690-
| Returns a vector in the same direction as _x_ but with a length of 1,
691-
i.e. _x_ / *length*(x).
692-
ifdef::GLSL[]
693-
| compatibility profile only +
694-
vec4 *ftransform*()
695-
a| Available only when using the compatibility profile.
696-
For core {apiname}, use *invariant*. +
697-
For vertex shaders only.
698-
This function will ensure that the incoming vertex value will be
699-
transformed in a way that produces exactly the same result as would be
700-
produced by {apiname}'s fixed functionality transform.
701-
It is intended to be used to compute _gl_Position_, e.g.
702-
--
703-
{empty}:: _gl_Position_ = *ftransform*()
702+
----
703+
704+
Returns a vector in the same direction as _x_ but with a length of 1, i.e. _x_ / *length*(x).
704705

705-
This function should be used, for example, when an application is rendering
706-
the same geometry in separate passes, and one pass uses the fixed
707-
functionality path to render and another pass uses programmable shaders.
708-
--
709-
endif::GLSL[]
710-
| genFType *faceforward*(genFType _N_, genFType _I_, genFType _Nref_) +
711706
ifdef::GLSL[]
712-
genDType *faceforward*(genDType _N_, genDType _I_, genDType _Nref_)
707+
=== FTransform
708+
Compatibility profile only
709+
710+
[source,glsl]
711+
----
712+
vec4 ftransform()
713+
----
714+
715+
Available only when using the compatibility profile. For core {apiname}, use *invariant*.
716+
717+
For vertex shaders only. This function will ensure that the incoming vertex value will be
718+
transformed in a way that produces exactly the same result as would be produced by {apiname}'s
719+
fixed functionality transform. It is intended to be used to compute _gl_Position_, e.g.
720+
721+
[source,glsl]
722+
----
723+
gl_Position = ftransform()
724+
----
725+
726+
This function should be used, for example, when an application is rendering the same geometry in
727+
separate passes, and one pass uses the fixed functionality path to render and another pass uses
728+
programmable shaders.
713729
endif::GLSL[]
714-
| If *dot*(_Nref_, _I_) < 0 return _N_, otherwise return -_N_.
730+
731+
=== Face Forward
732+
[source,glsl]
733+
----
734+
genFType faceforward(genFType N, genFType I, genFType Nref)
715735
ifdef::GLSL[]
716-
| genFType *reflect*(genFType _I_, genFType _N_) +
717-
genDType *reflect*(genDType _I_, genDType _N_)
736+
genDType faceforward(genDType N, genDType I, genDType Nref)
718737
endif::GLSL[]
719-
ifdef::ESSL[]
720-
| genFType *reflect*(genFType _I_, genFType _N_)
721-
endif::ESSL[]
722-
| For the incident vector _I_ and surface orientation _N_, returns the
723-
reflection direction: [eq]#I - 2 {cdot} *dot*(N, I) {cdot} N#.
724-
_N_ must already be normalized in order to achieve the desired result.
725-
| genFType *refract*(genFType _I_, genFType _N_, float _eta_) +
738+
----
739+
740+
If *dot*(_Nref_, _I_) < 0 return _N_, otherwise return -_N_.
741+
742+
=== Reflect
743+
[source,glsl]
744+
----
745+
genFType reflect(genFType I, genFType N)
726746
ifdef::GLSL[]
727-
genDType *refract*(genDType _I_, genDType _N_, double _eta_)
747+
genDType reflect(genDType I, genDType N)
728748
endif::GLSL[]
729-
a| For the incident vector _I_ and surface normal _N_, and the ratio of
730-
indices of refraction _eta_, return the refraction vector.
731-
The result is computed by the <<refraction-equation,refraction
732-
equation>> shown below.
733-
734-
The input parameters for the incident vector _I_ and the surface
735-
normal _N_ must already be normalized to get the desired results.
736-
|====
749+
----
737750

751+
For the incident vector _I_ and surface orientation _N_, returns the reflection direction:
752+
[eq]#I - 2 {cdot} *dot*(N, I) {cdot} N#. _N_ must already be normalized in order to achieve
753+
the desired result.
738754

739-
[[refraction-equation]]
740-
=== Refraction Equation
755+
=== Refract
756+
[source,glsl]
757+
----
758+
genFType refract(genFType I, genFType N, float eta)
759+
ifdef::GLSL[]
760+
genDType refract(genDType I, genDType N, double eta)
761+
endif::GLSL[]
762+
----
741763

742-
ifdef::editing-notes[]
743-
[NOTE]
744-
.editing-note
745-
====
746-
(Jon) Moved to new section from *refract* table entry above because
747-
asciidoctor-mathematical doesn't support math blocks in table cells yet.
748-
====
749-
endif::editing-notes[]
764+
For the incident vector _I_ and surface normal _N_, and the ratio of indices of refraction
765+
_eta_, return the refraction vector. The result is computed by the refraction equation shown below.
750766

751767
[latexmath]
752768
++++
@@ -764,6 +780,9 @@ result &=
764780
\end{aligned}
765781
++++
766782

783+
The input parameters for the incident vector _I_ and the surface normal _N_ must already be
784+
normalized to get the desired results.
785+
767786

768787
[[matrix-functions]]
769788
== Matrix Functions

0 commit comments

Comments
 (0)