2017-07-30 15:22:01 -07:00
|
|
|
//
|
|
|
|
// Shaders.metal
|
|
|
|
// Metaballs
|
|
|
|
//
|
|
|
|
// Created by Eryn Wells on 7/30/17.
|
|
|
|
// Copyright © 2017 Eryn Wells. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <metal_stdlib>
|
|
|
|
using namespace metal;
|
|
|
|
|
2017-07-30 15:52:40 -07:00
|
|
|
typedef struct {
|
|
|
|
float2 position;
|
|
|
|
float radius;
|
|
|
|
} Ball;
|
2017-07-30 15:22:01 -07:00
|
|
|
|
2017-07-30 15:52:40 -07:00
|
|
|
kernel void
|
|
|
|
sampleFieldKernel(const device Ball* metaballs [[buffer(0)]],
|
|
|
|
device float* samples [[buffer(1)]],
|
|
|
|
uint2 gid [[thread_position_in_grid]])
|
|
|
|
{
|
|
|
|
// TODO: Compute a sample for this pixel given the field data, and write it to the out texture.
|
|
|
|
}
|