[fpc-pascal] Class/Record helpers on genericd?
Anthony Walter
sysrpl at gmail.com
Tue Apr 26 09:11:51 CEST 2016
Okay. Thanks. Just FYI here is my use case.
{ User defined vertex type }
type
TColorLitVertex = record
Position: TVec3;
Normal: TVec3;
Color: TVec4;
end;
{ Contiguous data to be fed to an opengl vertex shader attribute }
var
VertexData: TArray<TColorLitVertex>;
It would be nice to have both of these types of functionality supported:
VertexData[I].Color.Alpha := 0.5; // you can only write to record fields if
the container is an array
and ..
VertexData.Sort(SortZOrder); // you can only have methods on arrays using
record helpers, but not generic arrays
and later provide a reference to the first color location to opengl (array
types make this easiest) ...
glVertexAttribPointer(ColorAttribute, 4, GL_FLOAT, GL_FALSE,
SizeOf(TColorLitVertex), @VertexData[0].Color);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160426/ea5490cb/attachment.html>
More information about the fpc-pascal
mailing list