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
e880d437
Commit
e880d437
authored
7 years ago
by
16이상민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Recover from before wrong revert
parent
6bb26cdb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
59 deletions
+42
-59
KinectAccessManagerTests.cs
Assets/Editor/KinectAccessManagerTests.cs
+0
-29
CoordinateMapperManager.cs
Assets/Script/CoordinateMapperManager.cs
+12
-7
CoordinateMapperManagerTests.cs
Assets/Script/Tests/CoordinateMapperManagerTests.cs
+6
-4
CoordinateMapperViewTests.cs
Assets/Script/Tests/CoordinateMapperViewTests.cs
+24
-19
No files found.
Assets/Editor/KinectAccessManagerTests.cs
View file @
e880d437
...
...
@@ -46,20 +46,6 @@ public class KinectAccessManagerTests
}
}
[
Test
]
public
void
SourceFrame_NotEqual_Null_When_Access
()
{
using
(
var
obj
=
new
KinectAccessManager
())
{
obj
.
Access
();
var
expected
=
null
as
MultiSourceFrame
;
var
actual
=
obj
.
SourceFrame
;
Assert
.
AreNotEqual
(
expected
,
actual
,
"SourceFrame should not be null value."
);
}
}
[
Test
]
public
void
SourceFrame_Equal_Null_When_Dispose
()
{
...
...
@@ -72,21 +58,6 @@ public class KinectAccessManagerTests
}
}
[
Test
]
public
void
NullFrame_Equal_False_When_Access
()
{
using
(
var
obj
=
new
KinectAccessManager
())
{
obj
.
Access
();
var
tmp
=
obj
.
SourceFrame
;
var
expected
=
false
;
var
actual
=
obj
.
NullFrame
;
Assert
.
AreEqual
(
expected
,
actual
,
"NullFrame should be false."
);
}
}
[
Test
]
public
void
NullFrame_Equal_True_When_Dispose
()
{
...
...
This diff is collapsed.
Click to expand it.
Assets/Script/CoordinateMapperManager.cs
View file @
e880d437
...
...
@@ -40,6 +40,7 @@ public class CoordinateMapperManager : MonoBehaviour
_SourceBuffer
=
new
KinectModule
.
SourceBuffer
();
_KinectAccessManager
=
new
KinectModule
.
KinectAccessManager
();
_KinectAccessManager
.
Dispose
();
}
void
OnEnable
()
...
...
@@ -96,8 +97,8 @@ public class CoordinateMapperManager : MonoBehaviour
void
Update
()
{
GetFPS
();
var
sourceFrame
=
new
KinectModule
.
RealMultiSourceFrame
(
_KinectAccessManager
.
SourceFrame
);
;
var
sourceFrame
=
new
KinectModule
.
RealMultiSourceFrame
(
_KinectAccessManager
.
SourceFrame
);
if
(!
_KinectAccessManager
.
NullFrame
)
{
...
...
@@ -233,7 +234,7 @@ namespace KinectModule
FrameSourceTypes
.
BodyIndex
|
FrameSourceTypes
.
Body
);
_Is
Senso
rOpen
=
(
_SourceFrameReader
!=
null
);
_Is
FrameReade
rOpen
=
(
_SourceFrameReader
!=
null
);
}
public
void
Dispose
()
...
...
@@ -325,10 +326,14 @@ namespace KinectModule
public
RealMultiSourceFrame
(
MultiSourceFrame
sourceFrame
)
{
_ColorFrame
=
new
RealColorFrame
(
sourceFrame
.
ColorFrameReference
.
AcquireFrame
());
_BodyIndexFrame
=
new
RealBodyIndexFrame
(
sourceFrame
.
BodyIndexFrameReference
.
AcquireFrame
());
_DepthFrame
=
new
RealDepthFrame
(
sourceFrame
.
DepthFrameReference
.
AcquireFrame
());
_BodyFrame
=
new
RealBodyFrame
(
sourceFrame
.
BodyFrameReference
.
AcquireFrame
());
_ColorFrame
=
new
RealColorFrame
(
sourceFrame
==
null
?
null
:
sourceFrame
.
ColorFrameReference
.
AcquireFrame
());
_BodyIndexFrame
=
new
RealBodyIndexFrame
(
sourceFrame
==
null
?
null
:
sourceFrame
.
BodyIndexFrameReference
.
AcquireFrame
());
_DepthFrame
=
new
RealDepthFrame
(
sourceFrame
==
null
?
null
:
sourceFrame
.
DepthFrameReference
.
AcquireFrame
());
_BodyFrame
=
new
RealBodyFrame
(
sourceFrame
==
null
?
null
:
sourceFrame
.
BodyFrameReference
.
AcquireFrame
());
}
private
class
RealColorFrame
:
IColorFrame
...
...
This diff is collapsed.
Click to expand it.
Assets/Script/Tests/CoordinateMapperManagerTests.cs
View file @
e880d437
...
...
@@ -53,13 +53,15 @@ public class CoordinateMapperManagerTests
public
IEnumerator
ColorTexture_Not_Equal_Null_When_Kinect_Connected
()
{
var
comp
=
ActiveComponent
();
yield
return
null
;
var
expected
=
null
as
Texture2D
;
var
actual
=
comp
.
ColorTexture
;
Assert
.
AreNotEqual
(
expected
,
actual
,
"ColorTexture should not be null value when kinect connected."
);
Application
.
Quit
();
}
[
UnityTest
]
...
...
@@ -150,9 +152,9 @@ public class CoordinateMapperManagerTests
CoordinateMapperManager
InactiveComponent
()
{
var
tmpObj
=
new
GameObject
();
var
comp
=
tmpObj
.
Get
Component
<
CoordinateMapperManager
>();
var
comp
=
tmpObj
.
Add
Component
<
CoordinateMapperManager
>();
tmpObj
.
SetActive
(
false
);
return
comp
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Assets/Script/Tests/CoordinateMapperViewTests.cs
View file @
e880d437
...
...
@@ -9,42 +9,47 @@ class CoordinateMapperViewTests
[
UnityTest
]
public
IEnumerator
MainTexture_Equal_Texture_Generate_By_Shader_When_After_Update
()
{
yield
return
null
;
var
tmpObj
=
CreatePlaneWithShader
()
;
GameManager
.
Instance
.
SceneTransition
(
"InGame"
);
var
manager
=
CreateManager
(
);
yield
return
null
;
var
material
=
tmpObj
.
GetComponent
<
Renderer
>().
material
;
material
.
SetTexture
(
"_MainTex"
,
manager
.
ColorTexture
);
var
tmpObj
=
GameObject
.
CreatePrimitive
(
PrimitiveType
.
Plane
);
tmpObj
.
GetComponent
<
Renderer
>().
material
=
Resources
.
Load
(
"GreenScreen/GreenScreen.mat"
,
typeof
(
Material
))
as
Material
;
var
DepthPoints
=
manager
.
DepthCoordinates
;
var
DepthBuffer
=
new
ComputeBuffer
(
DepthPoints
.
Length
,
sizeof
(
float
)
*
2
);
material
.
SetBuffer
(
"depthCoordinates"
,
DepthBuffer
);
var
material
=
tmpObj
.
GetComponent
<
Renderer
>().
material
;
SetTextureBuffer
(
material
);
var
BodyIndexPoints
=
manager
.
BodyIndexBuffer
;
var
BodyIndexBuffer
=
new
ComputeBuffer
(
BodyIndexPoints
.
Length
,
sizeof
(
float
));
material
.
SetBuffer
(
"bodyIndexBuffer"
,
BodyIndexBuffer
);
var
CoordinateMapperView
=
GameObject
.
Find
(
"CoordinateMapView"
);
var
coordinateMapperView
=
CreatePlaneWithShader
();
var
CoordinateMapperView
=
coordinateMapperView
.
AddComponent
<
CoordinateMapperView
>();
yield
return
null
;
var
expected
=
new
Texture
();
Graphics
.
CopyTexture
(
material
.
mainTexture
,
expected
);
var
expected
=
material
.
mainTexture
;
Object
.
Destroy
(
tmpObj
);
DepthBuffer
.
Release
();
BodyIndexBuffer
.
Release
();
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
)
CoordinateMapperManager
CreateManager
(
)
{
var
CoordinateMapperManager
=
GameObject
.
Find
(
"Managers"
).
GetComponent
<
CoordinateMapperManager
>();
material
.
SetTexture
(
"_MainTex"
,
CoordinateMapperManager
.
ColorTexture
);
var
manager
=
new
GameObject
(
"Managers"
);
return
manager
.
AddComponent
<
CoordinateMapperManager
>();
}
var
DepthPoints
=
CoordinateMapperManager
.
DepthCoordinates
;
var
DepthBuffer
=
new
ComputeBuffer
(
DepthPoints
.
Length
,
sizeof
(
float
)
*
2
);
material
.
SetBuffer
(
"depthCoordinates"
,
DepthBuffer
);
GameObject
CreatePlaneWithShader
()
{
var
tmpObj
=
GameObject
.
CreatePrimitive
(
PrimitiveType
.
Plane
);
tmpObj
.
GetComponent
<
Renderer
>().
material
=
Resources
.
Load
(
"GreenScreen/GreenScreen.mat"
,
typeof
(
Material
))
as
Material
;
var
BodyIndexPoints
=
CoordinateMapperManager
.
BodyIndexBuffer
;
var
BodyIndexBuffer
=
new
ComputeBuffer
(
BodyIndexPoints
.
Length
,
sizeof
(
float
));
material
.
SetBuffer
(
"bodyIndexBuffer"
,
BodyIndexBuffer
);
return
tmpObj
;
}
}
This diff is collapsed.
Click to expand it.
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