├── nodes ├── assets │ ├── halo.png │ ├── logo.png │ └── NoiseTextures │ │ ├── perm1d.dds │ │ ├── perm2d.dds │ │ ├── permgrad.dds │ │ └── permgrad4d.dds ├── plugins │ ├── Kabsch (Vector 3d) │ │ ├── GeneralMatrix.dll │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Kabsch.csproj │ ├── LinkedList │ │ ├── bin │ │ │ └── AnyCPU │ │ │ │ └── Release │ │ │ │ └── LinkedList.dll │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── effects │ │ │ └── LinkedList.fx │ │ ├── LinkedList.sln │ │ └── LinkedList.csproj │ ├── RawCompress │ │ ├── bin │ │ │ └── AnyCPU │ │ │ │ └── Release │ │ │ │ ├── SnappyPI.dll │ │ │ │ ├── RawCompress.dll │ │ │ │ ├── SnappyDL.x64.dll │ │ │ │ └── SnappyDL.x86.dll │ │ ├── packages.config │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── RawCompress.sln │ │ └── RawCompress.csproj │ ├── RingBuffer │ │ ├── bin │ │ │ └── AnyCPU │ │ │ │ └── Release │ │ │ │ └── RingBuffer.dll │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── effects │ │ │ └── RingBuffer.fx │ │ ├── RingBuffer.sln │ │ └── RingBuffer.csproj │ ├── RingBufferIndexing │ │ ├── bin │ │ │ └── AnyCPU │ │ │ │ └── Release │ │ │ │ └── RingBufferIndexing.dll │ │ ├── effects │ │ │ └── RingBufferIndexing.fx │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── RingBufferIndexing.sln │ │ └── RingBufferIndexing.csproj │ ├── AdvancedQueue │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── AdvancedQueue.csproj │ │ └── AdvancedQueueNode.cs │ ├── RawSplitter │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── RawSplitterNode.cs │ │ └── RawSplitter.csproj │ ├── StringIndexer │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── StringIndexer.sln │ │ ├── StringIndexer.csproj │ │ └── StringIndexerNode.cs │ ├── DX11.TextureCCL │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── DX11.TextureCCL.csproj │ ├── RawPartialReader │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── RawPartialReader.csproj │ │ └── RawPartialReaderNode.cs │ ├── BasicTransformCamera │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── BasicTransformCamera.csproj │ │ └── BasicTransformCameraNode.cs │ └── Track (Vector3D) │ │ ├── Vector3DCache │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Vector3DCacheNode.cs │ │ └── Vector3DCache.csproj │ │ └── NearestPairs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ └── NearestPairs.csproj ├── fxh │ ├── _ForceData.fxh │ ├── _PointData.fxh │ ├── PhongDirectional.fxh │ ├── PhongPoint.fxh │ └── Helper.fxh ├── dx11 │ ├── Forces_CS_VectorFieldVolumeTexture.fx │ ├── Forces_CS_ChangeGroupId.fx │ ├── Forces_CS_Gravity.fx │ ├── Tools_CS_TransformPcb_GroupId.fx │ ├── Tools_CS_PickPoints_PointcloudTexture.fx │ ├── Analysis_CS_Centroid.fx │ ├── Forces_CS_UpdateForces.fx │ ├── Forces_CS_UpdatePointcloudRingBuffer.fx │ ├── Forces_CS_Deceleration.fx │ ├── Analysis_CS_Bounds.fx │ ├── Forces_CS_ApplyForce_GroupId.fx │ ├── Forces_CS_VectorField.fx │ ├── Analysis_CS_CountGroupIds.fx │ ├── Analysis_CS_BlobExtraction_SetGroupId.fx │ ├── Forces_CS_SelfRepulsion.fx │ ├── Filters_CS_FilterPcb_GroupId.fx │ ├── Tools_CS_PickPoints_RGBDepth.fx │ ├── Forces_CS_Attractor.fx │ ├── Analysis_PixelPerGroup.fx │ ├── Forces_CS_UpdateForcesRingBuffer.fx │ ├── Visualization_ConstantMesh.fx │ ├── Filters_CS_FilterPcb_Transform.fx │ ├── Forces_CS_Turbulence.fx │ ├── Data_CS_DecodeKinectDataAdvanced.fx │ ├── Data_CS_EncodeKinectData.fx │ ├── Filters_TextureBuffer.fx │ ├── Data_CS_EncodeKinectDataAdvanced.fx │ ├── Forces_CS_Force_DynamicBuffer.fx │ ├── Forces_CS_Target.fx │ ├── Data_CS_BuildPcb_Layer.fx │ ├── Forces_CS_Force_Texture.fx │ ├── Filters_CS_FilterPcb_Texture2d.fx │ ├── Data_CS_BuildPcb_Kinect.fx │ ├── Visualization_ConstantPoint.fx │ ├── Visualization_Sprite.fx │ ├── Data_CS_BuildPcb_DynamicBuffer.fx │ ├── Forces_CS_Collision.fx │ ├── Visualization_ConstantGeometry.fx │ └── Visualization_PhongDirectionalGeometry.fx ├── texture11 │ ├── Filters_DepthSmooth.tfx │ ├── Analysis_BlobExtraction_DebugGroupId.tfx │ ├── Filters_DepthModifier.tfx │ ├── Filters_DepthFilter.tfx │ ├── Filters_DepthSmoothAdvanced.tfx │ ├── Analysis_BlobExtraction_AsBinaryImage.tfx │ └── Filters_DepthRepair.tfx └── geom11 │ ├── GS_DepthToTriangles.gsfx │ └── GS_SuppressDiagonals.fx ├── girlpower ├── CustomizingDatastructure │ ├── readme.png │ └── dx11 │ │ ├── _PointData.fxh │ │ ├── _CustomPointData.fxh │ │ ├── Data_CS_AdaptFromCustomBuffer.fx │ │ └── Data_CS_AdaptToCustomBuffer.fx └── ExtendingDatastructure │ └── dx11 │ ├── _PointDataExtension.fxh │ ├── _PointData.fxh │ ├── Data_CS_RwPcBuffer.fx │ ├── Data_CS_RwForceBuffer.fx │ └── Visualization_ExtendedConstantGeometry.fx ├── research ├── fxh │ ├── _PointData.fxh │ └── Helper.fxh ├── plugins │ ├── ValueRawSequentialReader │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── ValueRawSequentialReader.csproj │ └── AsyncRawWriter │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── AsyncRawWriter.sln │ │ └── AsyncRawWriter.csproj └── dx11 │ ├── Data_CS_BuildPcb_DataTexture.fx │ └── Visualization_DataTexture.fx ├── LICENSE ├── .gitignore └── .gitattributes /nodes/assets/halo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/nodes/assets/halo.png -------------------------------------------------------------------------------- /nodes/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/nodes/assets/logo.png -------------------------------------------------------------------------------- /nodes/assets/NoiseTextures/perm1d.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/nodes/assets/NoiseTextures/perm1d.dds -------------------------------------------------------------------------------- /nodes/assets/NoiseTextures/perm2d.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/nodes/assets/NoiseTextures/perm2d.dds -------------------------------------------------------------------------------- /nodes/assets/NoiseTextures/permgrad.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/nodes/assets/NoiseTextures/permgrad.dds -------------------------------------------------------------------------------- /nodes/assets/NoiseTextures/permgrad4d.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/nodes/assets/NoiseTextures/permgrad4d.dds -------------------------------------------------------------------------------- /girlpower/CustomizingDatastructure/readme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/girlpower/CustomizingDatastructure/readme.png -------------------------------------------------------------------------------- /nodes/plugins/Kabsch (Vector 3d)/GeneralMatrix.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/nodes/plugins/Kabsch (Vector 3d)/GeneralMatrix.dll -------------------------------------------------------------------------------- /girlpower/ExtendingDatastructure/dx11/_PointDataExtension.fxh: -------------------------------------------------------------------------------- 1 | //stride: 16 2 | 3 | struct pointDataExtension 4 | { 5 | float3 force; 6 | float age; 7 | }; -------------------------------------------------------------------------------- /girlpower/CustomizingDatastructure/dx11/_PointData.fxh: -------------------------------------------------------------------------------- 1 | //stride: 32 2 | 3 | struct pointData 4 | { 5 | float3 pos; 6 | float4 col; 7 | int groupId; 8 | }; 9 | -------------------------------------------------------------------------------- /girlpower/ExtendingDatastructure/dx11/_PointData.fxh: -------------------------------------------------------------------------------- 1 | //stride: 32 2 | 3 | struct pointData 4 | { 5 | float3 pos; 6 | float4 col; 7 | int groupId; 8 | }; 9 | -------------------------------------------------------------------------------- /nodes/plugins/LinkedList/bin/AnyCPU/Release/LinkedList.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/nodes/plugins/LinkedList/bin/AnyCPU/Release/LinkedList.dll -------------------------------------------------------------------------------- /nodes/plugins/RawCompress/bin/AnyCPU/Release/SnappyPI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/nodes/plugins/RawCompress/bin/AnyCPU/Release/SnappyPI.dll -------------------------------------------------------------------------------- /nodes/plugins/RingBuffer/bin/AnyCPU/Release/RingBuffer.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/nodes/plugins/RingBuffer/bin/AnyCPU/Release/RingBuffer.dll -------------------------------------------------------------------------------- /nodes/plugins/RawCompress/bin/AnyCPU/Release/RawCompress.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/nodes/plugins/RawCompress/bin/AnyCPU/Release/RawCompress.dll -------------------------------------------------------------------------------- /nodes/plugins/RawCompress/bin/AnyCPU/Release/SnappyDL.x64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/nodes/plugins/RawCompress/bin/AnyCPU/Release/SnappyDL.x64.dll -------------------------------------------------------------------------------- /nodes/plugins/RawCompress/bin/AnyCPU/Release/SnappyDL.x86.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/nodes/plugins/RawCompress/bin/AnyCPU/Release/SnappyDL.x86.dll -------------------------------------------------------------------------------- /nodes/plugins/RingBufferIndexing/bin/AnyCPU/Release/RingBufferIndexing.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letmp/dx11-pointcloud/HEAD/nodes/plugins/RingBufferIndexing/bin/AnyCPU/Release/RingBufferIndexing.dll -------------------------------------------------------------------------------- /nodes/fxh/_ForceData.fxh: -------------------------------------------------------------------------------- 1 | //stride: 52 2 | 3 | struct forceData 4 | { 5 | float3 position; 6 | float3 velocity; 7 | float3 acceleration; 8 | float mass; 9 | int age; 10 | int groupId; 11 | bool alive; 12 | }; -------------------------------------------------------------------------------- /girlpower/CustomizingDatastructure/dx11/_CustomPointData.fxh: -------------------------------------------------------------------------------- 1 | //stride: 48 2 | 3 | struct customPointData 4 | { 5 | float3 pos; 6 | float4 col; 7 | int groupId; 8 | float3 direction; 9 | float age; 10 | }; -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_VectorFieldVolumeTexture.fx: -------------------------------------------------------------------------------- 1 | RWTexture3D RWDistanceVolume : BACKBUFFER; 2 | 3 | float3 InvVolumeSize : INVTARGETSIZE; 4 | StructuredBuffer vectorFields; 5 | 6 | [numthreads(16, 16, 4)] 7 | void CS( uint3 i : SV_DispatchThreadID) 8 | { 9 | float3 p = i; 10 | p *= InvVolumeSize; 11 | p -= 0.5f; 12 | 13 | int index = i.x + (i.x * i.y) + (i.x * i.y * i.z); 14 | 15 | RWDistanceVolume[i] = vectorFields[index]; 16 | } 17 | 18 | technique11 Process 19 | { 20 | pass P0 21 | { 22 | SetComputeShader( CompileShader( cs_5_0, CS() ) ); 23 | } 24 | } 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_ChangeGroupId.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_ForceData.fxh" 2 | RWStructuredBuffer rwForceBuffer : BACKBUFFER; 3 | 4 | float4x4 tW: WORLD; 5 | 6 | int groupId = -1; 7 | int groupIdNew = -1; 8 | bool Apply; 9 | 10 | [numthreads(64, 1, 1)] 11 | void CS_ChangeGroupId( uint3 i : SV_DispatchThreadID) 12 | { 13 | uint cnt, stride; 14 | rwForceBuffer.GetDimensions(cnt,stride); 15 | if (i.x >= cnt) { return; } 16 | 17 | if (Apply) { 18 | if ( groupId == -1 || rwForceBuffer[i.x].groupId == groupId){ 19 | rwForceBuffer[i.x].groupId = groupIdNew; 20 | } 21 | } 22 | } 23 | 24 | technique11 ChangeGroupId 25 | { 26 | pass P0{ SetComputeShader( CompileShader( cs_5_0, CS_ChangeGroupId() ) ); } 27 | } -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_Gravity.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_ForceData.fxh" 2 | RWStructuredBuffer rwForceBuffer : BACKBUFFER; 3 | 4 | int groupId = -1; 5 | float3 gravity; 6 | bool Apply; 7 | 8 | [numthreads(64, 1, 1)] 9 | void CS_Apply( uint3 i : SV_DispatchThreadID) 10 | { 11 | uint cnt, stride; 12 | rwForceBuffer.GetDimensions(cnt,stride); 13 | if (i.x >= cnt) { return; } 14 | 15 | if (Apply) { 16 | if ( groupId == -1 || rwForceBuffer[i.x].groupId == groupId){ 17 | rwForceBuffer[i.x].acceleration += gravity * rwForceBuffer[i.x].mass; 18 | } 19 | } 20 | 21 | } 22 | 23 | technique11 ApplyForce 24 | { 25 | pass P0 26 | { 27 | SetComputeShader( CompileShader( cs_5_0, CS_Apply() ) ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /nodes/dx11/Tools_CS_TransformPcb_GroupId.fx: -------------------------------------------------------------------------------- 1 | float4x4 tW : WORLD; 2 | int groupIds; 3 | 4 | #include "../fxh/_PointData.fxh" 5 | StructuredBuffer pcBuffer; 6 | ByteAddressBuffer InputCountBuffer; 7 | AppendStructuredBuffer newPcBuffer : BACKBUFFER; 8 | 9 | [numthreads(64, 1, 1)] 10 | void CS_Transform( uint3 i : SV_DispatchThreadID) 11 | { 12 | uint cnt = InputCountBuffer.Load(0); 13 | if (i.x >= cnt ) { return;} 14 | 15 | pointData pd = pcBuffer[i.x]; 16 | if( pcBuffer[i.x].groupId == groupIds || groupIds == -1){ 17 | pd.pos = mul(float4(pd.pos,1), tW).xyz; 18 | newPcBuffer.Append(pd); 19 | } 20 | } 21 | 22 | technique11 Transform 23 | { 24 | pass P0 25 | { 26 | SetComputeShader( CompileShader( cs_5_0, CS_Transform() ) ); 27 | } 28 | } -------------------------------------------------------------------------------- /nodes/dx11/Tools_CS_PickPoints_PointcloudTexture.fx: -------------------------------------------------------------------------------- 1 | RWStructuredBuffer rwbuffer : BACKBUFFER; 2 | Texture2D posTex ; 3 | StructuredBuffer uv ; 4 | int count; 5 | 6 | SamplerState sPoint : IMMUTABLE 7 | { 8 | Filter = MIN_MAG_MIP_POINT; 9 | AddressU = Border; 10 | AddressV = Border; 11 | }; 12 | 13 | 14 | [numthreads(1, 1, 1)] 15 | void CS( uint3 i : SV_DispatchThreadID) 16 | { 17 | if (i.x >= (uint) count ) { return;} 18 | float3 pos = posTex.SampleLevel(sPoint,uv[i.x],0).xyz; 19 | rwbuffer[i.x] = pos; 20 | } 21 | 22 | technique11 Process 23 | { 24 | pass P0 25 | { 26 | SetComputeShader( CompileShader( cs_5_0, CS() ) ); 27 | } 28 | } 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /nodes/dx11/Analysis_CS_Centroid.fx: -------------------------------------------------------------------------------- 1 | Texture2D tex; 2 | RWStructuredBuffer centroidBuffer : BACKBUFFER; 3 | float pixPos; 4 | int slice; 5 | 6 | SamplerState sPoint : IMMUTABLE 7 | { 8 | Filter = MIN_MAG_MIP_POINT; 9 | AddressU = Border; 10 | AddressV = Border; 11 | }; 12 | 13 | [numthreads(1, 1, 1)] 14 | void CS_CalculateCentroid( uint3 i : SV_DispatchThreadID) 15 | { 16 | float4 accum = tex.SampleLevel(sPoint, float2(pixPos,0),0); 17 | if (accum.w > 0.0f){ 18 | centroidBuffer[slice] = float4(accum.x/accum.w, accum.y/accum.w, accum.z/accum.w , accum.w); 19 | } 20 | else centroidBuffer[slice] = float4(0,0,0,0); 21 | } 22 | 23 | technique11 CalculateCentroid 24 | { 25 | pass P0 26 | { 27 | SetComputeShader( CompileShader( cs_5_0, CS_CalculateCentroid() ) ); 28 | } 29 | } -------------------------------------------------------------------------------- /research/fxh/_PointData.fxh: -------------------------------------------------------------------------------- 1 | //stride: 20 2 | 3 | struct pointData 4 | { 5 | float3 pos; 6 | int col; 7 | int groupId; 8 | }; 9 | 10 | // NOTES ABOUT EXTENDING THE POINT STRUCTURE 11 | // ========================================================== 12 | // * pos,col & groupId are mandatory 13 | // * update the stride value in the first line of this file 14 | // * change the initialization of the pointData elements in: 15 | // - dx11/Data_CS_BuildPcb_DynamicBuffer.fx 16 | // - dx11/Data_CS_BuildPcb_Kinect.fx 17 | // - dx11/Data_CS_BuildPcb_Layer.fx 18 | // * you have to update plugins/LinkedList/effects/LinkedList.fx and recompile LinkedListNode 19 | // * you have to update plugins/RingBuffer/effects/RingBuffer.fx and recompile RingBuffer 20 | // * you have to update plugins/RingBufferIndexing/effects/RingBufferIndexing.fx and recompile RingBufferIndexing -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_UpdateForces.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_ForceData.fxh" 2 | RWStructuredBuffer rwForceBuffer : BACKBUFFER; 3 | 4 | int groupId = -1; 5 | bool Apply; 6 | 7 | [numthreads(64, 1, 1)] 8 | void CS_Apply( uint3 i : SV_DispatchThreadID) 9 | { 10 | uint cnt, stride; 11 | rwForceBuffer.GetDimensions(cnt,stride); 12 | if (i.x >= cnt) { return; } 13 | 14 | if (Apply){ 15 | if ( groupId == -1 || rwForceBuffer[i.x].groupId == groupId){ 16 | 17 | rwForceBuffer[i.x].velocity += rwForceBuffer[i.x].acceleration; 18 | rwForceBuffer[i.x].acceleration *=0; 19 | 20 | rwForceBuffer[i.x].position += rwForceBuffer[i.x].velocity; 21 | 22 | rwForceBuffer[i.x].age ++; 23 | 24 | } 25 | } 26 | 27 | 28 | } 29 | 30 | technique11 ApplyForce 31 | { 32 | pass P0 33 | { 34 | SetComputeShader( CompileShader( cs_5_0, CS_Apply() ) ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /nodes/plugins/RingBufferIndexing/effects/RingBufferIndexing.fx: -------------------------------------------------------------------------------- 1 | 2 | struct pointData 3 | { 4 | float3 pos; 5 | int col; 6 | int groupId; 7 | }; 8 | 9 | StructuredBuffer pdBuffer : POINTCLOUDBUFFERIN; 10 | 11 | float4x4 PointTransform : POINTTRANSFORM; 12 | 13 | RWStructuredBuffer pcBuffer : POINTCLOUDBUFFEROUT; 14 | RWStructuredBuffer indexBuffer : INDEXBUFFER; 15 | 16 | [numthreads(64,1,1)] 17 | void CS_Build(uint3 i : SV_DispatchThreadID) 18 | { 19 | uint cnt, stride; 20 | pdBuffer.GetDimensions(cnt,stride); 21 | if (i.x >= cnt) { return; } 22 | 23 | pointData pd = pdBuffer[i.x]; 24 | uint index = pcBuffer.IncrementCounter(); 25 | pcBuffer[index] = pd; 26 | indexBuffer[index] = i.x; 27 | 28 | } 29 | 30 | technique11 BuildHash 31 | { 32 | pass P0 33 | { 34 | SetComputeShader( CompileShader( cs_5_0, CS_Build() ) ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_UpdatePointcloudRingBuffer.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_PointData.fxh" 2 | StructuredBuffer pcBufferIn; 3 | StructuredBuffer updatedBufferIn; 4 | ByteAddressBuffer InputCountBuffer; 5 | 6 | RWStructuredBuffer rwPcBufferOut : BACKBUFFER; 7 | 8 | bool Update; 9 | bool Reset; 10 | 11 | [numthreads(64, 1, 1)] 12 | void CS_Apply( uint3 i : SV_DispatchThreadID) 13 | { 14 | uint cnt = InputCountBuffer.Load(0); 15 | if (i.x >= cnt ) { return;} // safeguard 16 | 17 | if( Update && updatedBufferIn[i.x] == 1){ 18 | pointData pd = pcBufferIn[i.x]; 19 | rwPcBufferOut[i.x] = pd; 20 | } 21 | 22 | if (Reset){ 23 | pointData pd = pcBufferIn[i.x]; 24 | pd.pos = float3(0,0,0); 25 | rwPcBufferOut[i.x] = pd; 26 | } 27 | } 28 | 29 | technique11 Emit 30 | { 31 | pass P0 32 | { 33 | SetComputeShader( CompileShader( cs_5_0, CS_Apply() ) ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_Deceleration.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_ForceData.fxh" 2 | RWStructuredBuffer rwForceBuffer : BACKBUFFER; 3 | 4 | int groupId = -1; 5 | float deceleration_multiplicator = 0.01f; 6 | bool Apply; 7 | 8 | [numthreads(64, 1, 1)] 9 | void CS_Apply( uint3 i : SV_DispatchThreadID) 10 | { 11 | uint cnt, stride; 12 | rwForceBuffer.GetDimensions(cnt,stride); 13 | if (i.x >= cnt) { return; } 14 | 15 | if (Apply){ 16 | if ( groupId == -1 || rwForceBuffer[i.x].groupId == groupId){ 17 | 18 | float3 deceleration = rwForceBuffer[i.x].velocity * -1; 19 | deceleration *= deceleration_multiplicator; 20 | deceleration *= rwForceBuffer[i.x].mass; 21 | 22 | rwForceBuffer[i.x].acceleration += deceleration; 23 | } 24 | } 25 | 26 | 27 | } 28 | 29 | technique11 ApplyForce 30 | { 31 | pass P0 32 | { 33 | SetComputeShader( CompileShader( cs_5_0, CS_Apply() ) ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /nodes/fxh/_PointData.fxh: -------------------------------------------------------------------------------- 1 | //stride: 20 2 | 3 | struct pointData 4 | { 5 | float3 pos; 6 | int col; 7 | int groupId; 8 | }; 9 | 10 | // NOTES ABOUT EXTENDING THE POINT STRUCTURE 11 | // ========================================================== 12 | // * pos,col & groupId are mandatory 13 | // * update the stride value in the first line of this file 14 | // * change the initialization of the pointData elements in: 15 | // - dx11/Data_CS_BuildPcb_DynamicBuffer.fx 16 | // - dx11/Data_CS_BuildPcb_Kinect.fx 17 | // - dx11/Data_CS_BuildPcb_Layer.fx 18 | // * you have to update plugins/LinkedList/effects/LinkedList.fx and recompile LinkedListNode 19 | // * you have to update plugins/RingBuffer/effects/RingBuffer.fx and recompile RingBuffer 20 | // * you have to update plugins/RingBufferIndexing/effects/RingBufferIndexing.fx and recompile RingBufferIndexing 21 | // * you have to update network nodes (readbacks!) -------------------------------------------------------------------------------- /nodes/dx11/Analysis_CS_Bounds.fx: -------------------------------------------------------------------------------- 1 | Texture2D texMin; 2 | Texture2D texMax; 3 | RWStructuredBuffer boundsBuffer : BACKBUFFER; 4 | float pixPos; 5 | int slice; 6 | 7 | SamplerState sPoint : IMMUTABLE 8 | { 9 | Filter = MIN_MAG_MIP_POINT; 10 | AddressU = Border; 11 | AddressV = Border; 12 | }; 13 | 14 | [numthreads(1, 1, 1)] 15 | void CS_CalculateBounds( uint3 i : SV_DispatchThreadID) 16 | { 17 | float3 minCoords = texMin.SampleLevel(sPoint, float2(pixPos,0),0).xyz; 18 | float3 maxCoords = texMax.SampleLevel(sPoint, float2(pixPos,0),0).xyz; 19 | boundsBuffer[slice * 4 + 0] = (minCoords+maxCoords) / 2; 20 | boundsBuffer[slice * 4 + 1] = maxCoords - minCoords; 21 | boundsBuffer[slice * 4 + 2] = minCoords; 22 | boundsBuffer[slice * 4 + 3] = maxCoords; 23 | } 24 | 25 | technique11 CalculateBounds 26 | { 27 | pass P0 28 | { 29 | SetComputeShader( CompileShader( cs_5_0, CS_CalculateBounds() ) ); 30 | } 31 | } -------------------------------------------------------------------------------- /girlpower/CustomizingDatastructure/dx11/Data_CS_AdaptFromCustomBuffer.fx: -------------------------------------------------------------------------------- 1 | // Original Pointcloud Data 2 | #include "_PointData.fxh" 3 | AppendStructuredBuffer pcBuffer : BACKBUFFER; 4 | 5 | // Our Custom Buffer 6 | #include "_CustomPointData.fxh" 7 | StructuredBuffer cpcBuffer; 8 | 9 | int elementcount; 10 | 11 | [numthreads(64, 1, 1)] 12 | void CSBuildPointcloudBuffer( uint3 i : SV_DispatchThreadID ) 13 | { 14 | 15 | if(i.x >= asuint(elementcount)){return;} 16 | 17 | customPointData cpd = cpcBuffer[i.x]; 18 | float3 pos = cpd.pos; 19 | float4 col = cpd.col; 20 | int groupId = cpd.groupId; 21 | 22 | if(pos.x != 0.0 && pos.y != 0.0 && pos.z != 0.0){ 23 | pointData pd = {pos,col, groupId}; 24 | pcBuffer.Append(pd); 25 | } 26 | 27 | } 28 | 29 | technique11 FromCustomBuffer 30 | { 31 | pass P0 32 | { 33 | SetComputeShader( CompileShader( cs_5_0, CSBuildPointcloudBuffer() ) ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /nodes/plugins/RawCompress/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_ApplyForce_GroupId.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_PointData.fxh" 2 | RWStructuredBuffer rwPcBufferOut : BACKBUFFER; 3 | 4 | #include "../fxh/_ForceData.fxh" 5 | StructuredBuffer rwForceBufferIn; 6 | 7 | int groupId = -1; 8 | bool Apply; 9 | bool CopyGroupIds = 0; 10 | 11 | [numthreads(64, 1, 1)] 12 | void CS_Apply( uint3 i : SV_DispatchThreadID) 13 | { 14 | uint cnt, stride; 15 | rwPcBufferOut.GetDimensions(cnt,stride); 16 | if (i.x >= cnt) { return; } 17 | 18 | if (Apply && rwForceBufferIn[i.x].alive == true) { 19 | pointData pd = rwPcBufferOut[i.x]; 20 | if ( groupId == -1 || pd.groupId == groupId){ 21 | forceData fd = rwForceBufferIn[i.x]; 22 | pd.pos = fd.position; 23 | if ( CopyGroupIds ) pd.groupId = fd.groupId; 24 | rwPcBufferOut[i.x] = pd; 25 | } 26 | } 27 | 28 | } 29 | 30 | technique11 ApplyForce 31 | { 32 | pass P0 33 | { 34 | SetComputeShader( CompileShader( cs_5_0, CS_Apply() ) ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | http://creativecommons.org/licenses/by-nc-sa/4.0/legalcode 2 | Copyright (c) 2014 intolight 3 | 4 | You are free to: 5 | 6 | * Share — copy and redistribute the material in any medium or format 7 | * Adapt — remix, transform, and build upon the material 8 | 9 | The licensor cannot revoke these freedoms as long as you follow the license terms. 10 | Under the following terms: 11 | 12 | * Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 13 | * NonCommercial — You may not use the material for commercial purposes. 14 | * ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. 15 | 16 | No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 17 | -------------------------------------------------------------------------------- /nodes/texture11/Filters_DepthSmooth.tfx: -------------------------------------------------------------------------------- 1 | Texture2D tex0: PREVIOUS; 2 | Texture2D tex1 ; 3 | SamplerState s0 { 4 | Filter=MIN_MAG_MIP_LINEAR;AddressU=CLAMP;AddressV=CLAMP;}; 5 | float2 R:TARGETSIZE; 6 | 7 | cbuffer controls:register(b0){ 8 | float Attack =0.9; 9 | float Decay =0.9; 10 | float DistanceThreshold = 0.02; 11 | bool Reset = false; 12 | }; 13 | 14 | float4 pNORMAL(float4 PosWVP:SV_POSITION,float2 x:TEXCOORD0):SV_TARGET{ 15 | float4 newV =tex0.Sample(s0,x); 16 | if (Reset) return newV; 17 | 18 | float4 oldV=tex1.Sample(s0,x); 19 | 20 | float interpolate = 1 - Decay; 21 | if (newV.x>=oldV.x) interpolate= 1 - Attack; 22 | 23 | oldV += (newV-oldV)*interpolate; 24 | if ( distance(newV.x ,oldV.x) > DistanceThreshold) oldV = newV; 25 | 26 | return oldV; 27 | } 28 | 29 | technique10 Normal{pass P0 {SetPixelShader(CompileShader(ps_4_0,pNORMAL()));}} 30 | -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_VectorField.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_ForceData.fxh" 2 | RWStructuredBuffer rwForceBuffer : BACKBUFFER; 3 | 4 | int groupId = -1; 5 | 6 | float4x4 tW : WORLD; 7 | 8 | SamplerState volumeSampler // : IMMUTABLE 9 | { 10 | Filter = MIN_MAG_MIP_LINEAR; 11 | AddressU = Border; 12 | AddressV = Border; 13 | AddressW = Border; 14 | }; 15 | Texture3D VolumeTexture3D ; 16 | 17 | bool Apply; 18 | 19 | float3 fieldPower = 1; 20 | 21 | [numthreads(64, 1, 1)] 22 | void CS_Apply( uint3 i : SV_DispatchThreadID) 23 | { 24 | uint cnt, stride; 25 | rwForceBuffer.GetDimensions(cnt,stride); 26 | if (i.x >= cnt) { return; } 27 | 28 | if(Apply){ 29 | 30 | float4 p = mul(float4(rwForceBuffer[i.x].position,1), tW); 31 | float4 force = VolumeTexture3D.SampleLevel(volumeSampler,((p.xyz) + 0.5 ),0) * float4(fieldPower,1); 32 | 33 | if ( groupId == -1 || rwForceBuffer[i.x].groupId == groupId){ 34 | rwForceBuffer[i.x].acceleration += force.xyz; 35 | } 36 | 37 | } 38 | 39 | } 40 | 41 | technique11 ApplyForce 42 | { 43 | pass P0 44 | { 45 | SetComputeShader( CompileShader( cs_5_0, CS_Apply() ) ); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /nodes/dx11/Analysis_CS_CountGroupIds.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_PointData.fxh" 2 | StructuredBuffer pcBuffer; 3 | ByteAddressBuffer InputCountBuffer; 4 | 5 | RWStructuredBuffer countGroupIdBuffer : BACKBUFFER; 6 | int drawIndex : DRAWINDEX; 7 | int groupId; 8 | bool countmode; 9 | 10 | [numthreads(1,1,1)] 11 | void CS_Clear(uint3 i : SV_DispatchThreadID) 12 | { 13 | countGroupIdBuffer[drawIndex] = 0; 14 | } 15 | 16 | [numthreads(64, 1, 1)] 17 | void CS_HitTest( uint3 i : SV_DispatchThreadID) 18 | { 19 | uint cnt = InputCountBuffer.Load(0); 20 | if (i.x >= cnt ) { return;} 21 | if ( !countmode && countGroupIdBuffer[drawIndex] > 0) {return;} 22 | 23 | if (pcBuffer[i.x].groupId == groupId){ 24 | 25 | if(countmode){ 26 | uint oldval; 27 | InterlockedAdd(countGroupIdBuffer[drawIndex],1,oldval); 28 | } 29 | else countGroupIdBuffer[drawIndex] = 1; 30 | } 31 | 32 | } 33 | 34 | technique11 Clear 35 | { 36 | pass P0 37 | { 38 | SetComputeShader( CompileShader( cs_5_0, CS_Clear() ) ); 39 | } 40 | } 41 | 42 | technique11 HitTest 43 | { 44 | pass P0 45 | { 46 | SetComputeShader( CompileShader( cs_5_0, CS_HitTest() ) ); 47 | } 48 | } -------------------------------------------------------------------------------- /nodes/dx11/Analysis_CS_BlobExtraction_SetGroupId.fx: -------------------------------------------------------------------------------- 1 | float4x4 tVP: VIEWPROJECTION; 2 | float2 textureSize; 3 | 4 | #include "../fxh/_PointData.fxh" 5 | StructuredBuffer pcBuffer; 6 | 7 | StructuredBuffer labelBuffer; 8 | StructuredBuffer groupIdBuffer; 9 | 10 | ByteAddressBuffer InputCountBuffer; 11 | AppendStructuredBuffer newPcBuffer : BACKBUFFER; 12 | 13 | [numthreads(64, 1, 1)] 14 | void CS( uint3 i : SV_DispatchThreadID) 15 | { 16 | uint cnt = InputCountBuffer.Load(0); 17 | if (i.x >= cnt ) { return;} 18 | 19 | pointData pd = pcBuffer[i.x]; 20 | float4 pos = mul(float4(pd.pos,1), tVP); 21 | float2 uv = pos.xy/pos.w; 22 | 23 | float x = uv.x * 0.5 + 0.5; 24 | float y = uv.y * -0.5 + 0.5; 25 | 26 | int count = y * textureSize.y; 27 | int id = (x * textureSize.x) + (count * textureSize.x); 28 | if (id > 0 && id < textureSize.x * textureSize.y){ 29 | int label = labelBuffer[id]; 30 | if( label > 0 && groupIdBuffer[label - 1] != -1) pd.groupId = groupIdBuffer[label - 1]; 31 | } 32 | 33 | newPcBuffer.Append(pd); 34 | } 35 | 36 | technique11 SetGroupIds 37 | { 38 | pass P0{ SetComputeShader( CompileShader( cs_5_0, CS() ) );} 39 | } -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_SelfRepulsion.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_ForceData.fxh" 2 | RWStructuredBuffer rwForceBuffer : BACKBUFFER; 3 | 4 | int groupId = -1; 5 | float gamma; 6 | float radius; 7 | float repulseAmount; 8 | bool Apply; 9 | 10 | [numthreads(64, 1, 1)] 11 | void CS_Apply( uint3 i : SV_DispatchThreadID) 12 | { 13 | uint cnt, stride; 14 | rwForceBuffer.GetDimensions(cnt,stride); 15 | if (i.x >= cnt) { return; } 16 | 17 | float dist = 0; 18 | float g = gamma/(1.00001-gamma); 19 | 20 | for( uint j = 0; j < cnt; j++ ) 21 | { 22 | if (Apply) { 23 | if ( groupId == -1 || rwForceBuffer[i.x].groupId == groupId){ 24 | dist = distance(rwForceBuffer[i.x].position,rwForceBuffer[j].position); 25 | if (i.x != j){ 26 | if (dist < radius){ 27 | float f = saturate( 1 - dist * 2); 28 | f = pow( f, g ); 29 | rwForceBuffer[i.x].velocity += (rwForceBuffer[i.x].position - rwForceBuffer[j].position) * lerp(0.0f,1.00f,f)*radius*repulseAmount; 30 | } 31 | } 32 | } 33 | } 34 | } 35 | 36 | } 37 | 38 | technique11 ApplyForce 39 | { 40 | pass P0 41 | { 42 | SetComputeShader( CompileShader( cs_5_0, CS_Apply() ) ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nodes/dx11/Filters_CS_FilterPcb_GroupId.fx: -------------------------------------------------------------------------------- 1 | float4x4 tFilter : WORLD; 2 | int groupIds; 3 | 4 | #include "../fxh/_PointData.fxh" 5 | StructuredBuffer pcBuffer; 6 | ByteAddressBuffer InputCountBuffer; 7 | 8 | AppendStructuredBuffer newPcBuffer : BACKBUFFER; 9 | 10 | [numthreads(64, 1, 1)] 11 | void CS_Restrict( uint3 i : SV_DispatchThreadID) 12 | { 13 | uint cnt = InputCountBuffer.Load(0); 14 | if (i.x >= cnt ) { return;} 15 | 16 | if( pcBuffer[i.x].groupId == groupIds || groupIds == -1){ 17 | pointData pd = pcBuffer[i.x]; 18 | newPcBuffer.Append(pd); 19 | } 20 | } 21 | 22 | [numthreads(64, 1, 1)] 23 | void CS_Subtract( uint3 i : SV_DispatchThreadID) 24 | { 25 | uint cnt = InputCountBuffer.Load(0); 26 | if (i.x >= cnt ) { return;} 27 | 28 | if( pcBuffer[i.x].groupId != groupIds || groupIds == -1){ 29 | pointData pd = pcBuffer[i.x]; 30 | newPcBuffer.Append(pd); 31 | } 32 | } 33 | 34 | technique11 Restrict 35 | { 36 | pass P0 37 | { 38 | SetComputeShader( CompileShader( cs_5_0, CS_Restrict() ) ); 39 | } 40 | } 41 | 42 | technique11 Subtract 43 | { 44 | pass P0 45 | { 46 | SetComputeShader( CompileShader( cs_5_0, CS_Subtract() ) ); 47 | } 48 | } -------------------------------------------------------------------------------- /nodes/plugins/AdvancedQueue/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("DemoPlugin")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("DemoPlugin")] 17 | [assembly: AssemblyCopyright("Copyright 2010")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /nodes/plugins/LinkedList/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("LinkedList")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("LinkedList")] 17 | [assembly: AssemblyCopyright("Copyright 2014")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /nodes/plugins/RawSplitter/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("DemoPlugin")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("DemoPlugin")] 17 | [assembly: AssemblyCopyright("Copyright 2010")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /nodes/plugins/RingBuffer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("RingBuffer")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("RingBuffer")] 17 | [assembly: AssemblyCopyright("Copyright 2015")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /nodes/plugins/StringIndexer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("DemoPlugin")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("DemoPlugin")] 17 | [assembly: AssemblyCopyright("Copyright 2010")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /nodes/plugins/DX11.TextureCCL/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("DemoPlugin")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("DemoPlugin")] 17 | [assembly: AssemblyCopyright("Copyright 2010")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /nodes/plugins/Kabsch (Vector 3d)/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("DemoPlugin")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("DemoPlugin")] 17 | [assembly: AssemblyCopyright("Copyright 2010")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /nodes/plugins/RawPartialReader/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("DemoPlugin")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("DemoPlugin")] 17 | [assembly: AssemblyCopyright("Copyright 2010")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /nodes/plugins/BasicTransformCamera/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("DemoPlugin")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("DemoPlugin")] 17 | [assembly: AssemblyCopyright("Copyright 2010")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /nodes/plugins/RawCompress/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("RawCompressPlugin")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("RawCompressPlugin")] 17 | [assembly: AssemblyCopyright("Copyright 2015")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /research/plugins/ValueRawSequentialReader/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("DemoPlugin")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("DemoPlugin")] 17 | [assembly: AssemblyCopyright("Copyright 2010")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /nodes/dx11/Tools_CS_PickPoints_RGBDepth.fx: -------------------------------------------------------------------------------- 1 | float4x4 tW : WORLD; 2 | RWStructuredBuffer rwbuffer : BACKBUFFER; 3 | Texture2D texDepth ; 4 | Texture2D texRGBDepth ; 5 | StructuredBuffer uv ; 6 | float2 FOV; 7 | int count; 8 | 9 | SamplerState sPoint : IMMUTABLE 10 | { 11 | Filter = MIN_MAG_MIP_POINT; 12 | AddressU = Border; 13 | AddressV = Border; 14 | }; 15 | 16 | 17 | [numthreads(1, 1, 1)] 18 | void CS( uint3 i : SV_DispatchThreadID) 19 | { 20 | if (i.x >= (uint) count ) { return;} 21 | float2 coords = texRGBDepth.SampleLevel(sPoint,uv[i.x],0).rg; 22 | 23 | float depth = texDepth.SampleLevel(sPoint,coords,0).r * 65.535 ; 24 | float XtoZ = tan(FOV.x/2) * 2; 25 | float YtoZ = tan(FOV.y/2) * 2; 26 | 27 | float4 pos = float4(0,0,0,1); 28 | pos.x = ((uv[i.x].x - 0.5) * depth * XtoZ * -1); 29 | pos.y = ((0.5 - uv[i.x].y ) * depth * YtoZ); 30 | pos.z = depth; 31 | pos = mul(pos, tW); 32 | 33 | rwbuffer[i.x] = pos.xyz; 34 | } 35 | 36 | technique11 Process 37 | { 38 | pass P0 39 | { 40 | SetComputeShader( CompileShader( cs_5_0, CS() ) ); 41 | } 42 | } 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /nodes/plugins/Track (Vector3D)/Vector3DCache/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("DemoPlugin")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("DemoPlugin")] 17 | [assembly: AssemblyCopyright("Copyright 2010")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /nodes/plugins/RingBufferIndexing/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("RingBufferIndexing")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("RingBufferIndexing")] 17 | [assembly: AssemblyCopyright("Copyright 2015")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /research/plugins/AsyncRawWriter/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("AsyncRawWriter")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("intolight")] 16 | [assembly: AssemblyProduct("AsyncRawWriter")] 17 | [assembly: AssemblyCopyright("Copyright 2015")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /nodes/plugins/Track (Vector3D)/NearestPairs/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("NearestPairs")] 13 | [assembly: AssemblyDescription("Finds unique matches based on distance")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("intolight")] 16 | [assembly: AssemblyProduct("TrackVector3D")] 17 | [assembly: AssemblyCopyright("Copyright 2014")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /nodes/plugins/RingBuffer/effects/RingBuffer.fx: -------------------------------------------------------------------------------- 1 | struct pointData 2 | { 3 | float3 fPos; 4 | int fCol; 5 | int iGroupId; 6 | }; 7 | 8 | StructuredBuffer bPointcloud : POINTCLOUDBUFFER; 9 | ByteAddressBuffer InputCountBuffer : POINTCLOUDCOUNTBUFFER; 10 | 11 | RWStructuredBuffer rbPointcloud : POINTCLOUDRINGBUFFER; 12 | RWStructuredBuffer rbUpdated : UPDATEDRINGBUFFER; 13 | int iRbSize : POINTCLOUDRINGBUFFERSIZE; 14 | 15 | ByteAddressBuffer bOffset : OFFSETBUFFER; 16 | RWStructuredBuffer bCounter : COUNTERBUFFER; 17 | 18 | [numthreads(64, 1, 1)] 19 | void CS_AddPoints(uint3 i : SV_DispatchThreadID) 20 | { 21 | uint cnt = InputCountBuffer.Load(0); 22 | if (i.x >= cnt) { return; } 23 | 24 | pointData pd = bPointcloud[i.x]; 25 | uint index = (bCounter[0] + bCounter.IncrementCounter()) % iRbSize; 26 | rbPointcloud[index] = pd; 27 | rbUpdated[index] = 1; 28 | } 29 | 30 | [numthreads(1, 1, 1)] 31 | void CS_CalcOffset(uint3 i : SV_DispatchThreadID) 32 | { 33 | uint offset = bOffset.Load(0); 34 | bCounter[0] = (bCounter[0] + offset) % iRbSize; 35 | } 36 | 37 | technique11 AddPoints 38 | { 39 | pass P0 { SetComputeShader(CompileShader(cs_5_0, CS_AddPoints())); } 40 | } 41 | 42 | technique11 CalcOffset 43 | { 44 | pass P0 { SetComputeShader(CompileShader(cs_5_0, CS_CalcOffset())); } 45 | } -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_Attractor.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_ForceData.fxh" 2 | RWStructuredBuffer rwForceBuffer : BACKBUFFER; 3 | StructuredBuffer updatedBufferIn; 4 | 5 | StructuredBuffer AttractorPosition; 6 | StructuredBuffer Force; 7 | StructuredBuffer Size; 8 | int groupId = -1; 9 | 10 | bool updatedOnly; 11 | bool Apply; 12 | 13 | 14 | [numthreads(64, 1, 1)] 15 | void CS_Attractor( uint3 i : SV_DispatchThreadID) 16 | { 17 | uint cnt, stride; 18 | rwForceBuffer.GetDimensions(cnt,stride); 19 | 20 | if (Apply) { 21 | if (updatedOnly && updatedBufferIn[i.x] == 0){ return; } 22 | 23 | AttractorPosition.GetDimensions(cnt,stride); 24 | int attractorCount = cnt; 25 | for (int j = 0; j < attractorCount; j++) 26 | { 27 | if ( groupId == -1 || rwForceBuffer[i.x].groupId == groupId){ 28 | 29 | float3 dist = AttractorPosition[j] - rwForceBuffer[i.x].position; 30 | Size.GetDimensions(cnt,stride); 31 | float f = (length(dist) / Size[j % cnt]); 32 | f = 1 - f; 33 | f = saturate(f); 34 | f = pow(f, 2.71); 35 | Force.GetDimensions(cnt,stride); 36 | rwForceBuffer[i.x].acceleration += dist * f * Force[j % cnt]; 37 | } 38 | } 39 | } 40 | } 41 | 42 | technique11 Attractor 43 | { 44 | pass P0{ SetComputeShader(CompileShader(cs_5_0, CS_Attractor())); } 45 | } 46 | -------------------------------------------------------------------------------- /nodes/texture11/Analysis_BlobExtraction_DebugGroupId.tfx: -------------------------------------------------------------------------------- 1 | //@author: tmp 2 | //@help: Converts a position texture to a binary texture where pixels are white when their neighbour distances are below a threshold 3 | //@tags: texture 4 | //@credits: 5 | 6 | Texture2D texture2d : PREVIOUS; 7 | float2 textureSize:TARGETSIZE; 8 | StructuredBuffer labelBuffer; 9 | StructuredBuffer groupIdBuffer; 10 | 11 | struct psInput 12 | { 13 | float4 p : SV_Position; 14 | float2 uv : TEXCOORD0; 15 | }; 16 | 17 | float4 randColor(in float id) { 18 | float noiseX = (frac(sin(dot(float2(id,id), float2(12.9898,78.233) )) * 43758.5453)); 19 | float noiseY = (frac(sin(dot(float2(id,id), float2(12.9898,78.233) * 2.0)) * 43758.5453)); 20 | float noiseZ = sqrt(1 - noiseX * noiseX); 21 | return float4(noiseX, noiseY,noiseZ,1); 22 | } 23 | 24 | float4 PS(psInput input) : SV_Target 25 | { 26 | float x = input.uv.x; 27 | float y = input.uv.y; 28 | 29 | int count = y * textureSize.y; 30 | int id = (x * textureSize.x) + (count * textureSize.x); 31 | float4 c = float4(0,0,0,0); 32 | int label = labelBuffer[id]; 33 | if( label > 0 && groupIdBuffer[label - 1] != -1) c = randColor(groupIdBuffer[label - 1]); 34 | 35 | return c; 36 | } 37 | 38 | technique10 Process 39 | { 40 | pass P0 41 | { 42 | SetPixelShader(CompileShader(ps_4_0,PS())); 43 | } 44 | } 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /girlpower/ExtendingDatastructure/dx11/Data_CS_RwPcBuffer.fx: -------------------------------------------------------------------------------- 1 | // Original Pointcloud Data 2 | #include "_PointData.fxh" 3 | StructuredBuffer pcBuffer; 4 | ByteAddressBuffer InputCountBuffer; 5 | 6 | // Our Extension Buffer 7 | #include "_pointDataExtension.fxh" 8 | StructuredBuffer rwForceBuffer; 9 | 10 | RWStructuredBuffer pdBuffer : BACKBUFFER; 11 | 12 | 13 | int elementcount; 14 | bool update; 15 | 16 | [numthreads(64, 1, 1)] 17 | void CS_Apply( uint3 i : SV_DispatchThreadID) 18 | { 19 | uint pcBufferSize = InputCountBuffer.Load(0); 20 | if (i.x >= asuint(elementcount)) { return;} // safeguard 21 | 22 | // updates the RWBuffer with current pointcloud data 23 | // ================================================= 24 | if( update ){ 25 | pointData pd = pcBuffer[i.x % pcBufferSize]; 26 | pdBuffer[i.x] = pd; 27 | } 28 | 29 | // update the RWBuffer with data from the RWForceBuffer 30 | // ================================================= 31 | pointData pd = pdBuffer[i.x]; // get current element 32 | pointDataExtension pde = rwForceBuffer[i.x]; // get current element 33 | 34 | pd.pos += pde.force; 35 | pd.col *= 1- (pde.age/1000); 36 | 37 | pdBuffer[i.x] = pd; 38 | 39 | } 40 | 41 | technique11 ToCustomBuffer 42 | { 43 | pass P0 44 | { 45 | SetComputeShader( CompileShader( cs_5_0, CS_Apply() ) ); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /nodes/dx11/Analysis_PixelPerGroup.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_PointData.fxh" 2 | StructuredBuffer pcBuffer; 3 | 4 | float pixPos; 5 | int groupId; 6 | 7 | struct vsInput 8 | { 9 | uint ii : SV_VertexID; 10 | }; 11 | 12 | struct vs2ps 13 | { 14 | float4 pos: SV_POSITION; 15 | float4 col: COLOR; 16 | }; 17 | 18 | /* ===================== VERTEX SHADER ===================== */ 19 | 20 | vs2ps VS(vsInput input) 21 | { 22 | vs2ps output = (vs2ps)0; 23 | 24 | // set pixel position - each filter has its own pixel position 25 | output.pos = float4(pixPos, 0.0 ,0.0 ,1.0); 26 | 27 | // now check if the particles filterId equals the current filterId 28 | 29 | if (pcBuffer[input.ii].groupId == groupId){ 30 | output.col = float4(pcBuffer[input.ii].pos.xyz,1.0f); 31 | } 32 | else output.col = float4(0,0,0,0.0f); 33 | 34 | //if (slice == 2) output.col = float4(0,0,0,0); 35 | //output.col = float4(pcBuffer[input.ii].pos.xyz,1.0f); 36 | 37 | return output; 38 | } 39 | 40 | /* ===================== PIXEL SHADER ===================== */ 41 | 42 | float4 PS(vs2ps input): SV_Target 43 | { 44 | return input.col; 45 | } 46 | 47 | /* ===================== TECHNIQUE ===================== */ 48 | 49 | technique10 Process 50 | { 51 | pass P0 52 | { 53 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 54 | SetPixelShader( CompileShader( ps_4_0, PS() ) ); 55 | } 56 | } -------------------------------------------------------------------------------- /nodes/fxh/PhongDirectional.fxh: -------------------------------------------------------------------------------- 1 | //light properties 2 | float3 lDir = {0, -5, 2}; //light direction in world space 3 | float4 lAmb = {0.15, 0.15, 0.15, 1}; 4 | float4 lDiff = {0.85, 0.85, 0.85, 1}; 5 | float4 lSpec = {0.35, 0.35, 0.35, 1}; 6 | float lPower = 25.0; //shininess of specular highlight 7 | 8 | //phong directional function 9 | float4 PhongDirectional(float3 NormV, float3 ViewDirV, float3 LightDirV) 10 | { 11 | //In.TexCd = In.TexCd / In.TexCd.w; // for perpective texture projections (e.g. shadow maps) ps_2_0 12 | 13 | float4 amb = float4(lAmb.rgb, 1); 14 | //halfvector 15 | float3 H = normalize(ViewDirV + LightDirV); 16 | 17 | //compute blinn lighting 18 | float3 shades = lit(dot(NormV, LightDirV), dot(NormV, H), lPower); 19 | 20 | float4 diff = lDiff * shades.y; 21 | diff.a = 1; 22 | 23 | //reflection vector (view space) 24 | float3 R = normalize(2 * dot(NormV, LightDirV) * NormV - LightDirV); 25 | 26 | //normalized view direction (view space) 27 | float3 V = normalize(ViewDirV); 28 | 29 | //calculate specular light 30 | float4 spec = pow(max(dot(R, V),0), lPower*.2) * lSpec; 31 | 32 | return (amb + diff) + spec; 33 | } -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_UpdateForcesRingBuffer.fx: -------------------------------------------------------------------------------- 1 | ByteAddressBuffer InputCountBuffer; 2 | StructuredBuffer updatedBufferIn; 3 | 4 | #include "../fxh/_PointData.fxh" 5 | StructuredBuffer pcBufferIn; 6 | 7 | #include "../fxh/_ForceData.fxh" 8 | RWStructuredBuffer rwForceBuffer : BACKBUFFER; 9 | 10 | bool Update; 11 | bool Reset; 12 | 13 | [numthreads(64, 1, 1)] 14 | void CS_Apply( uint3 i : SV_DispatchThreadID) 15 | { 16 | uint cnt = InputCountBuffer.Load(0); 17 | if (i.x >= cnt ) { return;} // safeguard 18 | 19 | float3 position = pcBufferIn[i.x].pos; 20 | int groupId = pcBufferIn[i.x].groupId; 21 | 22 | // updates the RWBuffer with current pointcloud data 23 | // ================================================= 24 | if( Update && updatedBufferIn[i.x] == 1){ 25 | float3 velocity = float3(0,0,0); 26 | float3 acceleration = float3(0,0,0); 27 | float mass = 1.0; 28 | int age = 0; 29 | forceData fd = {position, velocity, acceleration, mass, age, groupId, true}; 30 | rwForceBuffer[i.x] = fd; 31 | } 32 | 33 | if (Reset){ 34 | float3 velocity = float3(0,0,0); 35 | float3 acceleration = float3(0,0,0); 36 | float mass = 1.0; 37 | int age = 0; 38 | forceData fd = {position, velocity, acceleration, mass, age, groupId, false}; 39 | rwForceBuffer[i.x] = fd; 40 | } 41 | 42 | } 43 | 44 | technique11 Emit 45 | { 46 | pass P0 47 | { 48 | SetComputeShader( CompileShader( cs_5_0, CS_Apply() ) ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /nodes/plugins/LinkedList/effects/LinkedList.fx: -------------------------------------------------------------------------------- 1 | 2 | struct LinkedListElement 3 | { 4 | uint id; 5 | uint next; 6 | }; 7 | 8 | struct pointData 9 | { 10 | float3 pos; 11 | int col; 12 | int groupId; 13 | }; 14 | 15 | StructuredBuffer PositionBuffer : POINTCLOUDBUFFER; 16 | 17 | float4x4 PointTransform : POINTTRANSFORM; 18 | 19 | RWStructuredBuffer RWLinkBuffer : RWLINKBUFFER; 20 | RWStructuredBuffer RWOffsetBuffer : RWOFFSETBUFFER; 21 | 22 | int GridCellSize : GRIDCELLSIZE; 23 | 24 | [numthreads(64,1,1)] 25 | void CS_Build(uint3 i : SV_DispatchThreadID) 26 | { 27 | uint cnt, stride; 28 | PositionBuffer.GetDimensions(cnt,stride); 29 | if (i.x >= cnt) { return; } 30 | 31 | float3 pos = PositionBuffer[i.x].pos; 32 | float4 tp = mul(float4(pos, 1), PointTransform); 33 | 34 | tp = tp * 0.5f + 0.5f; 35 | tp.y = 1.0f -tp.y; 36 | int3 cl = tp.xyz * GridCellSize; 37 | 38 | LinkedListElement element; 39 | element.id = i.x; 40 | 41 | uint counter = RWLinkBuffer.IncrementCounter(); 42 | uint cellindex = cl.z * GridCellSize * GridCellSize + cl.y * GridCellSize + cl.x; 43 | 44 | uint oldoffset; 45 | InterlockedExchange(RWOffsetBuffer[cellindex],counter,oldoffset); 46 | 47 | element.next = oldoffset; 48 | RWLinkBuffer[counter] = element; 49 | 50 | } 51 | 52 | technique11 BuildHash 53 | { 54 | pass P0 55 | { 56 | SetComputeShader( CompileShader( cs_5_0, CS_Build() ) ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /nodes/dx11/Visualization_ConstantMesh.fx: -------------------------------------------------------------------------------- 1 | //@author: tmp 2 | //@help: Constant Shader for the Kinect Mesh 3 | //@tags: DX11, Pointcloud, Mesh 4 | //@credits: 5 | 6 | //Texture2D texture2d ; 7 | Texture2D texRGB ; 8 | Texture2D texRGBDepth ; 9 | 10 | SamplerState sPoint : IMMUTABLE 11 | { 12 | Filter = MIN_MAG_MIP_POINT; 13 | AddressU = Border; 14 | AddressV = Border; 15 | }; 16 | 17 | cbuffer cbPerDraw : register( b0 ) 18 | { 19 | float4x4 tVP : VIEWPROJECTION; 20 | }; 21 | 22 | cbuffer cbPerObj : register( b1 ) 23 | { 24 | float4x4 tW : WORLD; 25 | float4 cAmb = { 1.0f,1.0f,1.0f,1.0f }; 26 | }; 27 | 28 | struct VS_IN 29 | { 30 | float4 PosO : POSITION; 31 | float4 TexCd : TEXCOORD0; 32 | }; 33 | 34 | struct vs2ps 35 | { 36 | float4 PosWVP: SV_POSITION; 37 | float4 TexCd: TEXCOORD0; 38 | }; 39 | 40 | vs2ps VS(VS_IN input) 41 | { 42 | vs2ps output; 43 | output.PosWVP = mul(input.PosO,mul(tW,tVP)); 44 | output.TexCd = input.TexCd; 45 | return output; 46 | } 47 | 48 | float4 PS(vs2ps In): SV_Target 49 | { 50 | float2 coords = texRGBDepth.SampleLevel(sPoint,In.TexCd.xy,0).rg; 51 | return texRGB.SampleLevel(sPoint,coords,0)* cAmb; 52 | } 53 | 54 | technique10 RGB 55 | { 56 | pass P0 57 | { 58 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 59 | SetPixelShader( CompileShader( ps_4_0, PS() ) ); 60 | } 61 | } -------------------------------------------------------------------------------- /nodes/texture11/Filters_DepthModifier.tfx: -------------------------------------------------------------------------------- 1 | Texture2D tex0: PREVIOUS; 2 | Texture2D tex1 ; 3 | 4 | SamplerState s0:IMMUTABLE {Filter=MIN_MAG_MIP_POINT;AddressU=CLAMP;AddressV=CLAMP;}; 5 | float2 R:TARGETSIZE; 6 | 7 | float4x4 tP ; 8 | float MinDepth=0; 9 | float MaxDepth=4.5; 10 | 11 | float RandomSeed=0; 12 | float RandomStrength = 1; 13 | 14 | // custom 1D noise function: 15 | float _dnoise1(float3 u){ 16 | u=dot(u+.2,float3(1,57,21)); 17 | return (u.x*(.1+sin(u.x))); 18 | } 19 | float _dnoise(float2 x,float RandomSeed){ 20 | RandomSeed+=.00001; 21 | float c={ 22 | _dnoise1(float3((x+RandomSeed*13+41)+11,length(sin((x-59)/151+RandomSeed*float2(11,7))))+.5), 23 | }; 24 | return frac(c+x.x*2+RandomSeed); 25 | } 26 | 27 | 28 | #define linstepr(a,b,x) saturate((x-a)/(b-a)) 29 | float4 pDEPTHTHRESHOLDKINECT(float4 PosWVP:SV_POSITION,float2 uv:TEXCOORD0):SV_Target{ 30 | float depth = tex1.SampleLevel(s0,uv,0).x; 31 | 32 | float c; 33 | if(depth >= 0.9) 34 | { 35 | c = tex0.SampleLevel(s0,uv,0).x; 36 | return c; 37 | } 38 | else 39 | { 40 | float rnd0 =_dnoise(PosWVP.xy,RandomSeed); 41 | float ld = tP._43 / (depth - tP._33); 42 | 43 | c = (linstepr(MinDepth, MaxDepth, ld) / 65.535 * MaxDepth) + rnd0 * (RandomStrength/100); 44 | 45 | return c; 46 | } 47 | 48 | } 49 | 50 | technique10 DepthThresholdKinect{ 51 | pass P0 52 | {SetPixelShader(CompileShader(ps_4_0,pDEPTHTHRESHOLDKINECT()));} 53 | } 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /girlpower/ExtendingDatastructure/dx11/Data_CS_RwForceBuffer.fx: -------------------------------------------------------------------------------- 1 | // Original Pointcloud Data 2 | #include "_PointData.fxh" 3 | StructuredBuffer pcBuffer; 4 | ByteAddressBuffer InputCountBuffer; 5 | 6 | // Our Extension Buffer 7 | #include "_pointDataExtension.fxh" 8 | RWStructuredBuffer rwForceBuffer : BACKBUFFER; 9 | 10 | int elementcount; 11 | 12 | float aging = 0.1; 13 | float speed = 0.04; 14 | 15 | bool update; 16 | 17 | [numthreads(64, 1, 1)] 18 | void CS_Apply( uint3 i : SV_DispatchThreadID) 19 | { 20 | uint pcBufferSize = InputCountBuffer.Load(0); 21 | if (i.x >= asuint(elementcount)) { return;} // safeguard 22 | 23 | // on update: 24 | // load data from the current pointcloudbuffer and 25 | // use the position of each point as force 26 | // ================================================ 27 | if( update ){ 28 | pointData pd = pcBuffer[i.x % pcBufferSize]; 29 | float3 force = pd.pos * speed; 30 | float age = 0; 31 | pointDataExtension pde = {force,age}; // create the new element 32 | rwForceBuffer[i.x] = pde; // and write it to the forceBuffer 33 | } 34 | 35 | 36 | // update the current ForceBuffer 37 | // ================================================= 38 | pointDataExtension pde = rwForceBuffer[i.x]; // get current element 39 | pde.age += aging; 40 | pde.force -= float3(0, 0.01f, 0) * speed; 41 | rwForceBuffer[i.x] = pde; 42 | 43 | } 44 | 45 | technique11 ToCustomBuffer 46 | { 47 | pass P0 48 | { 49 | SetComputeShader( CompileShader( cs_5_0, CS_Apply() ) ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /nodes/dx11/Filters_CS_FilterPcb_Transform.fx: -------------------------------------------------------------------------------- 1 | float4x4 tFilter : WORLD; 2 | int slice; 3 | 4 | #include "../fxh/_PointData.fxh" 5 | StructuredBuffer pcBuffer; 6 | ByteAddressBuffer InputCountBuffer; 7 | 8 | AppendStructuredBuffer filteredPcBuffer : BACKBUFFER; 9 | 10 | [numthreads(64, 1, 1)] 11 | void CS_Restrict( uint3 i : SV_DispatchThreadID) 12 | { 13 | uint cnt = InputCountBuffer.Load(0); 14 | if (i.x >= cnt ) { return;} 15 | 16 | //check if point position is inside the given filter(s) 17 | float3 pointCoord = mul(float4(pcBuffer[i.x].pos,1), tFilter).xyz; 18 | if( !(pointCoord.x < -0.5 || pointCoord.x > 0.5 || 19 | pointCoord.y < -0.5 || pointCoord.y > 0.5 || 20 | pointCoord.z < -0.5 || pointCoord.z > 0.5 21 | )){ 22 | pointData pd = pcBuffer[i.x]; 23 | pd.groupId = slice; 24 | filteredPcBuffer.Append(pd); 25 | } 26 | } 27 | 28 | [numthreads(64, 1, 1)] 29 | void CS_Subtract( uint3 i : SV_DispatchThreadID) 30 | { 31 | uint cnt = InputCountBuffer.Load(0); 32 | if (i.x >= cnt ) { return;} 33 | 34 | //check if point position is inside the given filter(s) 35 | float3 pointCoord = mul(float4(pcBuffer[i.x].pos,1), tFilter).xyz; 36 | if( (pointCoord.x < -0.5 || pointCoord.x > 0.5 || 37 | pointCoord.y < -0.5 || pointCoord.y > 0.5 || 38 | pointCoord.z < -0.5 || pointCoord.z > 0.5 39 | )){ 40 | filteredPcBuffer.Append(pcBuffer[i.x]); 41 | } 42 | } 43 | 44 | technique11 Restrict 45 | { 46 | pass P0 47 | { 48 | SetComputeShader( CompileShader( cs_5_0, CS_Restrict() ) ); 49 | } 50 | } 51 | 52 | technique11 Subtract 53 | { 54 | pass P0 55 | { 56 | SetComputeShader( CompileShader( cs_5_0, CS_Subtract() ) ); 57 | } 58 | } -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_Turbulence.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_ForceData.fxh" 2 | RWStructuredBuffer rwForceBuffer : BACKBUFFER; 3 | StructuredBuffer updatedBufferIn; 4 | 5 | int groupId = -1; 6 | 7 | #include "../fxh/NoiseFunction.fxh" 8 | 9 | SamplerState sPoint : IMMUTABLE 10 | { 11 | Filter = MIN_MAG_MIP_POINT; 12 | AddressU = Border; 13 | AddressV = Border; 14 | }; 15 | 16 | //NOISE FORCE: 17 | float3 noise_amount = float3(0.0f,0.0f,0.0f); 18 | float noise_time; 19 | int noise_oct; 20 | float noise_freq = 1; 21 | float noise_lacun = 1.666; 22 | float noise_pers = 0.666; 23 | 24 | bool updatedOnly; 25 | bool Apply; 26 | 27 | [numthreads(64, 1, 1)] 28 | void CS_Apply( uint3 i : SV_DispatchThreadID) 29 | { 30 | uint cnt, stride; 31 | rwForceBuffer.GetDimensions(cnt,stride); 32 | if (i.x >= cnt) { return; } 33 | 34 | if(Apply){ 35 | if (updatedOnly && updatedBufferIn[i.x] == 0){ return; } 36 | 37 | float3 pos = rwForceBuffer[i.x].position; 38 | 39 | // Noise Force 40 | float3 noiseF = float3( 41 | fBm(float4( pos + float3(51,2.36,-5),noise_time),noise_oct,noise_freq,noise_lacun,noise_pers), 42 | fBm(float4( pos + float3(98.2,-9,-36),noise_time),noise_oct,noise_freq,noise_lacun,noise_pers), 43 | fBm(float4( pos + float3(0,10.69,6),noise_time),noise_oct,noise_freq,noise_lacun,noise_pers) 44 | ); 45 | 46 | if ( groupId == -1 || rwForceBuffer[i.x].groupId == groupId){ 47 | 48 | rwForceBuffer[i.x].acceleration += noiseF * noise_amount; 49 | 50 | } 51 | 52 | } 53 | 54 | } 55 | 56 | technique11 ApplyForce 57 | { 58 | pass P0 59 | { 60 | SetComputeShader( CompileShader( cs_5_0, CS_Apply() ) ); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /girlpower/CustomizingDatastructure/dx11/Data_CS_AdaptToCustomBuffer.fx: -------------------------------------------------------------------------------- 1 | // Original Pointcloud Data 2 | #include "_PointData.fxh" 3 | StructuredBuffer pcBuffer; 4 | ByteAddressBuffer InputCountBuffer; 5 | 6 | // Our Custom Buffer 7 | #include "_CustomPointData.fxh" 8 | RWStructuredBuffer cpcBuffer : BACKBUFFER; 9 | 10 | int elementcount; 11 | 12 | StructuredBuffer rndDir; 13 | int rndDirCnt; 14 | float aging = 1; 15 | bool reset; 16 | 17 | [numthreads(64, 1, 1)] 18 | void CS_Apply( uint3 i : SV_DispatchThreadID) 19 | { 20 | uint pcBufferSize = InputCountBuffer.Load(0); 21 | if (i.x >= asuint(elementcount)) { return;} 22 | 23 | // RESET BUFFER 24 | if(reset){ 25 | 26 | // init with standard values 27 | float3 pos = float3(0,0,0); 28 | float4 col = float4(0,0,0,0); 29 | int groupId = 0; 30 | 31 | float3 direction = rndDir[i.x % rndDirCnt]; 32 | float age = 0; 33 | // the original buffer can be smaller than our custom buffer 34 | // -> adopt original values as long as there are some in our original buffer 35 | if (i.x <= pcBufferSize){ 36 | pointData pd = pcBuffer[i.x]; 37 | pos = pd.pos; 38 | col = pd.col; 39 | groupId = pd.groupId; 40 | } 41 | 42 | customPointData cpd = {pos,col,groupId,direction,age}; 43 | cpcBuffer[i.x] = cpd; 44 | } 45 | 46 | // UPDATE BUFFER 47 | else{ 48 | customPointData cpd = cpcBuffer[i.x]; 49 | 50 | cpd.age += aging; 51 | cpd.pos += cpd.direction - float3(0, cpd.age/500, 0); 52 | cpd.col *= 1- (cpd.age/1000); 53 | 54 | cpcBuffer[i.x] = cpd; 55 | } 56 | } 57 | 58 | technique11 ToCustomBuffer 59 | { 60 | pass P0 61 | { 62 | SetComputeShader( CompileShader( cs_5_0, CS_Apply() ) ); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /nodes/texture11/Filters_DepthFilter.tfx: -------------------------------------------------------------------------------- 1 | Texture2D tex0: PREVIOUS; 2 | Texture2D tex1 ; 3 | SamplerState s0 {Filter=MIN_MAG_MIP_LINEAR;AddressU=CLAMP;AddressV=CLAMP;}; 4 | float2 R:TARGETSIZE; 5 | 6 | cbuffer controls:register(b0){ 7 | float minDist = 0.5; 8 | float maxDist = 1.5; 9 | float resetMeter = 0.0; 10 | }; 11 | 12 | static const float mMult = 65.535f; 13 | 14 | bool validDist(float dist) { 15 | return (dist * mMult > minDist && dist * mMult < maxDist); 16 | } 17 | 18 | bool validPlayer(float2 x) { 19 | float4 c=tex1.Sample(s0,x); 20 | return (c.r > 0 || c.g > 0 || c.b > 0); 21 | } 22 | 23 | float4 pDistance(float4 PosWVP:SV_POSITION,float2 x:TEXCOORD0):SV_TARGET{ 24 | float4 c=tex0.Sample(s0,x); 25 | if (!validDist(c.r)) c =resetMeter/mMult; 26 | return c; 27 | } 28 | float4 pPlayer(float4 PosWVP:SV_POSITION,float2 x:TEXCOORD0):SV_TARGET{ 29 | float4 c=tex0.Sample(s0,x); 30 | if (!validPlayer(x)) c =resetMeter/mMult; 31 | return c; 32 | } 33 | float4 pDistPlayer(float4 PosWVP:SV_POSITION,float2 x:TEXCOORD0):SV_TARGET{ 34 | float4 c=tex0.Sample(s0,x); 35 | if (!validPlayer(x) || !validDist(c.r)) c =resetMeter/mMult; 36 | return c; 37 | } 38 | 39 | technique10 ThreshDistance{pass P1{SetPixelShader(CompileShader(ps_4_0,pDistance()));}} 40 | technique10 ThreshPlayer{pass P1{SetPixelShader(CompileShader(ps_4_0,pPlayer()));}} 41 | technique10 ThreshDistanceAndPlayer{pass P1{SetPixelShader(CompileShader(ps_4_0,pDistPlayer()));}} -------------------------------------------------------------------------------- /nodes/plugins/LinkedList/LinkedList.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinkedList", "LinkedList.csproj", "{6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x64.ActiveCfg = Debug|x64 21 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x64.Build.0 = Debug|x64 22 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x86.ActiveCfg = Debug|x86 23 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x86.Build.0 = Debug|x86 24 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x64.ActiveCfg = Release|x64 27 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x64.Build.0 = Release|x64 28 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x86.ActiveCfg = Release|x86 29 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x86.Build.0 = Release|x86 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /nodes/plugins/RawCompress/RawCompress.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RawCompress", "RawCompress.csproj", "{6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x64.ActiveCfg = Debug|x64 21 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x64.Build.0 = Debug|x64 22 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x86.ActiveCfg = Debug|x86 23 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x86.Build.0 = Debug|x86 24 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x64.ActiveCfg = Release|x64 27 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x64.Build.0 = Release|x64 28 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x86.ActiveCfg = Release|x86 29 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x86.Build.0 = Release|x86 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /nodes/plugins/RingBuffer/RingBuffer.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RingBuffer", "RingBuffer.csproj", "{6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x64.ActiveCfg = Debug|x64 21 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x64.Build.0 = Debug|x64 22 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x86.ActiveCfg = Debug|x86 23 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x86.Build.0 = Debug|x86 24 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x64.ActiveCfg = Release|x64 27 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x64.Build.0 = Release|x64 28 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x86.ActiveCfg = Release|x86 29 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x86.Build.0 = Release|x86 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /nodes/dx11/Data_CS_DecodeKinectDataAdvanced.fx: -------------------------------------------------------------------------------- 1 | StructuredBuffer posBufferEncoded ; 2 | StructuredBuffer indexBuffer ; 3 | StructuredBuffer colBufferEncoded ; 4 | float2 Resolution; 5 | float2 FOV; 6 | int elementcount; 7 | 8 | #include "../fxh/_PointData.fxh" 9 | AppendStructuredBuffer pcBuffer : BACKBUFFER; 10 | 11 | #include "../fxh/Helper.fxh" 12 | 13 | //============================================================================== 14 | //COMPUTE SHADER =============================================================== 15 | //============================================================================== 16 | 17 | [numthreads(64, 1, 1)] 18 | void CSUnpackKinectBuffer( uint3 i : SV_DispatchThreadID ) 19 | { 20 | if(i.x >= (uint)elementcount){return;} 21 | 22 | float4 pos; 23 | int index = indexBuffer[i.x]; 24 | int2 iPos = int2(index % Resolution.x, index / Resolution.x); 25 | float2 coord = iPos / Resolution; 26 | float depth = posBufferEncoded[i.x]; 27 | float XtoZ = tan(FOV.x/2) * 2; 28 | float YtoZ = tan(FOV.y/2) * 2; 29 | pos.x = ((coord.x - 0.5) * depth * XtoZ * -1); 30 | pos.y = ((0.5 - coord.y) * depth * YtoZ); 31 | pos.z = depth; 32 | 33 | int col = colBufferEncoded[i.x]; 34 | 35 | pointData pd = {pos.xyz, col, 0 }; 36 | pcBuffer.Append(pd); 37 | } 38 | 39 | //============================================================================== 40 | //TECHNIQUES =================================================================== 41 | //============================================================================== 42 | 43 | technique11 PackKinectBuffer 44 | { 45 | pass P0 46 | { 47 | SetComputeShader( CompileShader( cs_5_0, CSUnpackKinectBuffer() ) ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /nodes/plugins/StringIndexer/StringIndexer.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40629.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StringIndexer", "StringIndexer.csproj", "{6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x64.ActiveCfg = Debug|x64 21 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x64.Build.0 = Debug|x64 22 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x86.ActiveCfg = Debug|x86 23 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x86.Build.0 = Debug|x86 24 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x64.ActiveCfg = Release|x64 27 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x64.Build.0 = Release|x64 28 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x86.ActiveCfg = Release|x86 29 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x86.Build.0 = Release|x86 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /research/plugins/AsyncRawWriter/AsyncRawWriter.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsyncRawWriter", "AsyncRawWriter.csproj", "{6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|Any CPU.ActiveCfg = Release|Any CPU 19 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|Any CPU.Build.0 = Release|Any CPU 20 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x64.ActiveCfg = Debug|x64 21 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x64.Build.0 = Debug|x64 22 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x86.ActiveCfg = Debug|x86 23 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x86.Build.0 = Debug|x86 24 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x64.ActiveCfg = Release|x64 27 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x64.Build.0 = Release|x64 28 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x86.ActiveCfg = Release|x86 29 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x86.Build.0 = Release|x86 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /nodes/plugins/RingBufferIndexing/RingBufferIndexing.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RingBufferIndexing", "RingBufferIndexing.csproj", "{6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|Any CPU.ActiveCfg = Release|Any CPU 19 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|Any CPU.Build.0 = Release|Any CPU 20 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x64.ActiveCfg = Debug|x64 21 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x64.Build.0 = Debug|x64 22 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x86.ActiveCfg = Debug|x86 23 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Debug|x86.Build.0 = Debug|x86 24 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x64.ActiveCfg = Release|x64 27 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x64.Build.0 = Release|x64 28 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x86.ActiveCfg = Release|x86 29 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16}.Release|x86.Build.0 = Release|x86 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /research/dx11/Data_CS_BuildPcb_DataTexture.fx: -------------------------------------------------------------------------------- 1 | Texture2D tex ; 2 | StructuredBuffer uv ; 3 | int elementcount; 4 | SamplerState sPoint : IMMUTABLE 5 | { 6 | Filter = MIN_MAG_MIP_POINT; 7 | AddressU = Border; 8 | AddressV = Border; 9 | }; 10 | 11 | #include "../fxh/_PointData.fxh" 12 | AppendStructuredBuffer pcBuffer : BACKBUFFER; 13 | 14 | #include "../fxh/Helper.fxh" 15 | 16 | //============================================================================== 17 | //COMPUTE SHADER =============================================================== 18 | //============================================================================== 19 | 20 | [numthreads(64, 1, 1)] 21 | void CSBuildPointcloudBuffer( uint3 DTid : SV_DispatchThreadID ) 22 | { 23 | 24 | if(DTid.x >= asuint(elementcount)){return;} 25 | float sX = uv[DTid.x + 2 * elementcount].x; 26 | float sY = uv[DTid.x + 2 * elementcount].y; 27 | float3 pos = tex.SampleLevel(sPoint,float2(sX,sY),0).xyz; 28 | 29 | if(pos.x != 0 && pos.y != 0 && pos.z != 0){ 30 | sX = uv[DTid.x + elementcount].x; 31 | sY = uv[DTid.x + elementcount].y; 32 | int col = encodeColor( tex.SampleLevel(sPoint,float2(sX , sY),0) ); 33 | 34 | sX = uv[DTid.x].x; 35 | sY = uv[DTid.x].y; 36 | int groupId = tex.SampleLevel(sPoint,float2(sX , sY),0).r; 37 | 38 | pointData pd = {pos, col, groupId}; 39 | pcBuffer.Append(pd); 40 | } 41 | 42 | 43 | } 44 | 45 | //============================================================================== 46 | //TECHNIQUES =================================================================== 47 | //============================================================================== 48 | 49 | technique11 BuildPointcloudBuffer 50 | { 51 | pass P0 52 | { 53 | SetComputeShader( CompileShader( cs_5_0, CSBuildPointcloudBuffer() ) ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /nodes/fxh/PhongPoint.fxh: -------------------------------------------------------------------------------- 1 | //light properties 2 | float3 lPos = {0, 5, -2}; //light position in world space 3 | float lAtt0 = 0; 4 | float lAtt1 = 0.3; 5 | float lAtt2 = 0; 6 | float4 lAmb = {0.15, 0.15, 0.15, 1}; 7 | float4 lDiff = {0.85, 0.85, 0.85, 1}; 8 | float4 lSpec = {0.35, 0.35, 0.35, 1}; 9 | float lPower = 25.0; //shininess of specular highlight 10 | float lRange = 10.0; 11 | 12 | //phong point function 13 | float4 PhongPoint(float3 PosW, float3 NormV, float3 ViewDirV, float3 LightDirV) 14 | { 15 | 16 | float d = distance(PosW, lPos); 17 | float atten = 0; 18 | 19 | //compute attenuation only if vertex within lightrange 20 | if (d; 2 | Texture2D texDepth ; 3 | Texture2D texRGBDepth ; 4 | 5 | float2 Resolution; 6 | bool useRawData; 7 | SamplerState sPoint : IMMUTABLE 8 | { 9 | Filter = MIN_MAG_MIP_POINT; 10 | AddressU = Border; 11 | AddressV = Border; 12 | }; 13 | 14 | struct data { 15 | float depth; 16 | int col; 17 | }; 18 | #include "../fxh/Helper.fxh" 19 | RWStructuredBuffer depthBuffer : BACKBUFFER; 20 | 21 | //============================================================================== 22 | //COMPUTE SHADER =============================================================== 23 | //============================================================================== 24 | 25 | [numthreads(8, 8, 1)] 26 | void CSPackKinectBuffer( uint3 i : SV_DispatchThreadID ) 27 | { 28 | uint w,h, dummy; 29 | texDepth.GetDimensions(0,w,h,dummy); 30 | if (i.x >= (uint) Resolution.x || i.y >= (uint) Resolution.y) { return; } 31 | 32 | float2 coord = i.xy * float2(w / Resolution.x, h / Resolution.y) / float2(w,h); 33 | float depth = texDepth.SampleLevel(sPoint, coord,0 ).r * 65.535; 34 | 35 | // sample color 36 | float2 map = texRGBDepth.SampleLevel(sPoint,coord,0).rg; 37 | if(useRawData){ 38 | map.x /= 1920.0f; 39 | map.y /= 1080.0f; 40 | } 41 | 42 | int col = encodeColor( texRGB.SampleLevel(sPoint,map,0) ); 43 | 44 | int index = i.x + (Resolution.x * i.y); 45 | data d = { depth, col }; 46 | depthBuffer[index] = d; 47 | } 48 | 49 | //============================================================================== 50 | //TECHNIQUES =================================================================== 51 | //============================================================================== 52 | 53 | technique11 PackKinectBuffer 54 | { 55 | pass P0 56 | { 57 | SetComputeShader( CompileShader( cs_5_0, CSPackKinectBuffer() ) ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /nodes/dx11/Filters_TextureBuffer.fx: -------------------------------------------------------------------------------- 1 | //@author: tmp 2 | //@help: samples a texture and draws it to a given render target array slice 3 | //@tags: queue 4 | //@credits: vux 5 | 6 | Texture2D texture2d ; 7 | int slice ; 8 | 9 | SamplerState pSamp : IMMUTABLE 10 | { 11 | Filter = MIN_MAG_MIP_POINT; 12 | AddressU = Wrap; 13 | AddressV = Wrap; 14 | }; 15 | 16 | cbuffer cbControls : register( b0 ) 17 | { 18 | float4x4 tVP : VIEWPROJECTION; 19 | float4x4 tTex ; 20 | }; 21 | 22 | // ================= STRUCTS ================= 23 | struct vsin 24 | { 25 | float4 Pos : POSITION; 26 | float2 TexCd : TEXCOORD0; 27 | }; 28 | 29 | struct vs2gs 30 | { 31 | float4 Pos: SV_POSITION; 32 | float2 TexCd: TEXCOORD0; 33 | }; 34 | 35 | struct gs2ps 36 | { 37 | float4 Pos : SV_POSITION; 38 | float2 TexCd : TEXCOORD0; 39 | uint ArrayIndex : SV_RenderTargetArrayIndex; 40 | }; 41 | 42 | // ================= VS,GS, PS ================= 43 | 44 | vs2gs VS(vsin input) 45 | { 46 | vs2gs Out = (vs2gs)0; 47 | Out.Pos = input.Pos; 48 | Out.TexCd = input.TexCd; 49 | 50 | return Out; 51 | } 52 | 53 | [maxvertexcount(3)] 54 | void GS(triangle vs2gs input[3], inout TriangleStream triOutputStream) 55 | { 56 | gs2ps output; 57 | for(int i=0; i < 3; ++i) 58 | { 59 | output.Pos = input[i].Pos; 60 | output.TexCd = input[i].TexCd.xy; 61 | output.ArrayIndex = slice; 62 | triOutputStream.Append(output); 63 | } 64 | } 65 | 66 | float4 PS(gs2ps input) : SV_Target 67 | { 68 | float4 col = texture2d.Sample( pSamp, input.TexCd.xy ); 69 | return col; 70 | } 71 | 72 | // ================= TECHNIQUE ================= 73 | 74 | technique11 BufferImages 75 | { 76 | pass P0 77 | { 78 | SetVertexShader ( CompileShader( vs_5_0, VS() ) ); 79 | SetGeometryShader ( CompileShader( gs_5_0, GS() ) ); 80 | SetPixelShader ( CompileShader( ps_5_0, PS() ) ); 81 | } 82 | } 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /nodes/dx11/Data_CS_EncodeKinectDataAdvanced.fx: -------------------------------------------------------------------------------- 1 | Texture2D texRGB ; 2 | Texture2D texDepth ; 3 | Texture2D texRGBDepth ; 4 | 5 | float2 Resolution; 6 | bool useRawData; 7 | SamplerState sPoint : IMMUTABLE 8 | { 9 | Filter = MIN_MAG_MIP_POINT; 10 | AddressU = Border; 11 | AddressV = Border; 12 | }; 13 | 14 | struct data { 15 | float depth; 16 | int index; 17 | int col; 18 | }; 19 | #include "../fxh/Helper.fxh" 20 | AppendStructuredBuffer depthBuffer : BACKBUFFER; 21 | 22 | //============================================================================== 23 | //COMPUTE SHADER =============================================================== 24 | //============================================================================== 25 | 26 | [numthreads(8, 8, 1)] 27 | void CSPackKinectBuffer( uint3 i : SV_DispatchThreadID ) 28 | { 29 | uint w,h, dummy; 30 | texDepth.GetDimensions(0,w,h,dummy); 31 | if (i.x >= (uint) Resolution.x || i.y >= (uint) Resolution.y ) { return; } 32 | 33 | float2 coord = i.xy * float2(w / Resolution.x, h / Resolution.y) / float2(w,h); 34 | float depth = texDepth.SampleLevel(sPoint, coord,0 ).r * 65.535; 35 | 36 | if (depth != 0.0f){ 37 | // sample color 38 | float2 map = texRGBDepth.SampleLevel(sPoint,coord,0).rg; 39 | if(useRawData){ 40 | map.x /= 1920.0f; 41 | map.y /= 1080.0f; 42 | } 43 | 44 | int col = encodeColor( texRGB.SampleLevel(sPoint,map,0) ); 45 | 46 | int index = i.x + (Resolution.x * i.y); 47 | data d = { depth, index, col }; 48 | depthBuffer.Append(d); 49 | } 50 | 51 | } 52 | 53 | //============================================================================== 54 | //TECHNIQUES =================================================================== 55 | //============================================================================== 56 | 57 | technique11 PackKinectBuffer 58 | { 59 | pass P0 60 | { 61 | SetComputeShader( CompileShader( cs_5_0, CSPackKinectBuffer() ) ); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_Force_DynamicBuffer.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_ForceData.fxh" 2 | RWStructuredBuffer rwForceBuffer : BACKBUFFER; 3 | StructuredBuffer updatedBufferIn; 4 | 5 | StructuredBuffer velocity; 6 | StructuredBuffer acceleration; 7 | StructuredBuffer mass; 8 | int groupId = -1; 9 | bool Apply; 10 | bool updatedOnly; 11 | 12 | [numthreads(64, 1, 1)] 13 | void CS_Add( uint3 i : SV_DispatchThreadID) 14 | { 15 | uint cnt, stride; 16 | rwForceBuffer.GetDimensions(cnt,stride); 17 | if (i.x >= cnt) { return; } 18 | 19 | if(Apply){ 20 | 21 | if (updatedOnly && updatedBufferIn[i.x] == 0){ return; } 22 | 23 | if ( groupId == -1 || rwForceBuffer[i.x].groupId == groupId){ 24 | 25 | velocity.GetDimensions(cnt,stride); 26 | rwForceBuffer[i.x].velocity += velocity[i.x % cnt]; 27 | 28 | acceleration.GetDimensions(cnt,stride); 29 | rwForceBuffer[i.x].acceleration += acceleration[i.x % cnt]; 30 | 31 | mass.GetDimensions(cnt,stride); 32 | rwForceBuffer[i.x].mass += mass[i.x % cnt]; 33 | } 34 | } 35 | } 36 | 37 | [numthreads(64, 1, 1)] 38 | void CS_Mult( uint3 i : SV_DispatchThreadID) 39 | { 40 | uint cnt, stride; 41 | rwForceBuffer.GetDimensions(cnt,stride); 42 | if (i.x >= cnt) { return; } 43 | 44 | if(Apply){ 45 | 46 | if (updatedOnly && updatedBufferIn[i.x] == 0){ return; } 47 | 48 | if ( groupId == -1 || rwForceBuffer[i.x].groupId == groupId){ 49 | 50 | velocity.GetDimensions(cnt,stride); 51 | rwForceBuffer[i.x].velocity *= velocity[i.x % cnt]; 52 | 53 | acceleration.GetDimensions(cnt,stride); 54 | rwForceBuffer[i.x].acceleration *= acceleration[i.x % cnt]; 55 | 56 | mass.GetDimensions(cnt,stride); 57 | rwForceBuffer[i.x].mass *= mass[i.x % cnt]; 58 | } 59 | } 60 | } 61 | 62 | technique11 Add 63 | { 64 | pass P0 65 | { 66 | SetComputeShader( CompileShader( cs_5_0, CS_Add() ) ); 67 | } 68 | } 69 | 70 | technique11 Multiply 71 | { 72 | pass P0 73 | { 74 | SetComputeShader( CompileShader( cs_5_0, CS_Mult() ) ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_Target.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_ForceData.fxh" 2 | RWStructuredBuffer rwForceBuffer : BACKBUFFER; 3 | StructuredBuffer updatedBufferIn; 4 | 5 | StructuredBuffer Target; 6 | int groupId = -1; 7 | float MaxSpeed = 0.01; 8 | float MaxForce = 0.001; 9 | float LandingRadius = 0.1; 10 | bool updatedOnly; 11 | bool Apply; 12 | 13 | float3 limitIt(in float3 v, float3 Maximum) 14 | { 15 | if (length(v) > length(Maximum)) { 16 | v = normalize(v) * Maximum; 17 | return v; 18 | } 19 | 20 | else { 21 | return v; 22 | } 23 | 24 | } 25 | 26 | float length(in float3 v) 27 | { 28 | return sqrt(v.x*v.x + v.y*v.y + v.z*v.z); 29 | } 30 | 31 | float3 normalize(in float3 v) 32 | { 33 | float length = sqrt(v.x*v.x + v.y*v.y + v.z*v.z); 34 | 35 | if (length != 0) 36 | return v * (1 / length); 37 | else 38 | return 0; 39 | } 40 | 41 | [numthreads(64, 1, 1)] 42 | void CS_Target( uint3 i : SV_DispatchThreadID) 43 | { 44 | uint cnt, stride; 45 | rwForceBuffer.GetDimensions(cnt,stride); 46 | 47 | if (Apply) { 48 | if (updatedOnly && updatedBufferIn[i.x] == 0){ return; } 49 | 50 | if ( groupId == -1 || rwForceBuffer[i.x].groupId == groupId){ 51 | 52 | float3 p = rwForceBuffer[i.x].position; 53 | float3 v = rwForceBuffer[i.x].velocity; 54 | float3 a = rwForceBuffer[i.x].acceleration; 55 | 56 | Target.GetDimensions(cnt,stride); 57 | float3 target = Target[i.x % cnt]; 58 | float3 desired = target - p; //calculates disired velocity-vector 59 | 60 | float d = length(desired); //d = distance 61 | desired = normalize(desired); //normalize vector 62 | if (d < LandingRadius) 63 | { 64 | float map = saturate(d); 65 | desired *= map; 66 | 67 | } else { 68 | 69 | desired *= MaxSpeed; 70 | 71 | } 72 | 73 | float3 steer = desired - v; 74 | steer = limitIt(steer,MaxForce); 75 | 76 | rwForceBuffer[i.x].acceleration += steer; 77 | } 78 | 79 | } 80 | } 81 | 82 | technique11 TargetForce 83 | { 84 | pass P0{ SetComputeShader(CompileShader(cs_5_0, CS_Target())); } 85 | } 86 | -------------------------------------------------------------------------------- /nodes/texture11/Filters_DepthSmoothAdvanced.tfx: -------------------------------------------------------------------------------- 1 | //@author: tmp 2 | //@help: outputs a weighted average image assembled of all imageslices in a 3d texture 3 | //@tags: texture3d, average 4 | //@credits: 5 | 6 | Texture2D texture2d : PREVIOUS; 7 | Texture3D texture3d ; 8 | float sliceCount ; // the slice 9 | float sliceIndex ; // the slice 10 | float distanceThreshold = 0.001; 11 | 12 | SamplerState volumeSampler : IMMUTABLE 13 | { 14 | Filter = MIN_MAG_MIP_POINT; 15 | AddressU = Wrap; 16 | AddressV = Wrap; 17 | }; 18 | 19 | struct psInput 20 | { 21 | float4 p : SV_Position; 22 | float2 uv : TEXCOORD0; 23 | }; 24 | 25 | 26 | float4 PS(psInput input) : SV_Target 27 | { 28 | float4 colFinal = float4(0,0,0,0); 29 | 30 | bool skip = false; 31 | int Denominator = 0; 32 | 33 | // we iterate through all buffered images and addup their weighted color 34 | for (int i = 1; i <= sliceCount; i++){ 35 | // start with the oldest buffered image 36 | float depth = ((sliceIndex + i) % sliceCount) / sliceCount; 37 | float4 col = texture3d.Sample(volumeSampler, float3(input.uv, depth)); 38 | // now addup the color -> newer images are higher weighted 39 | colFinal += col * i; 40 | // addup the denominator - we need it to divide the rgb values later 41 | Denominator += i; 42 | 43 | // now we pick the next image and check if the depth-difference is 44 | // above a threshold - we need this to skip the edge rendering of fast 45 | // moving objects (and depth shadows) 46 | float depthtest = ((sliceIndex + i - 1) % sliceCount) / sliceCount; 47 | float4 coltest = texture3d.Sample(volumeSampler, float3(input.uv, depthtest)); 48 | if ( distance(col.r ,coltest.r) > distanceThreshold) skip = true; 49 | } 50 | 51 | if(skip) colFinal = float4(0,0,0,0); 52 | else colFinal = colFinal / Denominator; 53 | 54 | return colFinal; 55 | } 56 | 57 | technique10 DepthSmooth 58 | { 59 | pass P0 60 | { 61 | SetPixelShader(CompileShader(ps_4_0,PS())); 62 | } 63 | } 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # [Rr]esearch/ 2 | 3 | # mstest test results 4 | TestResults 5 | 6 | ## Ignore Visual Studio temporary files, build results, and 7 | ## files generated by popular Visual Studio add-ons. 8 | 9 | # User-specific files 10 | *.suo 11 | *.user 12 | *.sln.docstates 13 | *~.xml 14 | 15 | # Build results 16 | [Dd]ynamic/ 17 | [Dd]ebug/ 18 | # [Bb]in/ 19 | # [Bb]uild/ 20 | #[Rr]elease/ 21 | [Oo]bj/ 22 | *_i.c 23 | *_p.c 24 | *.ilk 25 | *.meta 26 | *.obj 27 | *.pch 28 | *.pdb 29 | *.pgc 30 | *.pgd 31 | *.rsp 32 | *.sbr 33 | *.tlb 34 | *.tli 35 | *.tlh 36 | *.tmp 37 | *.log 38 | *.vspscc 39 | *.vssscc 40 | .builds 41 | 42 | # Visual C++ cache files 43 | ipch/ 44 | *.aps 45 | *.ncb 46 | *.opensdf 47 | *.sdf 48 | 49 | # Visual Studio profiler 50 | *.psess 51 | *.vsp 52 | *.vspx 53 | 54 | # Guidance Automation Toolkit 55 | *.gpState 56 | 57 | # ReSharper is a .NET coding add-in 58 | _ReSharper* 59 | 60 | # NCrunch 61 | *.ncrunch* 62 | .*crunch*.local.xml 63 | 64 | # Installshield output folder 65 | [Ee]xpress 66 | 67 | # DocProject is a documentation generator add-in 68 | DocProject/buildhelp/ 69 | DocProject/Help/*.HxT 70 | DocProject/Help/*.HxC 71 | DocProject/Help/*.hhc 72 | DocProject/Help/*.hhk 73 | DocProject/Help/*.hhp 74 | DocProject/Help/Html2 75 | DocProject/Help/html 76 | 77 | # Click-Once directory 78 | publish 79 | 80 | # Publish Web Output 81 | *.Publish.xml 82 | 83 | # NuGet Packages Directory 84 | packages 85 | 86 | # Windows Azure Build Output 87 | csx 88 | *.build.csdef 89 | 90 | # Windows Store app package directory 91 | AppPackages/ 92 | 93 | # Others 94 | # [Bb]in 95 | [Oo]bj 96 | sql 97 | TestResults 98 | [Tt]est[Rr]esult* 99 | *.Cache 100 | ClientBin 101 | [Ss]tyle[Cc]op.* 102 | ~$* 103 | *.dbmdl 104 | Generated_Code #added for RIA/Silverlight projects 105 | 106 | # Backup & report files from converting an old project file to a newer 107 | # Visual Studio version. Backup files are not needed, because we have git ;-) 108 | _UpgradeReport_Files/ 109 | Backup*/ 110 | UpgradeLog*.XML 111 | 112 | logs 113 | -------------------------------------------------------------------------------- /nodes/dx11/Data_CS_BuildPcb_Layer.fx: -------------------------------------------------------------------------------- 1 | float4x4 tW : WORLD; 2 | 3 | Texture2D texRGB ; 4 | Texture2D texDepth ; 5 | int drawIndex : DRAWINDEX; 6 | int IdOffset; 7 | float2 FOV; 8 | float2 Resolution; 9 | 10 | float4x4 tP ; 11 | 12 | SamplerState sPoint : IMMUTABLE 13 | { 14 | Filter = MIN_MAG_MIP_POINT; 15 | AddressU = Border; 16 | AddressV = Border; 17 | }; 18 | 19 | #include "../fxh/_PointData.fxh" 20 | AppendStructuredBuffer pcBuffer : BACKBUFFER; 21 | 22 | #include "../fxh/Helper.fxh" 23 | 24 | //============================================================================== 25 | //COMPUTE SHADER =============================================================== 26 | //============================================================================== 27 | #define linstep(a,b,x) saturate((x-a)/(b-a)) 28 | 29 | [numthreads(8, 8, 1)] 30 | void CSBuildPointcloudBuffer( uint3 i : SV_DispatchThreadID ) 31 | { 32 | if (i.x >= (uint)Resolution.x || i.y >= (uint) Resolution.y) { return; } 33 | 34 | float2 coord = i.xy / Resolution; 35 | float4 col = texRGB.SampleLevel(sPoint,coord,0); 36 | float depth = texDepth.SampleLevel(sPoint,coord,0).r; 37 | float ld = tP._43 / (depth - tP._33); 38 | depth = ld; 39 | 40 | if (depth > 0 && col.a > 0){ 41 | float XtoZ = tan(FOV.x/2) * 2; 42 | float YtoZ = tan(FOV.y/2) * 2; 43 | 44 | float4 pos = float4(0,0,0,1); 45 | pos.x = ((coord.x - 0.5) * depth * XtoZ ); 46 | pos.y = ((0.5 - coord.y) * depth * YtoZ); 47 | pos.z = depth; 48 | pos = mul(pos, tW); 49 | 50 | pointData pd = {pos.xyz, encodeColor(col), drawIndex + IdOffset}; 51 | pcBuffer.Append(pd); 52 | } 53 | } 54 | 55 | //============================================================================== 56 | //TECHNIQUES =================================================================== 57 | //============================================================================== 58 | 59 | technique11 BuildPointcloudBuffer 60 | { 61 | pass P0 62 | { 63 | SetComputeShader( CompileShader( cs_5_0, CSBuildPointcloudBuffer() ) ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /research/dx11/Visualization_DataTexture.fx: -------------------------------------------------------------------------------- 1 | //@author: tmp 2 | //@help: Generates a colored PointCloud 3 | //@tags: DX11, Kinect, Pointcloud 4 | //@credits: vvvv 5 | 6 | #include "../fxh/_PointData.fxh" 7 | StructuredBuffer pcBuffer; 8 | 9 | #include "../fxh/Helper.fxh" 10 | 11 | float maxElementCount; 12 | float diff; 13 | 14 | cbuffer cbPerDraw : register( b0 ) 15 | { 16 | float4x4 tVP : VIEWPROJECTION; 17 | 18 | }; 19 | float2 R:TARGETSIZE; 20 | cbuffer cbPerObj : register( b1 ) 21 | { 22 | float4x4 tW : WORLD; 23 | }; 24 | 25 | struct vsInput 26 | { 27 | uint iv : SV_VertexID; 28 | uint ii : SV_InstanceID; 29 | }; 30 | 31 | struct vs2ps 32 | { 33 | float4 pos: SV_POSITION; 34 | float4 col: COLOR; 35 | //float4 enc_pos: TEXCOORD0; 36 | //float enc_groupId: TEXCOORD1; 37 | }; 38 | 39 | /* ===================== VERTEX SHADER ===================== */ 40 | 41 | vs2ps VS(vsInput input) 42 | { 43 | vs2ps output = (vs2ps)0; 44 | float x = (1.999 / R.x) * (input.iv + 1.0f); 45 | float y = (2.0 / R.y) * (input.ii); 46 | output.pos = float4(x - 1.0f,y - 1.0f ,0.0f,1.0f); 47 | 48 | int index = (input.iv + input.ii * R.x); 49 | 50 | float4 col = float4(0,0,0,0); 51 | if (index < maxElementCount){ 52 | col = float4(pcBuffer[index].pos,1); 53 | } 54 | 55 | else if( (maxElementCount + diff) <= index && index < (maxElementCount * 2) + diff){ 56 | col = decodeColor( pcBuffer[index - maxElementCount - diff].col ); 57 | } 58 | 59 | else if( (maxElementCount + diff) * 2 <= index && index < (maxElementCount * 3) + (diff * 2)){ 60 | int groupId = pcBuffer[index - (maxElementCount + diff) * 2].groupId; 61 | col = float4(groupId,0,0,1); 62 | } 63 | 64 | output.col = col; 65 | 66 | return output; 67 | } 68 | 69 | /* ===================== PIXEL SHADER ===================== */ 70 | 71 | float4 PS_RGB(vs2ps input): SV_Target 72 | { 73 | float4 col = input.col; 74 | return col; 75 | } 76 | 77 | /* ===================== TECHNIQUE ===================== */ 78 | 79 | technique10 AsDataTexture 80 | { 81 | pass P0 82 | { 83 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 84 | SetPixelShader( CompileShader( ps_4_0, PS_RGB() ) ); 85 | } 86 | } -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_Force_Texture.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_ForceData.fxh" 2 | RWStructuredBuffer rwForceBuffer : BACKBUFFER; 3 | StructuredBuffer updatedBufferIn; 4 | 5 | float4x4 tW: WORLD; 6 | float4x4 tVP; 7 | 8 | Texture2D texVelocity ; 9 | float3 multiplicator_vel = float3(0.0f,0.0f,0.0f); 10 | 11 | Texture2D texAcceleration ; 12 | float3 multiplicator_acc = float3(0.0f,0.0f,0.0f); 13 | 14 | Texture2D texMass ; 15 | float multiplicator_mass = 0.0f; 16 | SamplerState sPoint : IMMUTABLE 17 | { 18 | Filter = MIN_MAG_MIP_POINT; 19 | AddressU = Border; 20 | AddressV = Border; 21 | }; 22 | 23 | float threshold = 0.00; 24 | 25 | int groupId = -1; 26 | bool Apply; 27 | bool updatedOnly; 28 | 29 | [numthreads(64, 1, 1)] 30 | void CS_Apply( uint3 i : SV_DispatchThreadID) 31 | { 32 | uint cnt, stride; 33 | rwForceBuffer.GetDimensions(cnt,stride); 34 | if (i.x >= cnt) { return; } 35 | 36 | if(Apply){ 37 | 38 | if (updatedOnly && updatedBufferIn[i.x] == 0){ return; } 39 | 40 | if ( groupId == -1 || rwForceBuffer[i.x].groupId == groupId){ 41 | 42 | float4 ppos = mul(float4(rwForceBuffer[i.x].position,1), tVP); 43 | float2 uv = ppos.xy/ppos.w; // these are the uv coords where we sample 44 | uv.x = uv.x * 0.5 + 0.5; 45 | uv.y = uv.y * -0.5 + 0.5; 46 | 47 | float3 vel = mul(tW, float4(texVelocity.SampleLevel(sPoint,uv,0).xyz,1)).xyz; 48 | if (vel.r > threshold || vel.g > threshold || vel.b > threshold || 49 | vel.r < -threshold || vel.g < -threshold || vel.b < -threshold) rwForceBuffer[i.x].velocity += vel * multiplicator_vel; 50 | 51 | float3 acc = mul(tW, float4(texAcceleration.SampleLevel(sPoint,uv,0).xyz,1)).xyz; 52 | if (acc.r > threshold || acc.g > threshold || acc.b > threshold || 53 | acc.r < -threshold || acc.g < -threshold || acc.b < -threshold) rwForceBuffer[i.x].acceleration += acc * multiplicator_acc; 54 | 55 | float m = texMass.SampleLevel(sPoint,uv,0).x; 56 | if (m > threshold || m < - threshold) rwForceBuffer[i.x].mass += m * multiplicator_mass; 57 | } 58 | } 59 | 60 | } 61 | 62 | technique11 ApplyForce 63 | { 64 | pass P0 65 | { 66 | SetComputeShader( CompileShader( cs_5_0, CS_Apply() ) ); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /nodes/plugins/Track (Vector3D)/Vector3DCache/Vector3DCacheNode.cs: -------------------------------------------------------------------------------- 1 | #region usings 2 | using System; 3 | using System.ComponentModel.Composition; 4 | using System.Collections.Generic; 5 | 6 | using VVVV.PluginInterfaces.V2; 7 | using VVVV.Utils.VMath; 8 | using System.Linq; 9 | 10 | using VVVV.Core.Logging; 11 | #endregion usings 12 | 13 | namespace VVVV.Nodes 14 | { 15 | #region PluginInfo 16 | [PluginInfo(Name = "Cache", Category = "Vector3D", Help = "Basic template with one value in/out", Tags = "")] 17 | #endregion PluginInfo 18 | public class Vector3DCacheNode : IPluginEvaluate 19 | { 20 | #region fields & pins 21 | [Input("Input")] 22 | public ISpread FInput; 23 | 24 | [Input("ID")] 25 | public ISpread FIndex; 26 | 27 | [Input("Retain Time", IsSingle = true, DefaultValue = 1.0)] 28 | public ISpread FTime; 29 | 30 | [Input("Reset", IsSingle = true)] 31 | public ISpread FReset; 32 | 33 | [Output("Cached Output")] 34 | public ISpread FOutput; 35 | 36 | [Output("Cached ID")] 37 | public ISpread FCachedID; 38 | 39 | [Import()] 40 | public ILogger FLogger; 41 | 42 | [Import()] 43 | protected IHDEHost FHDEHost; 44 | 45 | 46 | protected Dictionary dict = new Dictionary(); 47 | protected Dictionary mark = new Dictionary(); 48 | 49 | #endregion fields & pins 50 | 51 | //called when data for any output pin is requested 52 | public void Evaluate(int SpreadMax) 53 | { 54 | if (FReset[0]) { 55 | dict.Clear(); 56 | mark.Clear(); 57 | } 58 | 59 | SpreadMax = FInput.CombineWith(FIndex); 60 | 61 | if (FInput.SliceCount > 0 && FIndex.SliceCount > 0) 62 | for (int i=0;i FInput; 24 | 25 | [Input("Count", MinValue = 0, DefaultValue = 768)] 26 | public IDiffSpread FCount; 27 | 28 | [Output("Output")] 29 | public ISpread> FOutput; 30 | 31 | //when dealing with byte streams (what we call Raw in the GUI) it's always 32 | //good to have a byte buffer around. we'll use it when copying the data. 33 | protected byte[] FBuffer; 34 | #endregion fields & pins 35 | 36 | //called when all inputs and outputs defined above are assigned from the host 37 | public void OnImportsSatisfied() 38 | { 39 | //start with an empty stream output 40 | FOutput.SliceCount = 0; 41 | FCount.Changed += ResizeBuffer; 42 | } 43 | 44 | protected void ResizeBuffer(IDiffSpread spread) { 45 | FBuffer = new byte[FCount[0]]; 46 | } 47 | 48 | 49 | //called when data for any output pin is requested 50 | public void Evaluate(int spreadMax) 51 | { 52 | spreadMax = FInput.SliceCount; 53 | FOutput.SliceCount = spreadMax; 54 | 55 | for (int i = 0; i < spreadMax; i++) { 56 | var input = FInput[i]; 57 | int count = (int)Math.Ceiling((double)input.Length / FCount[0]); 58 | 59 | input.Position = 0; 60 | FOutput[i].ResizeAndDispose(count, () => new MemoryStream(FCount[0])); 61 | 62 | int length = (int) input.Length; 63 | for (int j = 0; j pcBuffer; 6 | ByteAddressBuffer InputCountBuffer; 7 | 8 | AppendStructuredBuffer newPcBuffer : BACKBUFFER; 9 | 10 | Texture2D texFilter ; 11 | SamplerState sPoint : IMMUTABLE 12 | { 13 | Filter = MIN_MAG_MIP_POINT; 14 | AddressU = Border; 15 | AddressV = Border; 16 | }; 17 | 18 | float threshold = 0.00; 19 | 20 | [numthreads(64, 1, 1)] 21 | void CS_Restrict( uint3 i : SV_DispatchThreadID) 22 | { 23 | uint cnt = InputCountBuffer.Load(0); 24 | if (i.x >= cnt ) { return;} 25 | 26 | if( pcBuffer[i.x].groupId == groupIds || groupIds == -1){ 27 | pointData pd = pcBuffer[i.x]; 28 | float3 pos = pd.pos; 29 | 30 | float4 ppos = mul(float4(pd.pos,1), tVP); 31 | float2 uv = ppos.xy/ppos.w; // these are the uv coords where we sample 32 | uv.x = uv.x * 0.5 + 0.5; 33 | uv.y = uv.y * -0.5 + 0.5; 34 | float4 col = texFilter.SampleLevel(sPoint,uv,0); 35 | 36 | if ( col.a > threshold && 37 | (col.r > threshold || col.g > threshold || col.b > threshold || 38 | col.r < -threshold || col.g < -threshold || col.b < -threshold ) 39 | ) 40 | newPcBuffer.Append(pd); 41 | } 42 | } 43 | 44 | [numthreads(64, 1, 1)] 45 | void CS_Subtract( uint3 i : SV_DispatchThreadID) 46 | { 47 | uint cnt = InputCountBuffer.Load(0); 48 | if (i.x >= cnt ) { return;} 49 | 50 | if( pcBuffer[i.x].groupId == groupIds || groupIds == -1){ 51 | pointData pd = pcBuffer[i.x]; 52 | float3 pos = pd.pos; 53 | 54 | float4 ppos = mul(float4(pd.pos,1), tVP); 55 | float2 uv = ppos.xy/ppos.w; // these are the uv coords where we sample 56 | uv.x = uv.x * 0.5 + 0.5; 57 | uv.y = uv.y * -0.5 + 0.5; 58 | float4 col = texFilter.SampleLevel(sPoint,uv,0); 59 | 60 | if ( col.a > threshold && 61 | ( (col.r < threshold && col.r > 0.0f) || (col.g < threshold && col.g > 0.0f) || (col.b < threshold && col.b > 0.0f) || 62 | (col.r > -threshold && col.r < 0.0f) || (col.g > -threshold && col.g < 0.0f) || (col.b > -threshold && col.b < 0.0f) ) 63 | ) 64 | newPcBuffer.Append(pd); 65 | } 66 | } 67 | 68 | technique11 Restrict 69 | { 70 | pass P0 71 | { 72 | SetComputeShader( CompileShader( cs_5_0, CS_Restrict() ) ); 73 | } 74 | } 75 | 76 | technique11 Subtract 77 | { 78 | pass P0 79 | { 80 | SetComputeShader( CompileShader( cs_5_0, CS_Subtract() ) ); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /nodes/plugins/StringIndexer/StringIndexer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | VVVV.Nodes 9 | StringIndexer 10 | v4.0 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | ..\..\..\..\..\lib\core\;..\..\..\..\..\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /nodes/plugins/BasicTransformCamera/BasicTransformCamera.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | VVVV.Nodes 9 | BasicTransformCamera 10 | v4.0 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | ..\..\..\..\..\lib\core\;..\..\..\..\..\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /nodes/plugins/AdvancedQueue/AdvancedQueue.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | VVVV.Nodes 9 | AdvancedQueue 10 | v4.0 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | D:\workspace\vvvv\vvvv_45beta33.7_x64\lib\core\;D:\workspace\vvvv\vvvv_45beta33.7_x64\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /research/plugins/ValueRawSequentialReader/ValueRawSequentialReader.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | VVVV.Nodes 9 | ValueRawSequentialReader 10 | v4.0 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | ..\..\..\..\..\lib\core\;..\..\..\..\..\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /research/plugins/AsyncRawWriter/AsyncRawWriter.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | VVVV.Nodes 9 | AsyncRawWriter 10 | v4.0 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | ..\..\..\..\vvvv\vvvv_45beta34.2_x64\lib\core\;..\..\..\..\vvvv\vvvv_45beta34.2_x64\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /nodes/plugins/RawSplitter/RawSplitter.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | VVVV.Nodes 9 | RawSplitter 10 | v4.0 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | ..\..\..\..\..\..\apps\code\vvvv_45beta34.1_x64\lib\core\;..\..\..\..\..\..\apps\code\vvvv_45beta34.1_x64\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /nodes/plugins/RawPartialReader/RawPartialReader.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | VVVV.Nodes 9 | RawPartialReader 10 | v4.0 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | ..\..\..\..\..\..\vvvv\vvvv_45beta33.7_x64\lib\core\;..\..\..\..\..\..\vvvv\vvvv_45beta33.7_x64\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /nodes/plugins/Track (Vector3D)/NearestPairs/NearestPairs.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | VVVV.Nodes 9 | NearestPairs 10 | v4.0 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | ..\..\..\..\..\..\..\apps\code\vvvv_45beta33.7_x64\lib\core\;..\..\..\..\..\..\..\apps\code\vvvv_45beta33.7_x64\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /nodes/dx11/Data_CS_BuildPcb_Kinect.fx: -------------------------------------------------------------------------------- 1 | float4x4 tW : WORLD; 2 | 3 | Texture2D texRGB ; 4 | Texture2D texDepth ; 5 | Texture2D texRayTable ; 6 | Texture2D texRGBDepth ; 7 | int drawIndex : DRAWINDEX; 8 | int IdOffset; 9 | float2 FOV; 10 | float2 Resolution; 11 | bool useRayTable; 12 | bool useRawData; 13 | 14 | SamplerState sPoint : IMMUTABLE 15 | { 16 | Filter = MIN_MAG_MIP_POINT; 17 | AddressU = Border; 18 | AddressV = Border; 19 | }; 20 | 21 | #include "../fxh/_PointData.fxh" 22 | #include "../fxh/Helper.fxh" 23 | AppendStructuredBuffer pcBuffer : BACKBUFFER; 24 | 25 | //============================================================================== 26 | //COMPUTE SHADER =============================================================== 27 | //============================================================================== 28 | 29 | [numthreads(8, 8, 1)] 30 | void CSBuildPointcloudBuffer( uint3 i : SV_DispatchThreadID ) 31 | { 32 | uint w,h, dummy; 33 | texDepth.GetDimensions(0,w,h,dummy); 34 | if (i.x >= (uint) Resolution.x || i.y >= (uint) Resolution.y) { return; } 35 | 36 | float2 coord = i.xy * float2(w / Resolution.x, h / Resolution.y) / float2(w,h); 37 | float depth = texDepth.SampleLevel(sPoint, coord,0 ).r * 65.535 ; 38 | 39 | if (depth > 0){ 40 | 41 | 42 | float4 pos = float4(0,0,0,1); 43 | // calculate worldposition 44 | if (useRayTable){ 45 | float2 raytable = texRayTable.SampleLevel(sPoint,coord,0).xy; 46 | pos.x = depth * raytable.x * -1; 47 | pos.y = depth * raytable.y; 48 | pos.z = depth; 49 | } 50 | else{ 51 | float XtoZ = tan(FOV.x/2) * 2; 52 | float YtoZ = tan(FOV.y/2) * 2; 53 | pos.x = ((coord.x - 0.5) * depth * XtoZ * -1); 54 | pos.y = ((0.5 - coord.y) * depth * YtoZ); 55 | pos.z = depth; 56 | } 57 | 58 | pos = mul(pos, tW); 59 | 60 | // sample color 61 | float2 map = texRGBDepth.SampleLevel(sPoint,coord,0).rg; 62 | if(useRawData){ 63 | map.x /= 1920.0f; 64 | map.y /= 1080.0f; 65 | } 66 | 67 | int col = encodeColor( texRGB.SampleLevel(sPoint,map,0) ); 68 | 69 | pointData pd = {pos.xyz, col, drawIndex + IdOffset}; 70 | pcBuffer.Append(pd); 71 | } 72 | } 73 | 74 | //============================================================================== 75 | //TECHNIQUES =================================================================== 76 | //============================================================================== 77 | 78 | technique11 BuildPointcloudBuffer 79 | { 80 | pass P0 81 | { 82 | SetComputeShader( CompileShader( cs_5_0, CSBuildPointcloudBuffer() ) ); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /nodes/fxh/Helper.fxh: -------------------------------------------------------------------------------- 1 | int encodeColor(float4 fCol) 2 | { 3 | int iRed = (int)(clamp(fCol.r,0,1) * 255); 4 | int iGreen = (int)(clamp(fCol.g,0,1) * 255) << 8; 5 | int iBlue = (int)(clamp(fCol.b,0,1) * 255) << 16; 6 | int iAlpha = (int)(clamp(fCol.a,0,1) * 255) << 24; 7 | return iRed + iGreen + iBlue + iAlpha; 8 | } 9 | 10 | float4 decodeColor(int iCol) 11 | { 12 | float4 fCol; 13 | fCol.x = (float)(( iCol & 0x000000ff) ) / 255.0f; 14 | fCol.y = (float)(( iCol & 0x0000ff00) >> 8 ) / 255.0f; 15 | fCol.z = (float)(( iCol & 0x00ff0000) >> 16) / 255.0f; 16 | fCol.w = (float)(( iCol & 0xff000000) >> 24) / 255.0f; 17 | return fCol; 18 | } 19 | 20 | float4 randColor(in float id) { 21 | float noiseX = (frac(sin(dot(float2(id,id), float2(12.9898,78.233) )) * 43758.5453)); 22 | float noiseY = (frac(sin(dot(float2(id,id), float2(12.9898,78.233) * 2.0)) * 43758.5453)); 23 | float noiseZ = sqrt(1 - noiseX * noiseX); 24 | return float4(noiseX, noiseY,noiseZ,1); 25 | } 26 | 27 | float4x4 calcRotation (float3 vel){ 28 | static const float PI = 3.14159265f; 29 | 30 | float length = sqrt(vel.x * vel.x + vel.y * vel.y + vel.z * vel.z); //length 31 | float nVelX = vel.x; 32 | float nVelY = vel.y; 33 | float nVelZ = vel.z; 34 | 35 | if (length != 0) 36 | { 37 | nVelX = vel.x / length; 38 | nVelY = vel.y / length; 39 | nVelZ = vel.z / length; 40 | } 41 | 42 | //converter 43 | float conv = (2 * PI); 44 | float3 rotationV; 45 | 46 | //CONVERT FROM POLAR TO CARTESIAN VVVV-STYLE 47 | float lengthPol = nVelX * nVelX + nVelY * nVelY + nVelZ * nVelZ; 48 | 49 | if (lengthPol > 0) 50 | { 51 | lengthPol = sqrt(lengthPol); 52 | float pitch = asin(nVelY / lengthPol); 53 | float yaw = 0.0; 54 | if(nVelZ != 0) 55 | yaw = atan2(-nVelX, -nVelZ); 56 | else if (nVelX > 0) 57 | yaw = -PI / 2; 58 | else 59 | yaw = PI / 2; 60 | 61 | rotationV = float3(pitch, yaw, lengthPol) / conv ; 62 | } 63 | 64 | else 65 | 66 | { 67 | rotationV = float3(0,0,0); 68 | } 69 | 70 | rotationV*= 2*PI; 71 | 72 | float sx = sin(rotationV.x); 73 | float cx = cos(rotationV.x); 74 | float sy = sin(rotationV.y); 75 | float cy = cos(rotationV.y); 76 | float sz = sin(rotationV.z); 77 | float cz = cos(rotationV.z); 78 | 79 | return float4x4( cz*cy+sz*sx*sy, sz*cx, cz*-sy+sz*sx*cy, 0, 80 | -sz*cy+cz*sx*sy, cz*cx, sz*sy+cz*sx*cy , 0, 81 | cx * sy ,-sx , cx * cy , 0, 82 | 0 , 0 , 0 , 1); 83 | } -------------------------------------------------------------------------------- /nodes/plugins/Track (Vector3D)/Vector3DCache/Vector3DCache.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | VVVV.Nodes 9 | Vector3DCache 10 | v4.0 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | ..\..\..\..\..\..\..\..\apps\code\vvvv_45beta32.1_x64\lib\core\;..\..\..\..\..\..\..\..\apps\code\vvvv_45beta32.1_x64\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /research/fxh/Helper.fxh: -------------------------------------------------------------------------------- 1 | int encodeColor(float4 fCol) 2 | { 3 | int iRed = (int)(clamp(fCol.r,0,1) * 255); 4 | int iGreen = (int)(clamp(fCol.g,0,1) * 255) << 8; 5 | int iBlue = (int)(clamp(fCol.b,0,1) * 255) << 16; 6 | int iAlpha = (int)(clamp(fCol.a,0,1) * 255) << 24; 7 | return iRed + iGreen + iBlue + iAlpha; 8 | } 9 | 10 | float4 decodeColor(int iCol) 11 | { 12 | float4 fCol; 13 | fCol.x = (float)(( iCol & 0x000000ff) ) / 255.0f; 14 | fCol.y = (float)(( iCol & 0x0000ff00) >> 8 ) / 255.0f; 15 | fCol.z = (float)(( iCol & 0x00ff0000) >> 16) / 255.0f; 16 | fCol.w = (float)(( iCol & 0xff000000) >> 24) / 255.0f; 17 | return fCol; 18 | } 19 | 20 | float4 randColor(in float id) { 21 | float noiseX = (frac(sin(dot(float2(id,id), float2(12.9898,78.233) )) * 43758.5453)); 22 | float noiseY = (frac(sin(dot(float2(id,id), float2(12.9898,78.233) * 2.0)) * 43758.5453)); 23 | float noiseZ = sqrt(1 - noiseX * noiseX); 24 | return float4(noiseX, noiseY,noiseZ,1); 25 | } 26 | 27 | float4x4 calcRotation (float3 vel){ 28 | static const float PI = 3.14159265f; 29 | 30 | float length = sqrt(vel.x * vel.x + vel.y * vel.y + vel.z * vel.z); //length 31 | float nVelX = vel.x; 32 | float nVelY = vel.y; 33 | float nVelZ = vel.z; 34 | 35 | if (length != 0) 36 | { 37 | nVelX = vel.x / length; 38 | nVelY = vel.y / length; 39 | nVelZ = vel.z / length; 40 | } 41 | 42 | //converter 43 | float conv = (2 * PI); 44 | float3 rotationV; 45 | 46 | //CONVERT FROM POLAR TO CARTESIAN VVVV-STYLE 47 | float lengthPol = nVelX * nVelX + nVelY * nVelY + nVelZ * nVelZ; 48 | 49 | if (lengthPol > 0) 50 | { 51 | lengthPol = sqrt(lengthPol); 52 | float pitch = asin(nVelY / lengthPol); 53 | float yaw = 0.0; 54 | if(nVelZ != 0) 55 | yaw = atan2(-nVelX, -nVelZ); 56 | else if (nVelX > 0) 57 | yaw = -PI / 2; 58 | else 59 | yaw = PI / 2; 60 | 61 | rotationV = float3(pitch, yaw, lengthPol) / conv ; 62 | } 63 | 64 | else 65 | 66 | { 67 | rotationV = float3(0,0,0); 68 | } 69 | 70 | rotationV*= 2*PI; 71 | 72 | float sx = sin(rotationV.x); 73 | float cx = cos(rotationV.x); 74 | float sy = sin(rotationV.y); 75 | float cy = cos(rotationV.y); 76 | float sz = sin(rotationV.z); 77 | float cz = cos(rotationV.z); 78 | 79 | return float4x4( cz*cy+sz*sx*sy, sz*cx, cz*-sy+sz*sx*cy, 0, 80 | -sz*cy+cz*sx*sy, cz*cx, sz*sy+cz*sx*cy , 0, 81 | cx * sy ,-sx , cx * cy , 0, 82 | 0 , 0 , 0 , 1); 83 | } -------------------------------------------------------------------------------- /nodes/plugins/Kabsch (Vector 3d)/Kabsch.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | VVVV.Nodes 9 | Kabsch 10 | v4.0 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | C:\apps\code\vvvv_45beta32_x64\lib\core\;C:\apps\code\vvvv_45beta32_x64\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | GeneralMatrix.dll 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /nodes/texture11/Analysis_BlobExtraction_AsBinaryImage.tfx: -------------------------------------------------------------------------------- 1 | //@author: tmp 2 | //@help: Converts a position texture to a binary texture where pixels are white when their neighbour distances are below a threshold 3 | //@tags: texture 4 | //@credits: 5 | 6 | Texture2D texture2d : PREVIOUS; 7 | float2 R:TARGETSIZE; 8 | float maxDistanceThreshold = 0.15; 9 | int neighbourLookupSize = 4; 10 | int minNeighbourThreshold = 60; 11 | 12 | SamplerState linearSampler : IMMUTABLE 13 | { 14 | Filter = MIN_MAG_MIP_POINT; 15 | AddressU = Clamp; 16 | AddressV = Clamp; 17 | }; 18 | 19 | struct psInput 20 | { 21 | float4 p : SV_Position; 22 | float2 uv : TEXCOORD0; 23 | }; 24 | 25 | 26 | float4 PS(psInput input) : SV_Target 27 | { 28 | float2 offset = 1/R; 29 | 30 | float4 c = float4(0,0,0,0); 31 | 32 | float3 pos = texture2d.Sample(linearSampler,input.uv).xyz; 33 | if( !(pos.x == 0 && pos.y == 0 && pos.z == 0)){ 34 | 35 | float3 nb00 = texture2d.Sample(linearSampler,input.uv + float2(-offset.x, offset.y)).xyz; 36 | float3 nb10 = texture2d.Sample(linearSampler,input.uv + float2(0, offset.y)).xyz; 37 | float3 nb20 = texture2d.Sample(linearSampler,input.uv + float2(offset.x, offset.y)).xyz; 38 | float3 nb01 = texture2d.Sample(linearSampler,input.uv + float2(-offset.x, 0)).xyz; 39 | float3 nb21 = texture2d.Sample(linearSampler,input.uv + float2(offset.x, 0)).xyz; 40 | float3 nb02 = texture2d.Sample(linearSampler,input.uv + float2(-offset.x, -offset.y)).xyz; 41 | float3 nb12 = texture2d.Sample(linearSampler,input.uv + float2(0, -offset.y)).xyz; 42 | float3 nb22 = texture2d.Sample(linearSampler,input.uv + float2(offset.x, -offset.y)).xyz; 43 | 44 | // check if neighbourpixels are below a given distance 45 | if ( 46 | distance(pos, nb00) < maxDistanceThreshold && 47 | distance(pos, nb10) < maxDistanceThreshold && 48 | distance(pos, nb20) < maxDistanceThreshold && 49 | distance(pos, nb01) < maxDistanceThreshold && 50 | distance(pos, nb21) < maxDistanceThreshold && 51 | distance(pos, nb02) < maxDistanceThreshold && 52 | distance(pos, nb12) < maxDistanceThreshold && 53 | distance(pos, nb22) < maxDistanceThreshold 54 | ) { 55 | 56 | // now look at neighbourhood and only draw pixel if we have more than a given number of neighbours 57 | int count = 0; 58 | for (int i = -neighbourLookupSize; i <= neighbourLookupSize; i++){ 59 | for (int j = -neighbourLookupSize; j <= neighbourLookupSize; j++){ 60 | if (texture2d.SampleLevel(linearSampler,input.uv + float2(i * offset.x, j * offset.y),0).a > 0.0) count++; 61 | } 62 | } 63 | // now we can set the color 64 | if (count > minNeighbourThreshold) c = float4(1,1,1,1); 65 | } 66 | } 67 | return c; 68 | } 69 | 70 | 71 | technique10 Process 72 | { 73 | pass P0 74 | { 75 | SetPixelShader(CompileShader(ps_4_0,PS())); 76 | } 77 | } 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /nodes/dx11/Visualization_ConstantPoint.fx: -------------------------------------------------------------------------------- 1 | //@author: tmp 2 | //@help: Generates a colored PointCloud 3 | //@tags: DX11, Kinect, Pointcloud 4 | //@credits: vvvv 5 | 6 | #include "../fxh/_PointData.fxh" 7 | StructuredBuffer pcBuffer; 8 | 9 | #include "../fxh/Helper.fxh" 10 | 11 | cbuffer cbPerDraw : register( b0 ) 12 | { 13 | float4x4 tVP : VIEWPROJECTION; 14 | }; 15 | 16 | cbuffer cbPerObj : register( b1 ) 17 | { 18 | float4x4 tW : WORLD; 19 | float Alpha = 1; 20 | float4 cAmb = { 1.0f,1.0f,1.0f,1.0f }; 21 | int groupFilter; 22 | }; 23 | 24 | struct vsInput 25 | { 26 | uint ii : SV_VertexID; 27 | }; 28 | 29 | struct vs2ps 30 | { 31 | float4 pos: SV_POSITION; 32 | float4 col: COLOR; 33 | float4 col_pos : TEXCOORD0; 34 | float4 col_group : TEXCOORD1; 35 | }; 36 | 37 | /* ===================== VERTEX SHADER ===================== */ 38 | 39 | vs2ps VS(vsInput input) 40 | { 41 | vs2ps output = (vs2ps)0; 42 | 43 | uint idx = input.ii; 44 | 45 | float4 p = float4(0,0,0,1); 46 | // apply groupfilter 47 | if (groupFilter != pcBuffer[idx].groupId && groupFilter != -1) p.w = 0.0f; 48 | 49 | p.xyz += pcBuffer[idx].pos.xyz; 50 | output.pos = mul(p,mul(tW,tVP)); 51 | 52 | 53 | output.col = decodeColor( pcBuffer[idx].col ); 54 | output.col_pos = float4(pcBuffer[idx].pos,1); 55 | output.col_group = randColor(pcBuffer[idx].groupId); 56 | 57 | return output; 58 | } 59 | 60 | /* ===================== PIXEL SHADER ===================== */ 61 | 62 | float4 PS_RGB(vs2ps input): SV_Target 63 | { 64 | float4 col = input.col * cAmb; 65 | col.a *= Alpha; 66 | return col; 67 | } 68 | 69 | float4 PS_POS(vs2ps input): SV_Target 70 | { 71 | return input.col_pos; 72 | } 73 | 74 | float4 PS_COLOR(vs2ps input): SV_Target 75 | { 76 | float4 col = cAmb; 77 | col.a *= Alpha; 78 | return col; 79 | } 80 | 81 | float4 PS_GROUP(vs2ps input): SV_Target 82 | { 83 | return input.col_group; 84 | } 85 | 86 | /* ===================== TECHNIQUE ===================== */ 87 | 88 | technique10 Rgb 89 | { 90 | pass P0 91 | { 92 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 93 | SetPixelShader( CompileShader( ps_4_0, PS_RGB() ) ); 94 | } 95 | } 96 | 97 | technique10 Position 98 | { 99 | pass P0 100 | { 101 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 102 | SetPixelShader( CompileShader( ps_4_0, PS_POS() ) ); 103 | } 104 | } 105 | 106 | technique10 Color 107 | { 108 | pass P0 109 | { 110 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 111 | SetPixelShader( CompileShader( ps_4_0, PS_COLOR() ) ); 112 | } 113 | } 114 | 115 | technique10 GroupId 116 | { 117 | pass P0 118 | { 119 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 120 | SetPixelShader( CompileShader( ps_4_0, PS_GROUP() ) ); 121 | } 122 | } -------------------------------------------------------------------------------- /nodes/plugins/DX11.TextureCCL/DX11.TextureCCL.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | VVVV.Nodes 9 | DX11.TextureCCL 10 | v4.0 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | ..\..\..\..\..\lib\core\;..\..\..\..\..\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | ..\..\..\..\dx11\core\FeralTic.dll 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | ..\..\..\..\dx11\core\VVVV.DX11.Core.dll 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /nodes/dx11/Visualization_Sprite.fx: -------------------------------------------------------------------------------- 1 | //@author: tmp 2 | //@help: Draws a Sprite per Point 3 | //@tags: DX11.Pointcloud 4 | //@credits: vvvv 5 | 6 | #include "../fxh/_PointData.fxh" 7 | StructuredBuffer pcBuffer; 8 | 9 | #include "../fxh/Helper.fxh" 10 | 11 | Texture2D texture2d ; 12 | 13 | SamplerState sampler0 14 | { 15 | Filter = MIN_MAG_MIP_LINEAR; 16 | AddressU = Clamp; 17 | AddressV = Clamp; 18 | }; 19 | 20 | cbuffer cbPerDraw : register( b0 ) 21 | { 22 | float4x4 tV : VIEW; 23 | float4x4 tVP : VIEWPROJECTION; 24 | float4x4 tWVP: WORLDVIEWPROJECTION; 25 | 26 | }; 27 | 28 | cbuffer cbPerObj : register( b1 ) 29 | { 30 | float4x4 tW : WORLD; 31 | int groupFilter; 32 | }; 33 | 34 | float4 cAmb = { 1.0f,1.0f,1.0f,1.0f }; 35 | 36 | struct vsInput 37 | { 38 | float4 pos : POSITION; 39 | float4 TexCd: TEXCOORD0; 40 | uint ii : SV_InstanceID; 41 | }; 42 | 43 | struct vs2ps 44 | { 45 | float4 pos: SV_POSITION; 46 | float4 col: COLOR; 47 | float4 col_pos : TEXCOORD0; 48 | float4 col_group : TEXCOORD1; 49 | float4 TexCd: TEXCOORD2; 50 | }; 51 | 52 | /* ===================== VERTEX SHADER ===================== */ 53 | 54 | vs2ps VS_SPRITE(vsInput input) 55 | { 56 | vs2ps output = (vs2ps)0; 57 | 58 | uint idx = input.ii; 59 | 60 | float4 p; 61 | p.xyz = pcBuffer[idx].pos; 62 | float4 pv = mul(tV,float4(input.pos.xyz,0)); 63 | float3 PosV = float3(pv.xyz) + float3(p.xyz); 64 | float4 finalPos = float4(PosV,1.0); 65 | // apply groupfilter 66 | if (groupFilter != pcBuffer[idx].groupId && groupFilter != -1) finalPos.w = 0.0f; 67 | 68 | output.pos = mul(finalPos, tWVP); 69 | 70 | output.col = decodeColor( pcBuffer[idx].col ); 71 | output.col_pos.xyz = pcBuffer[idx].pos; 72 | output.col_group = randColor(pcBuffer[idx].groupId); 73 | output.TexCd = input.TexCd; 74 | return output; 75 | } 76 | 77 | /* ===================== PIXEL SHADER ===================== */ 78 | 79 | 80 | float4 PS_TEXTURE(vs2ps input): SV_Target 81 | { 82 | float4 col = texture2d.Sample(sampler0,input.TexCd.xy) * cAmb; 83 | 84 | return col; 85 | } 86 | 87 | float4 PS_COLORTEXTURE(vs2ps input): SV_Target 88 | { 89 | float4 rgb = input.col * cAmb; 90 | float4 col = texture2d.Sample(sampler0,input.TexCd.xy) * cAmb; 91 | 92 | return col * rgb; 93 | } 94 | 95 | /* ===================== TECHNIQUE ===================== */ 96 | 97 | technique10 Rgb 98 | { 99 | pass P0 100 | { 101 | SetVertexShader( CompileShader( vs_4_0, VS_SPRITE() ) ); 102 | SetPixelShader( CompileShader( ps_4_0, PS_COLORTEXTURE() ) ); 103 | } 104 | } 105 | 106 | technique10 Color 107 | { 108 | pass P0 109 | { 110 | SetVertexShader( CompileShader( vs_4_0, VS_SPRITE() ) ); 111 | SetPixelShader( CompileShader( ps_4_0, PS_TEXTURE() ) ); 112 | } 113 | } -------------------------------------------------------------------------------- /nodes/plugins/BasicTransformCamera/BasicTransformCameraNode.cs: -------------------------------------------------------------------------------- 1 | #region usings 2 | using System; 3 | using System.ComponentModel.Composition; 4 | 5 | using VVVV.PluginInterfaces.V1; 6 | using VVVV.PluginInterfaces.V2; 7 | using VVVV.Utils.VColor; 8 | using VVVV.Utils.VMath; 9 | 10 | using VVVV.Core.Logging; 11 | #endregion usings 12 | 13 | namespace VVVV.Nodes 14 | { 15 | #region PluginInfo 16 | [PluginInfo(Name = "Camera", Category = "Transform Basic", Help = "Does a Perspective Projection with Lens Shift", Tags = "Projector", Author = "velcrome")] 17 | #endregion PluginInfo 18 | public class TransformCameraNode : IPluginEvaluate 19 | { 20 | #region fields & pins 21 | [Input("Translate", DefaultValues = new[] {0.0, 0, -1})] 22 | public ISpread FTranslate; 23 | 24 | [Input("Rotate", DefaultValues = new[] {0.0, 0, 0})] 25 | public ISpread FRotate; 26 | 27 | [Input("Shift", DefaultValues = new[] {0.0, 0})] 28 | public ISpread FShift; 29 | 30 | [Input("FoV", DefaultValue = 0.2)] 31 | public ISpread FFov; 32 | 33 | [Input("Near Plane", DefaultValue = 0.05, Visibility = PinVisibility.OnlyInspector)] 34 | public ISpread FNear; 35 | 36 | [Input("Far Plane", DefaultValue = 100, Visibility = PinVisibility.OnlyInspector)] 37 | public ISpread FFar; 38 | 39 | [Input("Aspect Ratio", DefaultValue = 0.75, Visibility = PinVisibility.OnlyInspector)] 40 | public ISpread FAspect; 41 | 42 | [Output("View")] 43 | public ISpread FView; 44 | 45 | [Output("Projection")] 46 | public ISpread FProjection; 47 | 48 | [Output("ViewProjection")] 49 | public ISpread FViewProjection; 50 | 51 | [Import()] 52 | public ILogger FLogger; 53 | #endregion fields & pins 54 | 55 | //called when data for any output pin is requested 56 | public void Evaluate(int SpreadMax) 57 | { 58 | FView.SliceCount = 59 | FProjection.SliceCount = 60 | FViewProjection.SliceCount = SpreadMax; 61 | 62 | 63 | for (int i = 0; i < SpreadMax; i++) { 64 | var translate = FTranslate[i]; 65 | var rotate = FRotate[i]; 66 | var fov = FFov[i]; 67 | var shift = FShift[i]; 68 | 69 | var near = FNear[i]; 70 | var far = FFar[i]; 71 | var aspect = FAspect[i]; 72 | 73 | var view = VMath.Inverse( VMath.Rotate(rotate * Math.PI * 2) * VMath.Translate(translate) ); 74 | 75 | double scaleX = 1.0/Math.Tan(fov[0] * Math.PI); 76 | double scaleY = 1.0/Math.Tan(fov[1] * Math.PI); 77 | double fn = far / (far - near); 78 | 79 | var proj = new Matrix4x4(scaleX, 0, 0, 0, 80 | 0, scaleY, 0, 0, 81 | -2*shift.x, -2*shift.y, fn, 1, 82 | 0, 0, -near*fn, 0); 83 | 84 | FView[i] = view; 85 | FProjection[i] = proj; 86 | FViewProjection[i] = view * proj; 87 | } 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /nodes/geom11/GS_DepthToTriangles.gsfx: -------------------------------------------------------------------------------- 1 | //@author: tmp 2 | //@help: Displace the given mesh with the depth data of the kinect 3 | //@tags: DX11, Pointcloud, Mesh, Kinect 4 | //@credits: vvvv 5 | 6 | //float4x4 tW ; 7 | 8 | Texture2D texDepth ; 9 | 10 | SamplerState sPoint : IMMUTABLE 11 | { 12 | Filter = MIN_MAG_MIP_POINT; 13 | AddressU = Border; 14 | AddressV = Border; 15 | }; 16 | 17 | 18 | cbuffer cbPerDraw : register( b0 ) 19 | { 20 | float4x4 tW ; 21 | float4x4 tFilter ; 22 | float2 FOV; 23 | float maxDistance; 24 | }; 25 | 26 | 27 | struct VS_IN 28 | { 29 | float4 pos : POSITION; 30 | float3 normal : NORMAL; 31 | float2 uv : TEXCOORD0; 32 | }; 33 | 34 | struct VS_OUTPUT 35 | { 36 | float4 pos : POSITION; 37 | float3 norm : NORMAL; 38 | float2 uv : TEXCOORD0; 39 | }; 40 | 41 | VS_OUTPUT VS(VS_IN input) 42 | { 43 | VS_OUTPUT o; 44 | 45 | 46 | float depth = texDepth.SampleLevel(sPoint,input.uv.xy,0).r * 65.535 ; 47 | float XtoZ = tan(FOV.x/2) * 2; 48 | float YtoZ = tan(FOV.y/2) * 2; 49 | 50 | float4 pos = float4(0,0,0,1); 51 | pos.x = ((input.uv.x - 0.5) * depth * XtoZ * -1); 52 | pos.y = ((0.5 - input.uv.y) * depth * YtoZ); 53 | pos.z = depth; 54 | pos = mul(pos, tW); 55 | 56 | 57 | //check if point position is inside the given filter(s) 58 | float4 pointCoord = mul(pos, tFilter); 59 | if( pointCoord.x < -0.5 || pointCoord.x > 0.5 || 60 | pointCoord.y < -0.5 || pointCoord.y > 0.5 || 61 | pointCoord.z < -0.5 || pointCoord.z > 0.5 62 | ){ 63 | pos.w = 0.0f; // this marks the vertex point as discard and will not be rendered 64 | } 65 | else pos.w = 1.0f; 66 | 67 | o.pos = pos; 68 | o.norm = input.normal; 69 | o.uv=input.uv; 70 | 71 | return o; 72 | } 73 | 74 | [maxvertexcount(3)] 75 | void GS(triangle VS_OUTPUT input[3], inout TriangleStream gsout) 76 | { 77 | VS_OUTPUT elem = (VS_OUTPUT)0; 78 | 79 | // check if the distance between all 3 vertices of the triangle is 80 | // below the given threshold 81 | if( distance(input[0].pos.xyz,input[1].pos.xyz) < maxDistance && 82 | distance(input[0].pos.xyz,input[2].pos.xyz) < maxDistance && 83 | distance(input[1].pos.xyz,input[2].pos.xyz) < maxDistance && 84 | input[0].pos.w != 0 && input[1].pos.w != 0 && input[2].pos.w != 0 85 | ){ 86 | for(int i = 0; i < 3;i++){ 87 | if(input[i].pos.z != 0) gsout.Append(input[i]); 88 | } 89 | } 90 | gsout.RestartStrip(); 91 | 92 | } 93 | 94 | GeometryShader gsStreamOut = ConstructGSWithSO(CompileShader(gs_4_0, GS()), "POSITION.xyzw; NORMAL.xyz; TEXCOORD.xy", NULL, NULL, NULL, -1); 95 | 96 | technique10 Mesh 97 | { 98 | pass P0 99 | { 100 | SetVertexShader(CompileShader(vs_4_0, VS())); 101 | SetGeometryShader(gsStreamOut); 102 | } 103 | } 104 | 105 | -------------------------------------------------------------------------------- /nodes/dx11/Data_CS_BuildPcb_DynamicBuffer.fx: -------------------------------------------------------------------------------- 1 | float4x4 tW : WORLD; 2 | 3 | int drawIndex : DRAWINDEX; 4 | int IdOffset; 5 | int elementcount; 6 | 7 | bool useEncodedPosition = false; 8 | StructuredBuffer posBuffer ; 9 | StructuredBuffer posBufferEncoded ; 10 | float2 Resolution; 11 | float2 FOV; 12 | 13 | bool useEncodedColor = false; 14 | StructuredBuffer colBuffer ; 15 | StructuredBuffer colBufferEncoded ; 16 | 17 | bool useGroupIdBuffer = false; 18 | StructuredBuffer groupIdBuffer ; 19 | 20 | #include "../fxh/_PointData.fxh" 21 | AppendStructuredBuffer pcBuffer : BACKBUFFER; 22 | 23 | #include "../fxh/Helper.fxh" 24 | 25 | //============================================================================== 26 | //COMPUTE SHADER =============================================================== 27 | //============================================================================== 28 | 29 | [numthreads(64, 1, 1)] 30 | void CSBuildPointcloudBuffer( uint3 DTid : SV_DispatchThreadID ) 31 | { 32 | 33 | if(DTid.x >= (uint) elementcount){return;} 34 | 35 | // ======= SET POSITION ======= 36 | float4 pos; 37 | if (useEncodedPosition){ 38 | int2 iPos = int2(DTid.x % Resolution.x, DTid.x / Resolution.x); 39 | float2 coord = iPos / Resolution; 40 | float depth = posBufferEncoded[DTid.x]; 41 | float XtoZ = tan(FOV.x/2) * 2; 42 | float YtoZ = tan(FOV.y/2) * 2; 43 | pos.x = ((coord.x - 0.5) * depth * XtoZ * -1); 44 | pos.y = ((0.5 - coord.y) * depth * YtoZ); 45 | pos.z = depth; 46 | 47 | // set pos.w to 0 if there was no depth value 48 | // this is used to skip appending this element 49 | if (depth == 0.0f) pos.w = 0; 50 | else pos.w = 1; 51 | } 52 | else{ 53 | pos = float4(posBuffer[DTid.x],1); 54 | } 55 | pos = mul(pos, tW); 56 | 57 | uint cnt, stride; 58 | 59 | // ======= SET COLOR ======= 60 | int col; 61 | if(useEncodedColor){ 62 | colBufferEncoded.GetDimensions(cnt,stride); 63 | col = colBufferEncoded[DTid.x % cnt]; 64 | } 65 | else{ 66 | colBuffer.GetDimensions(cnt,stride); 67 | col = encodeColor( colBuffer[DTid.x % cnt] ); 68 | } 69 | 70 | // ======= SET GROUP ID ======= 71 | int groupId; 72 | if (useGroupIdBuffer){ 73 | groupIdBuffer.GetDimensions(cnt,stride); 74 | groupId = groupIdBuffer[DTid.x % cnt]; 75 | } 76 | else { 77 | groupId = drawIndex + IdOffset; 78 | } 79 | 80 | // ======= APPEND POINT ======= 81 | if(pos.w != 0.0f){ 82 | pointData pd = {pos.xyz, col,groupId }; 83 | pcBuffer.Append(pd); 84 | } 85 | 86 | } 87 | 88 | //============================================================================== 89 | //TECHNIQUES =================================================================== 90 | //============================================================================== 91 | 92 | technique11 BuildPointcloudBuffer 93 | { 94 | pass P0 95 | { 96 | SetComputeShader( CompileShader( cs_5_0, CSBuildPointcloudBuffer() ) ); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /nodes/dx11/Forces_CS_Collision.fx: -------------------------------------------------------------------------------- 1 | #include "../fxh/_ForceData.fxh" 2 | RWStructuredBuffer rwForceBuffer : BACKBUFFER; 3 | 4 | float4x4 tW: WORLD; 5 | float4x4 Rotation; 6 | 7 | int groupId = -1; 8 | int onEventGroup = -1; 9 | bool Bounce; 10 | float BounceMultiplicator = 1.0f; 11 | bool ChangeGroup; 12 | bool Apply; 13 | 14 | [numthreads(64, 1, 1)] 15 | void CS_IsInside( uint3 i : SV_DispatchThreadID) 16 | { 17 | uint cnt, stride; 18 | rwForceBuffer.GetDimensions(cnt,stride); 19 | if (i.x >= cnt) { return; } 20 | 21 | if (Apply) { 22 | if ( groupId == -1 || rwForceBuffer[i.x].groupId == groupId){ 23 | 24 | float3 pointCoord = mul(float4(rwForceBuffer[i.x].position,1), tW).xyz; 25 | if( !(pointCoord.x < -0.5 || pointCoord.x > 0.5 || 26 | pointCoord.y < -0.5 || pointCoord.y > 0.5 || 27 | pointCoord.z < -0.5 || pointCoord.z > 0.5 28 | )){ 29 | if (ChangeGroup){ 30 | rwForceBuffer[i.x].groupId = onEventGroup; 31 | } 32 | 33 | if (Bounce){ 34 | if( !(pointCoord.x < -0.5 || pointCoord.x > 0.5)) rwForceBuffer[i.x].velocity *= float3(-BounceMultiplicator,BounceMultiplicator,BounceMultiplicator); 35 | if( !(pointCoord.y < -0.5 || pointCoord.y > 0.5)) rwForceBuffer[i.x].velocity *= float3(BounceMultiplicator,-BounceMultiplicator,BounceMultiplicator); 36 | if( !(pointCoord.z < -0.5 || pointCoord.z > 0.5)) rwForceBuffer[i.x].velocity *= float3(BounceMultiplicator,BounceMultiplicator,-BounceMultiplicator); 37 | rwForceBuffer[i.x].velocity = mul(float4(rwForceBuffer[i.x].velocity,1), Rotation).xyz; 38 | } 39 | } 40 | 41 | } 42 | } 43 | } 44 | 45 | [numthreads(64, 1, 1)] 46 | void CS_IsOutside( uint3 i : SV_DispatchThreadID) 47 | { 48 | uint cnt, stride; 49 | rwForceBuffer.GetDimensions(cnt,stride); 50 | if (i.x >= cnt) { return; } 51 | 52 | if (Apply) { 53 | if ( groupId == -1 || rwForceBuffer[i.x].groupId == groupId){ 54 | 55 | float3 pointCoord = mul(float4(rwForceBuffer[i.x].position,1), tW).xyz; 56 | if( (pointCoord.x < -0.5 || pointCoord.x > 0.5 || 57 | pointCoord.y < -0.5 || pointCoord.y > 0.5 || 58 | pointCoord.z < -0.5 || pointCoord.z > 0.5 59 | )){ 60 | if (ChangeGroup){ 61 | rwForceBuffer[i.x].groupId = onEventGroup; 62 | } 63 | 64 | if (Bounce){ 65 | if(pointCoord.x < -0.5 || pointCoord.x > 0.5) rwForceBuffer[i.x].velocity *= float3(-BounceMultiplicator,BounceMultiplicator,BounceMultiplicator); 66 | if(pointCoord.y < -0.5 || pointCoord.y > 0.5) rwForceBuffer[i.x].velocity *= float3(BounceMultiplicator,-BounceMultiplicator,BounceMultiplicator); 67 | if(pointCoord.z < -0.5 || pointCoord.z > 0.5) rwForceBuffer[i.x].velocity *= float3(BounceMultiplicator,BounceMultiplicator,-BounceMultiplicator); 68 | rwForceBuffer[i.x].velocity = mul(float4(rwForceBuffer[i.x].velocity,1), Rotation).xyz; 69 | } 70 | 71 | } 72 | 73 | } 74 | } 75 | } 76 | 77 | technique11 IsInside 78 | { 79 | pass P0{ SetComputeShader( CompileShader( cs_5_0, CS_IsInside() ) ); } 80 | } 81 | 82 | technique11 IsOutside 83 | { 84 | pass P0{ SetComputeShader( CompileShader( cs_5_0, CS_IsOutside() ) ); } 85 | } -------------------------------------------------------------------------------- /nodes/geom11/GS_SuppressDiagonals.fx: -------------------------------------------------------------------------------- 1 | float4x4 tW : WORLD; 2 | float4x4 tVP : VIEWPROJECTION; 3 | float4x4 tWVP : WORLDVIEWPROJECTION; 4 | float4x4 tWV : WORLDVIEW; 5 | float4 cAmb = { 1.0f,1.0f,1.0f,1.0f }; 6 | 7 | struct vsin 8 | { 9 | float4 pos : POSITION; 10 | }; 11 | 12 | struct vs2gs 13 | { 14 | float4 pos : POSITION; 15 | }; 16 | 17 | struct psIn 18 | { 19 | float4 pos: SV_POSITION; 20 | }; 21 | 22 | vs2gs VS_Pass(vsin input) 23 | { 24 | //Passtrough in that case, since we will process in gs 25 | 26 | //We don't need normals we will calculate them on the fly 27 | vs2gs output; 28 | output.pos =input.pos; 29 | return output; 30 | } 31 | 32 | psIn VS(vsin input) 33 | { 34 | //Standard displat, so transform as we would usually do 35 | psIn output; 36 | output.pos = mul(input.pos,tWVP); 37 | return output; 38 | } 39 | 40 | 41 | float eps : EPSILON = 0.000001f; 42 | 43 | [maxvertexcount(6)] 44 | void GS_Diag(triangle vs2gs input[3], inout LineStream gsout) 45 | { 46 | psIn o; 47 | 48 | float EPSILON = 0.01f; 49 | 50 | //Grab triangles positions 51 | float3 t1 = input[0].pos.xyz; 52 | float3 t2 = input[1].pos.xyz; 53 | float3 t3 = input[2].pos.xyz; 54 | 55 | 56 | //Compute lines 57 | float3 l1 = t2 - t1; 58 | float3 l2 = t3 - t2; 59 | float3 l3 = t3 - t1; 60 | 61 | //Compute edge length 62 | float dl1 = dot(l1,l1); 63 | float dl2 = dot(l2,l2); 64 | float dl3 = dot(l3,l3); 65 | 66 | //Get max length 67 | float maxdistsqr = max(max(dl1,dl2),dl3); 68 | 69 | /*Append if lower than max length 70 | please note that will not work with all goemetries, 71 | but for grid/boxes/spheres type of topology this is a very simple 72 | way. Also note this is not optimized, 73 | code is quite expanded for readability*/ 74 | 75 | if (dl1 < maxdistsqr) 76 | { 77 | o.pos = mul(float4(t1,1),tWVP); 78 | gsout.Append(o); 79 | 80 | o.pos = mul(float4(t2,1),tWVP); 81 | gsout.Append(o); 82 | 83 | gsout.RestartStrip(); 84 | } 85 | 86 | if (dl2 < maxdistsqr) 87 | { 88 | o.pos = mul(float4(t3,1),tWVP); 89 | gsout.Append(o); 90 | 91 | o.pos = mul(float4(t2,1),tWVP); 92 | gsout.Append(o); 93 | 94 | gsout.RestartStrip(); 95 | } 96 | 97 | 98 | if (dl3 < maxdistsqr) 99 | { 100 | o.pos = mul(float4(t3,1),tWVP); 101 | gsout.Append(o); 102 | 103 | o.pos = mul(float4(t1,1),tWVP); 104 | gsout.Append(o); 105 | 106 | gsout.RestartStrip(); 107 | } 108 | 109 | } 110 | 111 | float4 PS(psIn input): SV_Target 112 | { 113 | return cAmb; 114 | } 115 | 116 | technique10 Render 117 | { 118 | pass P0 119 | { 120 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 121 | SetPixelShader( CompileShader( ps_4_0, PS() ) ); 122 | } 123 | } 124 | 125 | technique10 RenderNoDiagonals 126 | { 127 | pass P0 128 | { 129 | SetVertexShader( CompileShader( vs_4_0, VS_Pass() ) ); 130 | SetGeometryShader( CompileShader( gs_4_0, GS_Diag() ) ); 131 | SetPixelShader( CompileShader( ps_4_0, PS() ) ); 132 | } 133 | } 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /nodes/plugins/RawCompress/RawCompress.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | VVVV.Nodes 9 | RawCompress 10 | v4.0 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | D:\workspace\vvvv\vvvv_45beta33.7_x64\lib\core\;D:\workspace\vvvv\vvvv_45beta33.7_x64\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | SnappyDL.x64.dll 41 | PreserveNewest 42 | 43 | 44 | SnappyDL.x86.dll 45 | PreserveNewest 46 | 47 | 48 | 49 | 50 | packages\SnappyPI.1.0.5.0\lib\SnappyPI.dll 51 | True 52 | 53 | 54 | 55 | False 56 | 57 | 58 | 59 | False 60 | 61 | 62 | False 63 | 64 | 65 | False 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /nodes/plugins/AdvancedQueue/AdvancedQueueNode.cs: -------------------------------------------------------------------------------- 1 | #region usings 2 | using System; 3 | using System.ComponentModel.Composition; 4 | using System.Collections.Generic; 5 | using System.Collections; 6 | using System.Linq; 7 | using VVVV.PluginInterfaces.V1; 8 | using VVVV.PluginInterfaces.V2; 9 | using VVVV.Utils.VColor; 10 | using VVVV.Utils.VMath; 11 | 12 | using VVVV.Core.Logging; 13 | #endregion usings 14 | 15 | namespace VVVV.Nodes 16 | { 17 | 18 | #region PluginInfo 19 | [PluginInfo(Name = "Queue", Category = "Transform", Version = "Advanced", Help = "Inserts the input at index 0 and drops the oldest slice in a FIFO fashion", Author = "tmp")] 20 | #endregion PluginInfo 21 | public class AdvancedMatrix4x4QueueNode : AdvancedGenericSpreadsQueueNode {} 22 | 23 | #region PluginInfo 24 | [PluginInfo(Name = "Queue", Category = "Vector4d", Version = "Advanced", Help = "Inserts the input at index 0 and drops the oldest slice in a FIFO fashion", Author = "tmp")] 25 | #endregion PluginInfo 26 | public class AdvancedVector4dQueueNode : AdvancedGenericSpreadsQueueNode {} 27 | 28 | #region PluginInfo 29 | [PluginInfo(Name = "Queue", Category = "Vector3d", Version = "Advanced", Help = "Inserts the input at index 0 and drops the oldest slice in a FIFO fashion", Author = "tmp")] 30 | #endregion PluginInfo 31 | public class AdvancedVector3dQueueNode : AdvancedGenericSpreadsQueueNode {} 32 | 33 | #region PluginInfo 34 | [PluginInfo(Name = "Queue", Category = "Vector2d", Version = "Advanced", Help = "Inserts the input at index 0 and drops the oldest slice in a FIFO fashion", Author = "tmp")] 35 | #endregion PluginInfo 36 | public class AdvancedVector2dQueueNode : AdvancedGenericSpreadsQueueNode {} 37 | 38 | #region PluginInfo 39 | [PluginInfo(Name = "Queue", Category = "String", Version = "Advanced", Help = "Inserts the input at index 0 and drops the oldest slice in a FIFO fashion", Author = "tmp")] 40 | #endregion PluginInfo 41 | public class AdvancedStringQueueNode : AdvancedGenericSpreadsQueueNode {} 42 | 43 | public class AdvancedGenericSpreadsQueueNode : IPluginEvaluate 44 | { 45 | #region fields & pins 46 | [Input("Input", DefaultValue = 1.0)] 47 | public ISpread FInput; 48 | 49 | [Input("Slot Count", DefaultValue = 1, MinValue = 1, IsSingle = true)] 50 | public IDiffSpread FSlotCount; 51 | 52 | [Input("Frame Count", DefaultValue = 1, MinValue = -1)] 53 | public IDiffSpread FFrameCount; 54 | 55 | [Input("Insert")] 56 | public ISpread FInsert; 57 | 58 | [Input("Reset", IsBang = true)] 59 | public ISpread FReset; 60 | 61 | [Output("Output")] 62 | public ISpread> FOutput; 63 | 64 | [Import()] 65 | public ILogger FLogger; 66 | #endregion fields & pins 67 | 68 | List> queueList; 69 | 70 | public void Evaluate(int SpreadMax) 71 | { 72 | FOutput.SliceCount = FSlotCount[0]; 73 | 74 | if( queueList == null || FSlotCount.IsChanged || FReset[0]){ 75 | queueList = new List>(); 76 | 77 | for (int i = 0; i < FSlotCount[0];i++){ 78 | FOutput[i].SliceCount = 0; 79 | queueList.Add(new Queue()); 80 | } 81 | } 82 | 83 | for (int i = 0; i < FSlotCount[0]; i++){ 84 | if(FInsert[i] == true){ 85 | queueList[i].Enqueue(FInput[i]); 86 | if(queueList[i].Count > FFrameCount[i]) queueList[i].Dequeue(); 87 | FOutput[i].AssignFrom(queueList[i].Reverse()); 88 | } 89 | } 90 | 91 | } 92 | 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /nodes/plugins/LinkedList/LinkedList.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | LinkedList 9 | LinkedList 10 | v4.5 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | ..\..\..\..\..\lib\core\;..\..\..\..\..\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | ..\..\..\..\dx11\core\FeralTic.dll 41 | False 42 | 43 | 44 | False 45 | 46 | 47 | 48 | False 49 | 50 | 51 | 52 | 53 | 54 | False 55 | 56 | 57 | ..\..\..\..\dx11\core\VVVV.DX11.Core.dll 58 | False 59 | 60 | 61 | ..\..\..\..\dx11\core\VVVV.DX11.Lib.dll 62 | False 63 | 64 | 65 | False 66 | 67 | 68 | False 69 | 70 | 71 | False 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /nodes/plugins/RingBuffer/RingBuffer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | RingBuffer 9 | RingBuffer 10 | v4.0 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | ..\..\..\..\..\lib\core\;..\..\..\..\..\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | ..\..\..\..\dx11\core\FeralTic.dll 41 | False 42 | 43 | 44 | False 45 | 46 | 47 | 48 | False 49 | 50 | 51 | 52 | 53 | 54 | False 55 | 56 | 57 | ..\..\..\..\dx11\core\VVVV.DX11.Core.dll 58 | False 59 | 60 | 61 | ..\..\..\..\dx11\core\VVVV.DX11.Lib.dll 62 | False 63 | 64 | 65 | False 66 | 67 | 68 | False 69 | 70 | 71 | False 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /nodes/plugins/RingBufferIndexing/RingBufferIndexing.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} 5 | Debug 6 | x86 7 | Library 8 | RingBufferIndexing 9 | RingBufferIndexing 10 | v4.0 11 | bin\$(Platform)\$(Configuration)\ 12 | True 13 | ..\..\..\..\..\lib\core\;..\..\..\..\..\lib\nodes\plugins\ 14 | 15 | 16 | DEBUG;TRACE 17 | False 18 | True 19 | Full 20 | True 21 | 22 | 23 | TRACE 24 | True 25 | False 26 | None 27 | False 28 | 29 | 30 | AnyCPU 31 | 32 | 33 | x86 34 | 35 | 36 | x64 37 | 38 | 39 | 40 | ..\..\..\..\dx11\core\FeralTic.dll 41 | False 42 | 43 | 44 | False 45 | 46 | 47 | 48 | False 49 | 50 | 51 | 52 | 53 | 54 | False 55 | 56 | 57 | ..\..\..\..\dx11\core\VVVV.DX11.Core.dll 58 | False 59 | 60 | 61 | ..\..\..\..\dx11\core\VVVV.DX11.Lib.dll 62 | False 63 | 64 | 65 | False 66 | 67 | 68 | False 69 | 70 | 71 | False 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /girlpower/ExtendingDatastructure/dx11/Visualization_ExtendedConstantGeometry.fx: -------------------------------------------------------------------------------- 1 | //@author: tmp 2 | //@help: Draws a PointCloud 3 | //@tags: DX11.Pointcloud 4 | //@credits: vvvv 5 | 6 | #include "_PointData.fxh" 7 | StructuredBuffer pcBuffer; 8 | 9 | // THIS IS OUR EXTENSION OF THE STANDARD POINTCLOUD STRUCT 10 | #include "_PointDataExtension.fxh" 11 | StructuredBuffer indexBuffer; 12 | StructuredBuffer pceBuffer; 13 | 14 | cbuffer cbPerDraw : register( b0 ) 15 | { 16 | float4x4 tVP : VIEWPROJECTION; 17 | }; 18 | 19 | cbuffer cbPerObj : register( b1 ) 20 | { 21 | float4x4 tW : WORLD; 22 | int groupFilter; 23 | }; 24 | 25 | float4 cAmb = { 1.0f,1.0f,1.0f,1.0f }; 26 | 27 | struct vsInput 28 | { 29 | float4 pos : POSITION; 30 | uint ii : SV_InstanceID; 31 | }; 32 | 33 | struct vs2ps 34 | { 35 | float4 pos: SV_POSITION; 36 | float4 col: COLOR; 37 | float4 col_pos : TEXCOORD0; 38 | float4 col_group : TEXCOORD1; 39 | float4 col_force : TEXCOORD2; // <<- our additional data 40 | }; 41 | 42 | /* ===================== VERTEX SHADER ===================== */ 43 | 44 | float4 randColor(in float id) { 45 | float noiseX = (frac(sin(dot(float2(id,id), float2(12.9898,78.233) )) * 43758.5453)); 46 | float noiseY = (frac(sin(dot(float2(id,id), float2(12.9898,78.233) * 2.0)) * 43758.5453)); 47 | float noiseZ = sqrt(1 - noiseX * noiseX); 48 | return float4(noiseX, noiseY,noiseZ,1); 49 | } 50 | 51 | vs2ps VS(vsInput input) 52 | { 53 | vs2ps output = (vs2ps)0; 54 | 55 | uint idx = input.ii; 56 | 57 | float4 p = input.pos; 58 | // apply groupfilter 59 | if (groupFilter != pcBuffer[idx].groupId && groupFilter != -1) p.w = 0.0f; 60 | p.xyz += pcBuffer[idx].pos.xyz; 61 | output.pos = mul(p,mul(tW,tVP)); 62 | 63 | output.col = pcBuffer[idx].col; 64 | output.col_pos = float4(pcBuffer[idx].pos,1); 65 | output.col_group = randColor(pcBuffer[idx].groupId); 66 | 67 | // LOAD ADDITIONAL DATA from the extension of the pointcloud buffer 68 | uint idxe = indexBuffer[idx]; // the index to the RWStructuredBuffer 69 | output.col_force = float4(pceBuffer[idxe].force,1) * 10; // the data of the RWStructuredBuffer 70 | 71 | return output; 72 | } 73 | 74 | 75 | 76 | /* ===================== PIXEL SHADER ===================== */ 77 | 78 | float4 PS_RGB(vs2ps input): SV_Target 79 | { 80 | float4 col = input.col * cAmb; 81 | return col; 82 | } 83 | 84 | float4 PS_POS(vs2ps input): SV_Target 85 | { 86 | return input.col_pos; 87 | } 88 | 89 | float4 PS_GROUP(vs2ps input): SV_Target 90 | { 91 | return input.col_group; 92 | } 93 | 94 | float4 PS_FORCE(vs2ps input): SV_Target 95 | { 96 | return input.col_force; 97 | } 98 | 99 | /* ===================== TECHNIQUE ===================== */ 100 | 101 | technique10 RGB 102 | { 103 | pass P0 104 | { 105 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 106 | SetPixelShader( CompileShader( ps_4_0, PS_RGB() ) ); 107 | } 108 | } 109 | 110 | technique10 Position 111 | { 112 | pass P0 113 | { 114 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 115 | SetPixelShader( CompileShader( ps_4_0, PS_POS() ) ); 116 | } 117 | } 118 | 119 | technique10 GroupId 120 | { 121 | pass P0 122 | { 123 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 124 | SetPixelShader( CompileShader( ps_4_0, PS_GROUP() ) ); 125 | } 126 | } 127 | 128 | technique10 Force 129 | { 130 | pass P0 131 | { 132 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 133 | SetPixelShader( CompileShader( ps_4_0, PS_FORCE() ) ); 134 | } 135 | } -------------------------------------------------------------------------------- /nodes/plugins/RawPartialReader/RawPartialReaderNode.cs: -------------------------------------------------------------------------------- 1 | #region usings 2 | using System; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | using System.ComponentModel.Composition; 7 | using System.Runtime.InteropServices; 8 | using System.Collections.Generic; 9 | 10 | using VVVV.PluginInterfaces.V1; 11 | using VVVV.PluginInterfaces.V2; 12 | using VVVV.Utils.VColor; 13 | using VVVV.Utils.VMath; 14 | using VVVV.Utils.Streams; 15 | 16 | using VVVV.Core.Logging; 17 | 18 | #endregion usings 19 | 20 | namespace VVVV.Nodes 21 | { 22 | #region PluginInfo 23 | [PluginInfo(Name = "PartialReader", Category = "Raw", Help = "Reads parts of a raw file", Author = "tmp", Tags = "")] 24 | #endregion PluginInfo 25 | public class RawPartialReaderNode : IPluginEvaluate, IPartImportsSatisfiedNotification 26 | { 27 | #region fields & pins 28 | 29 | [Input("Filename", StringType = StringType.Filename, DefaultString = "", FileMask = "", IsSingle = true)] 30 | public IDiffSpread FFilenameIn; 31 | 32 | [Input("Reload", IsBang=true, IsSingle = true)] 33 | public ISpread FReloadFile; 34 | 35 | [Input("Position", DefaultValue = 0)] 36 | public ISpread FPositionIn; 37 | 38 | [Input("Count", DefaultValue = 0)] 39 | public ISpread FCountIn; 40 | 41 | [Input("Read", IsBang=true, IsSingle = true)] 42 | public ISpread FDoRead; 43 | 44 | [Output("Output")] 45 | public ISpread FStreamOut; 46 | 47 | [Output("File Length", DefaultValue = 0)] 48 | public ISpread FLength; 49 | 50 | readonly byte[] FBuffer = new byte[1024]; 51 | #endregion fields & pins 52 | 53 | private StreamReader FReader; 54 | 55 | //called when all inputs and outputs defined above are assigned from the host 56 | public void OnImportsSatisfied() 57 | { 58 | FStreamOut.SliceCount = 0; 59 | } 60 | 61 | //called when data for any output pin is requested 62 | public void Evaluate(int spreadMax) 63 | { 64 | 65 | if (this.FFilenameIn.IsChanged || FReloadFile[0] ){ 66 | string path = this.FFilenameIn[0]; 67 | if (File.Exists(path))this.FReader = new StreamReader(path); 68 | FLength[0] = this.FReader.BaseStream.Length; 69 | } 70 | 71 | if ( this.FDoRead[0] == true && this.FReader != null){ 72 | 73 | FStreamOut.ResizeAndDispose(spreadMax, () => new MemoryStream()); 74 | var inputStream = FReader.BaseStream; 75 | 76 | for (int i = 0; i < spreadMax; i++) 77 | { 78 | var outputStream = FStreamOut[i]; 79 | var pos = FPositionIn[i] % inputStream.Length; 80 | var count = Math.Max(FCountIn[i], 0); 81 | var numBytesToCopy = Math.Min( inputStream.Length - pos , count); 82 | 83 | inputStream.Position = pos; 84 | outputStream.Position = 0; 85 | 86 | outputStream.SetLength(numBytesToCopy); 87 | 88 | while (numBytesToCopy > 0) 89 | { 90 | var chunkSize = (int)Math.Min(numBytesToCopy, FBuffer.Length); 91 | var numBytesRead = inputStream.Read(FBuffer, 0, chunkSize); 92 | if (numBytesRead == 0) break; 93 | outputStream.Write(FBuffer, 0, numBytesRead); 94 | numBytesToCopy -= numBytesRead; 95 | } 96 | } 97 | 98 | } 99 | 100 | } 101 | 102 | #region Dispose 103 | public void Dispose() 104 | { 105 | this.Clear(); 106 | } 107 | #endregion 108 | 109 | private void Clear() 110 | { 111 | if (this.FReader != null) 112 | { 113 | this.FReader.Close(); 114 | this.FReader.Dispose(); 115 | } 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /nodes/dx11/Visualization_ConstantGeometry.fx: -------------------------------------------------------------------------------- 1 | //@author: tmp 2 | //@help: Draws a PointCloud 3 | //@tags: DX11.Pointcloud 4 | //@credits: vvvv 5 | 6 | #include "../fxh/_PointData.fxh" 7 | StructuredBuffer pcBuffer; 8 | 9 | #include "../fxh/_ForceData.fxh" 10 | StructuredBuffer forceBuffer; 11 | StructuredBuffer indexBuffer; 12 | 13 | #include "../fxh/Helper.fxh" 14 | 15 | cbuffer cbPerDraw : register( b0 ) 16 | { 17 | float4x4 tVP : VIEWPROJECTION; 18 | float4 cAmb = { 1.0f,1.0f,1.0f,1.0f }; 19 | bool withHeading = false; 20 | }; 21 | 22 | cbuffer cbPerObj : register( b1 ) 23 | { 24 | float4x4 tW : WORLD; 25 | int groupFilter; 26 | }; 27 | 28 | struct vsInput 29 | { 30 | float4 pos : POSITION; 31 | uint ii : SV_InstanceID; 32 | }; 33 | 34 | struct vs2ps 35 | { 36 | float4 pos: SV_POSITION; 37 | float4 col: COLOR; 38 | float4 col_pos : TEXCOORD0; 39 | float4 col_group : TEXCOORD1; 40 | float4 col_group_force : TEXCOORD2; 41 | float4 col_force : TEXCOORD3; 42 | }; 43 | 44 | /* ===================== VERTEX SHADER ===================== */ 45 | 46 | vs2ps VS(vsInput input) 47 | { 48 | vs2ps output = (vs2ps)0; 49 | 50 | uint idx = input.ii; // index of point in pointcloudbuffer 51 | uint idxf = indexBuffer[idx]; // index of corresponding point in forcebuffer 52 | 53 | float4 p = input.pos; 54 | 55 | // rotate wrt. velocity 56 | if (withHeading) p = mul(p,calcRotation(forceBuffer[idxf].velocity)); 57 | 58 | // apply groupfilter 59 | if (groupFilter != pcBuffer[idx].groupId && groupFilter != -1) p.w = 0.0f; 60 | p.xyz += pcBuffer[idx].pos.xyz; 61 | output.pos = mul(p,mul(tW,tVP)); 62 | 63 | output.col = decodeColor( pcBuffer[idx].col ); 64 | output.col_pos = float4(pcBuffer[idx].pos,1); 65 | output.col_group = randColor(pcBuffer[idx].groupId); 66 | output.col_group_force = randColor(forceBuffer[idxf].groupId); 67 | output.col_force = float4(forceBuffer[idxf].velocity , 1) * 100; 68 | 69 | return output; 70 | } 71 | 72 | /* ===================== PIXEL SHADER ===================== */ 73 | 74 | float4 PS_RGB(vs2ps input): SV_Target 75 | { 76 | float4 col = input.col * cAmb; 77 | return col; 78 | } 79 | float4 PS_COLOR(vs2ps input): SV_Target 80 | { 81 | return cAmb; 82 | } 83 | 84 | float4 PS_POS(vs2ps input): SV_Target 85 | { 86 | return input.col_pos; 87 | } 88 | 89 | float4 PS_GROUP(vs2ps input): SV_Target 90 | { 91 | return input.col_group; 92 | } 93 | 94 | float4 PS_GROUP_FORCE(vs2ps input): SV_Target 95 | { 96 | return input.col_group_force; 97 | } 98 | 99 | float4 PS_FORCE(vs2ps input): SV_Target 100 | { 101 | return input.col_force; 102 | } 103 | 104 | /* ===================== TECHNIQUE ===================== */ 105 | 106 | technique10 RGB 107 | { 108 | pass P0 109 | { 110 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 111 | SetPixelShader( CompileShader( ps_4_0, PS_RGB() ) ); 112 | } 113 | } 114 | 115 | technique10 Color 116 | { 117 | pass P0 118 | { 119 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 120 | SetPixelShader( CompileShader( ps_4_0, PS_COLOR() ) ); 121 | } 122 | } 123 | 124 | technique10 Position 125 | { 126 | pass P0 127 | { 128 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 129 | SetPixelShader( CompileShader( ps_4_0, PS_POS() ) ); 130 | } 131 | } 132 | 133 | technique10 GroupId 134 | { 135 | pass P0 136 | { 137 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 138 | SetPixelShader( CompileShader( ps_4_0, PS_GROUP() ) ); 139 | } 140 | } 141 | 142 | technique10 GroupIdForce 143 | { 144 | pass P0 145 | { 146 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 147 | SetPixelShader( CompileShader( ps_4_0, PS_GROUP_FORCE() ) ); 148 | } 149 | } 150 | 151 | technique10 Force 152 | { 153 | pass P0 154 | { 155 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 156 | SetPixelShader( CompileShader( ps_4_0, PS_FORCE() ) ); 157 | } 158 | } -------------------------------------------------------------------------------- /nodes/texture11/Filters_DepthRepair.tfx: -------------------------------------------------------------------------------- 1 | //@author: tmp 2 | //@help: Identify zero-pixels and replace them by non-zero pixels that surround them. 3 | //@tags: texture, filter 4 | //@credits: 5 | 6 | Texture2D texture2d : PREVIOUS; 7 | float2 R:TARGETSIZE; 8 | SamplerState pSamp : IMMUTABLE 9 | { 10 | Filter = MIN_MAG_MIP_POINT; 11 | AddressU = Border; 12 | AddressV = Border; 13 | }; 14 | 15 | cbuffer controls:register(b0){ 16 | int innerBandThreshold = 1.0; 17 | int outerBandThreshold =1.0; 18 | }; 19 | 20 | struct psInput 21 | { 22 | float4 p : SV_Position; 23 | float2 uv : TEXCOORD0; 24 | }; 25 | 26 | 27 | float4 PS(psInput input) : SV_Target 28 | { 29 | float4 c = texture2d.Sample(pSamp,input.uv); 30 | 31 | // We are only concerned with eliminating 'white' noise from the data. 32 | // We consider any pixel with a depth of 0 as a possible candidate for filtering. 33 | if (c.r == 0.0f){ 34 | 35 | float filterCollection[24][2]; 36 | int innerBandCount = 0; 37 | int outerBandCount = 0; 38 | 39 | // The following loops will loop through a 5 X 5 matrix of pixels surrounding the 40 | // candidate pixel. This defines 2 distinct 'bands' around the candidate pixel. 41 | // If any of the pixels in this matrix are non-0, we will accumulate them and count 42 | // how many non-0 pixels are in each band. If the number of non-0 pixels breaks the 43 | // threshold in either band, then the average of all non-0 pixels in the matrix is applied 44 | // to the candidate pixel. 45 | for(int dX = -2; dX <= 2; dX++) { 46 | for(int dY = -2; dY <= 2; dY++) { 47 | 48 | // We do not want to consider the candidate pixel 49 | if(dX != 0 || dY != 0){ 50 | 51 | float2 offset = float2(float(dX), float(dY)); 52 | float3 cBand = texture2d.SampleLevel(pSamp,input.uv + offset/R,0).rgb; 53 | 54 | // we only look for non-zero pixels 55 | if (cBand.r != 0.0f){ 56 | 57 | // we want to find the frequency of each depth 58 | for (int i = 0; i < 24; i++){ 59 | if(filterCollection[i][0] == cBand.r){ 60 | // when the depth is already in the filter collection 61 | // we increment the frequency 62 | filterCollection[i][1]++; 63 | break; 64 | } 65 | else if(filterCollection[i][0] == 0){ 66 | // When we encounter a 0 depth in the filter collection 67 | // this means we have reached the end of values already counted. 68 | // We will then add the new depth and start it's frequency at 1. 69 | filterCollection[i][0] = cBand.r; 70 | filterCollection[i][1]++; 71 | break; 72 | } 73 | } 74 | 75 | // We will then determine which band the non-zero pixel 76 | // was found in, and increment the band counters. 77 | if (dY != 2 && dY != -2 && dX != 2 && dX != -2) 78 | innerBandCount++; 79 | else 80 | outerBandCount++; 81 | } 82 | 83 | } 84 | } 85 | } 86 | 87 | // Once we have determined our inner and outer band non-zero counts, and 88 | // accumulated all of those values, we can compare it against the threshold 89 | // to determine if our candidate pixel will be changed to the 90 | // statistical mode of the non-zero surrounding pixels. 91 | if (innerBandCount >= innerBandThreshold || outerBandCount >= outerBandThreshold){ 92 | int frequency = 0; 93 | float depth = 0.0f; 94 | // This loop will determine the statistical mode 95 | // of the surrounding pixels for assignment to 96 | // the candidate. 97 | for (int i = 0; i < 24; i++){ 98 | // This means we have reached the end of our 99 | // frequency distribution and can break out of the 100 | // loop to save time. 101 | if (filterCollection[i][0] == 0.0) 102 | break; 103 | if (filterCollection[i][1] > frequency){ 104 | depth = filterCollection[i][0]; 105 | frequency = filterCollection[i][1]; 106 | } 107 | } 108 | c = depth; 109 | } 110 | 111 | } 112 | 113 | 114 | 115 | return c; 116 | } 117 | 118 | technique10 Process 119 | { 120 | pass P0 121 | { 122 | SetPixelShader(CompileShader(ps_4_0,PS())); 123 | } 124 | } 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /nodes/dx11/Visualization_PhongDirectionalGeometry.fx: -------------------------------------------------------------------------------- 1 | //@author: tmp 2 | //@help: Draws a PointCloud 3 | //@tags: DX11.Pointcloud 4 | //@credits: vvvv 5 | 6 | #include "../fxh/_PointData.fxh" 7 | StructuredBuffer pcBuffer; 8 | 9 | #include "../fxh/_ForceData.fxh" 10 | StructuredBuffer forceBuffer; 11 | StructuredBuffer indexBuffer; 12 | 13 | #include "../fxh/Helper.fxh" 14 | #include "../fxh/PhongDirectional.fxh" 15 | 16 | cbuffer cbPerDraw : register( b0 ) 17 | { 18 | float4x4 tV: VIEW; 19 | float4x4 tWV: WORLDVIEW; 20 | float4x4 tVP : VIEWPROJECTION; 21 | float4x4 tWVP: WORLDVIEWPROJECTION; 22 | float4x4 tP: PROJECTION; 23 | float4x4 tWIT: WORLDINVERSETRANSPOSE; 24 | bool withHeading = false; 25 | }; 26 | 27 | cbuffer cbPerObj : register( b1 ) 28 | { 29 | float4x4 tW : WORLD; 30 | int groupFilter; 31 | }; 32 | 33 | struct vsInput 34 | { 35 | float4 pos : POSITION; 36 | float3 NormO: NORMAL; 37 | uint ii : SV_InstanceID; 38 | }; 39 | 40 | struct vs2ps 41 | { 42 | float4 pos: SV_POSITION; 43 | float4 col: COLOR; 44 | float4 col_pos : TEXCOORD0; 45 | float4 col_group : TEXCOORD1; 46 | float4 col_group_force : TEXCOORD2; 47 | float4 col_force : TEXCOORD3; 48 | 49 | float3 LightDirV: TEXCOORD4; 50 | float3 NormV: TEXCOORD5; 51 | float3 ViewDirV: TEXCOORD6; 52 | }; 53 | 54 | /* ===================== VERTEX SHADER ===================== */ 55 | 56 | vs2ps VS(vsInput input) 57 | { 58 | vs2ps output = (vs2ps)0; 59 | 60 | uint idx = input.ii; // index of point in pointcloudbuffer 61 | uint idxf = indexBuffer[idx]; // index of corresponding point in forcebuffer 62 | 63 | float4 p = input.pos; 64 | 65 | // rotate wrt. velocity 66 | if (withHeading) p = mul(p,calcRotation(forceBuffer[idxf].velocity)); 67 | 68 | // apply groupfilter 69 | if (groupFilter != pcBuffer[idx].groupId && groupFilter != -1) p.w = 0.0f; 70 | p.xyz += pcBuffer[idx].pos.xyz; 71 | output.pos = mul(p,mul(tW,tVP)); 72 | 73 | output.col = decodeColor( pcBuffer[idx].col ); 74 | output.col_pos = float4(pcBuffer[idx].pos,1); 75 | output.col_group = randColor(pcBuffer[idx].groupId); 76 | output.col_group_force = randColor(forceBuffer[idxf].groupId); 77 | output.col_force = float4(forceBuffer[idxf].velocity , 1) * 100; 78 | 79 | //inverse light direction in view space 80 | output.LightDirV = normalize(-mul(float4(lDir,0), tV).xyz); 81 | //normal in view space 82 | output.NormV = normalize(mul(mul(input.NormO, (float3x3)tWIT),(float3x3)tV).xyz); 83 | output.ViewDirV = -normalize(mul(p, tWV).xyz); 84 | 85 | return output; 86 | } 87 | 88 | /* ===================== PIXEL SHADER ===================== */ 89 | 90 | float4 PS_RGB(vs2ps input): SV_Target 91 | { 92 | return input.col * PhongDirectional(input.NormV, input.ViewDirV, input.LightDirV); 93 | } 94 | 95 | float4 PS_POS(vs2ps input): SV_Target 96 | { 97 | return input.col_pos * PhongDirectional(input.NormV, input.ViewDirV, input.LightDirV); 98 | } 99 | 100 | float4 PS_GROUP(vs2ps input): SV_Target 101 | { 102 | return input.col_group * PhongDirectional(input.NormV, input.ViewDirV, input.LightDirV); 103 | } 104 | 105 | float4 PS_GROUP_FORCE(vs2ps input): SV_Target 106 | { 107 | return input.col_group_force * PhongDirectional(input.NormV, input.ViewDirV, input.LightDirV); 108 | } 109 | 110 | float4 PS_FORCE(vs2ps input): SV_Target 111 | { 112 | return input.col_force * PhongDirectional(input.NormV, input.ViewDirV, input.LightDirV); 113 | } 114 | 115 | /* ===================== TECHNIQUE ===================== */ 116 | 117 | technique10 RGB 118 | { 119 | pass P0 120 | { 121 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 122 | SetPixelShader( CompileShader( ps_4_0, PS_RGB() ) ); 123 | } 124 | } 125 | 126 | technique10 Position 127 | { 128 | pass P0 129 | { 130 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 131 | SetPixelShader( CompileShader( ps_4_0, PS_POS() ) ); 132 | } 133 | } 134 | 135 | technique10 GroupId 136 | { 137 | pass P0 138 | { 139 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 140 | SetPixelShader( CompileShader( ps_4_0, PS_GROUP() ) ); 141 | } 142 | } 143 | 144 | technique10 GroupIdForce 145 | { 146 | pass P0 147 | { 148 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 149 | SetPixelShader( CompileShader( ps_4_0, PS_GROUP_FORCE() ) ); 150 | } 151 | } 152 | 153 | technique10 Force 154 | { 155 | pass P0 156 | { 157 | SetVertexShader( CompileShader( vs_4_0, VS() ) ); 158 | SetPixelShader( CompileShader( ps_4_0, PS_FORCE() ) ); 159 | } 160 | } -------------------------------------------------------------------------------- /nodes/plugins/StringIndexer/StringIndexerNode.cs: -------------------------------------------------------------------------------- 1 | #region usings 2 | using System; 3 | using System.ComponentModel.Composition; 4 | using System.Collections.Generic; 5 | 6 | using VVVV.PluginInterfaces.V2; 7 | using VVVV.Core.Logging; 8 | using System.Linq; 9 | 10 | #endregion usings 11 | 12 | namespace VVVV.Nodes 13 | { 14 | #region PluginInfo 15 | [PluginInfo(Name = "Indexer", Category = "String", AutoEvaluate=true, Help = "Session Management based on unique sting-based Names. Outputs are useful for feeding a Buffer.", Tags = "Buffer", Author="velcrome")] 16 | #endregion PluginInfo 17 | public class StringIndexerNode : IPluginEvaluate, IPartImportsSatisfiedNotification 18 | { 19 | #region fields & pins 20 | [Input("Name", DefaultString = "id")] 21 | public ISpread FInput; 22 | 23 | [Input("Remove Name", DefaultString = "")] 24 | public ISpread FRemove; 25 | 26 | [Input("Timeout", IsSingle = true)] 27 | public IDiffSpread FTimeOut; 28 | 29 | [Input("Index Count", DefaultValue = 256, IsSingle = true)] 30 | public IDiffSpread FCount; 31 | 32 | [Output("Index")] 33 | public ISpread FFormerId; 34 | 35 | [Output("Fresh")] 36 | public ISpread FIdFresh; 37 | 38 | [Output("Removed")] 39 | public ISpread FIdRemoved; 40 | 41 | [Output("Saved Index")] 42 | public ISpread FId; 43 | 44 | [Output("Saved Name")] 45 | public ISpread FOutput; 46 | 47 | [Import()] 48 | public ILogger FLogger; 49 | 50 | 51 | protected Dictionary Data = new Dictionary(); 52 | protected Dictionary Age = new Dictionary(); 53 | protected HashSet FreeIndices = new HashSet(); 54 | 55 | #endregion fields & pins 56 | 57 | public void OnImportsSatisfied() { 58 | FCount.Changed += CountChanged; 59 | } 60 | 61 | protected void CountChanged(IDiffSpread spread) { 62 | Reset(); 63 | } 64 | 65 | protected void Reset() { 66 | Data.Clear(); 67 | Age.Clear(); 68 | 69 | FreeIndices.Clear(); 70 | for (int i=0;i 0) 123 | sessionEnabled = true; 124 | 125 | foreach (var item in Age.Keys.ToArray()) { 126 | var index = Data[item]; 127 | if (sessionEnabled && Age[item] + maxAge < DateTime.Now) { 128 | FreeIndices.Add(index); 129 | Data.Remove(item); 130 | Age.Remove(item); 131 | FIdRemoved.Add(index); 132 | } 133 | } 134 | 135 | var sorted = Data.Values.ToList(); 136 | sorted.Sort(); 137 | FId.AssignFrom(sorted); 138 | 139 | FOutput.SliceCount = 0; 140 | SpreadMax = sorted.Count; 141 | 142 | FOutput.AssignFrom( 143 | from key in sorted 144 | from index in Data.Keys 145 | where Data[index] == key 146 | select index 147 | ); 148 | } 149 | 150 | private int RemoveOldest() { 151 | var oldest = ( 152 | from id in Age.Keys 153 | orderby Age[id] 154 | select id 155 | ).First(); 156 | 157 | var index = Data[oldest]; 158 | Data.Remove(oldest); 159 | Age.Remove(oldest); 160 | FreeIndices.Add(index); 161 | 162 | return index; 163 | } 164 | } 165 | } 166 | --------------------------------------------------------------------------------