Reconstruct property sources and operators to generic types.

This commit is contained in:
2023-07-31 15:12:41 +08:00
parent 3db8f61e3b
commit b78e99c59c
4 changed files with 57 additions and 73 deletions

View File

@@ -455,11 +455,9 @@ namespace Cryville.Crtr {
}
}
public unsafe class VectorSrc : PropSrc.FixedBuffer {
public unsafe class VectorSrc : PropSrc.FixedBuffer<Vector> {
const int MAX_DIMENSION = 4;
protected readonly Func<Vector> _cb;
public VectorSrc(Func<Vector> cb) : base(PdtInternalType.Vector, MAX_DIMENSION * sizeof(float) + sizeof(int)) {
_cb = cb;
public VectorSrc(Func<Vector> cb) : base(PdtInternalType.Vector, MAX_DIMENSION * sizeof(float) + sizeof(int), cb) {
fixed (byte* rptr = buf) {
var ptr = (float*)rptr;
*(int*)(ptr + MAX_DIMENSION) = PdtInternalType.Number;
@@ -475,9 +473,8 @@ namespace Cryville.Crtr {
}
}
public class VectorOp : PropOp {
readonly Action<float[]> _cb;
public VectorOp(Action<float[]> cb) { _cb = cb; }
public class VectorOp : PropOp.Fixed<float[]> {
public VectorOp(Action<float[]> cb) : base(cb) { }
protected override unsafe void Execute() {
var op = GetOperand(0);
float[] values;