Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
ButtonPusher
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Button Pusher
ButtonPusher
Commits
5e177f3a
Commit
5e177f3a
authored
Jan 15, 2018
by
16이상민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring test method
parent
6901aa96
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
23 deletions
+25
-23
CoordinateMapperManager.cs
Assets/Script/CoordinateMapperManager.cs
+3
-0
CoordinateMapperView.cs
Assets/Script/CoordinateMapperView.cs
+0
-2
CoordinateMapperViewTests.cs
Assets/Script/Tests/CoordinateMapperViewTests.cs
+22
-21
No files found.
Assets/Script/CoordinateMapperManager.cs
View file @
5e177f3a
...
...
@@ -44,6 +44,9 @@ public class CoordinateMapperManager : MonoBehaviour
_DepthCoordinates
=
new
DepthSpacePoint
[
KinectModule
.
KinectConstants
.
ColorWidth
*
KinectModule
.
KinectConstants
.
ColorHeight
];
_SourceBuffer
=
new
KinectModule
.
SourceBuffer
();
_KinectAccessManager
=
new
KinectModule
.
KinectAccessManager
();
_KinectAccessManager
.
Access
();
}
...
...
Assets/Script/CoordinateMapperView.cs
View file @
5e177f3a
...
...
@@ -9,8 +9,6 @@ public class CoordinateMapperView : MonoBehaviour
private
DepthSpacePoint
[]
DepthPoints
;
private
byte
[]
BodyIndexPoints
;
// In play mode, texture of gameobject should be same as texture which made by shader when after update.
void
Start
()
{
...
...
Assets/Script/Tests/CoordinateMapperViewTests.cs
View file @
5e177f3a
...
...
@@ -2,14 +2,10 @@
using
UnityEngine.TestTools
;
using
NUnit.Framework
;
using
System.Collections
;
using
Windows.Kinect
;
using
System.Runtime.InteropServices
;
using
System
;
class
CoordinateMapperViewTests
{
// A UnityTest behaves like a coroutine in PlayMode
// and allows you to yield null to skip a frame in EditMode
// TODO: Reduce warning factors
[
UnityTest
]
public
IEnumerator
MainTexture_Equal_Texture_Generate_By_Shader_When_After_Update
()
{
...
...
@@ -19,31 +15,36 @@ class CoordinateMapperViewTests
yield
return
null
;
var
Managers
=
GameObject
.
Find
(
"Managers"
);
var
CoordinateMapperManager
=
Managers
.
GetComponent
<
CoordinateMapperManager
>();
var
tmpObj
=
GameObject
.
CreatePrimitive
(
PrimitiveType
.
Plane
);
tmpObj
.
GetComponent
<
Renderer
>().
material
=
Resources
.
Load
(
"GreenScreen/GreenScreen.mat"
,
typeof
(
Material
))
as
Material
;
tmpObj
.
GetComponent
<
Renderer
>().
material
.
SetTexture
(
"_MainTex"
,
CoordinateMapperManager
.
ColorTexture
);
var
DepthPoints
=
CoordinateMapperManager
.
DepthCoordinates
;
var
DepthBuffer
=
new
ComputeBuffer
(
DepthPoints
.
Length
,
sizeof
(
float
)
*
2
);
tmpObj
.
GetComponent
<
Renderer
>().
material
.
SetBuffer
(
"depthCoordinates"
,
DepthBuffer
);
var
BodyIndexPoints
=
CoordinateMapperManager
.
BodyIndexBuffer
;
var
BodyIndexBuffer
=
new
ComputeBuffer
(
BodyIndexPoints
.
Length
,
sizeof
(
float
));
tmpObj
.
GetComponent
<
Renderer
>().
material
.
SetBuffer
(
"bodyIndexBuffer"
,
BodyIndexBuffer
);
var
material
=
tmpObj
.
GetComponent
<
Renderer
>().
material
;
SetTextureBuffer
(
material
);
var
CoordinateMapperView
=
GameObject
.
Find
(
"CoordinateMapView"
);
// Use the Assert class to test conditions.
// yield to skip a frame
yield
return
null
;
var
expected
=
tmpObj
.
GetComponent
<
Renderer
>().
material
.
mainTexture
;
var
expected
=
new
Texture
();
Graphics
.
CopyTexture
(
material
.
mainTexture
,
expected
);
UnityEngine
.
Object
.
Destroy
(
tmpObj
);
var
actual
=
CoordinateMapperView
.
GetComponent
<
Renderer
>().
material
.
mainTexture
;
Assert
.
AreEqual
(
expected
,
actual
,
"texture of gameobject should be same as texture which made by shader."
);
}
void
SetTextureBuffer
(
Material
material
)
{
var
CoordinateMapperManager
=
GameObject
.
Find
(
"Managers"
).
GetComponent
<
CoordinateMapperManager
>();
material
.
SetTexture
(
"_MainTex"
,
CoordinateMapperManager
.
ColorTexture
);
var
DepthPoints
=
CoordinateMapperManager
.
DepthCoordinates
;
var
DepthBuffer
=
new
ComputeBuffer
(
DepthPoints
.
Length
,
sizeof
(
float
)
*
2
);
material
.
SetBuffer
(
"depthCoordinates"
,
DepthBuffer
);
var
BodyIndexPoints
=
CoordinateMapperManager
.
BodyIndexBuffer
;
var
BodyIndexBuffer
=
new
ComputeBuffer
(
BodyIndexPoints
.
Length
,
sizeof
(
float
));
material
.
SetBuffer
(
"bodyIndexBuffer"
,
BodyIndexBuffer
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment