Skip to content

Commit

Permalink
getting ready for subtitles 3d
Browse files Browse the repository at this point in the history
  • Loading branch information
obviousjim committed Feb 21, 2015
1 parent 9a92a8d commit 143e15b
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 14 deletions.
37 changes: 24 additions & 13 deletions CloudsLibrary/src/VisualSystemsLibrary/CloudsRGBDVideoPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ CloudsRGBDVideoPlayer::CloudsRGBDVideoPlayer(){
bLoadResult = false;
bPlayWhenReady = false;

subtitle3DhRotate = 0;
subtitle3DvRotate = 0;
subtitle3DzDistance = 20;
subtitle3DscaleAmt = 1.0;
subtitle3Doffset = ofVec2f(0,0);

currentPlayer = ofPtr<ofVideoPlayer>( new ofVideoPlayer() );
nextPlayer = ofPtr<ofVideoPlayer>( new ofVideoPlayer() );

Expand Down Expand Up @@ -404,6 +410,9 @@ void CloudsRGBDVideoPlayer::update(ofEventArgs& args){

if(playingVO){
currentVoiceoverPlayer->setVolume(audioVolume);
if (currentClipHasSubtitles) {
currentSubtitles->setTimeInSeconds(currentVoiceoverPlayer->getPosition());
}
}
else{
float position = getPlayer().getPosition()*getPlayer().getDuration();
Expand All @@ -424,7 +433,6 @@ void CloudsRGBDVideoPlayer::update(ofEventArgs& args){
fadeInValue = powf(ofMap(fadeInValue, 1.0, 1.5, 0.0, 1.0, true), 2.0);
fadeOutValue = powf(ofMap(fadeOutValue, .5, 1.0, 0.0, 1.0, true), 2.0);


float fadeInStartTime = 1.0;
float fadeInEndTime = 1.4;
float fadeOutStartTime = duration - 1.3 ;
Expand Down Expand Up @@ -544,32 +552,35 @@ void CloudsRGBDVideoPlayer::drawSubtitles3D(ofCamera* cam){
baseRotation.makeRotationMatrix(cam->getOrientationQuat());
ofMultMatrix(baseRotation);

ofVec3f yAxis = ofVec3f(0.0, 1.0, 0.0);
ofVec3f xAxis = ofVec3f(1.0, 0.0, 0.0);

// Calculate the base position.
////////////////////////
// PARAMS
ofVec3f yAxis = ofVec3f(0.0, 1.0, 0.0);
ofVec3f xAxis = ofVec3f(1.0, 0.0, 0.0);
ofVec3f camPos = ofVec3f(); //cam->getPosition();
float hRotate = 10;
ofVec3f camPos = cam->getPosition();
/* float hRotate = 10;
float vRotate = 10;
float zDistance = 20;
float scaleAmt = 1.0;
ofVec2f offset(0,0);
////////////////////////
*/ ////////////////////////

ofVec3f basePos(offset.x, offset.y, -zDistance);
basePos.rotate(hRotate, camPos, yAxis);
basePos.rotate(vRotate, camPos, xAxis);
ofVec3f basePos(subtitle3Doffset.x, subtitle3Doffset.y, -subtitle3DzDistance);
basePos.rotate(subtitle3DhRotate, camPos, yAxis);
basePos.rotate(subtitle3DvRotate, camPos, xAxis);

// Get the total layer bounds.
ofRectangle layerBounds;
ofRectangle layerBounds;
/*
for(int i = 0; i < layerSets[layer].size(); i++){
if (i == 0) layerBounds = layerSets[layer][i]->svg.getBounds();
else layerBounds.growToInclude(layerSets[layer][i]->svg.getBounds());
}

*/
// Translate to the layer center pos.
ofVec3f layerPos = basePos + (getCenter(false) - layerBounds.getCenter());
// ofVec3f layerPos = basePos + (getCenter(false) - layerBounds.getCenter());
ofVec3f layerPos = basePos - layerBounds.getCenter();
ofTranslate(layerPos);

//CLOUDS_HUD_BILLBOARD_OCULUS {
Expand All @@ -592,7 +603,7 @@ void CloudsRGBDVideoPlayer::drawSubtitles3D(ofCamera* cam){


// Transform for rendering the layer.
ofScale(-scaleAmt, -scaleAmt, 1);
ofScale(-subtitle3DscaleAmt, -subtitle3DscaleAmt, 1);
ofTranslate(-layerBounds.getCenter());

// Draw the layer.
Expand Down
10 changes: 9 additions & 1 deletion CloudsLibrary/src/VisualSystemsLibrary/CloudsRGBDVideoPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,15 @@ class CloudsRGBDVideoPlayer : public ofThread {

void drawSubtitles();
void drawSubtitles(int x, int y);
void drawSubtitles3D();
void drawSubtitles3D(ofCamera* camera);

//subtitle 3D params
float subtitle3DhRotate;
float subtitle3DvRotate;
float subtitle3DzDistance;
float subtitle3DscaleAmt;
ofVec2f subtitle3Doffset;
//end 3D

protected:

Expand Down
2 changes: 2 additions & 0 deletions CloudsLibrary/src/VisualSystemsLibrary/CloudsVisualSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,9 @@ void CloudsVisualSystem::drawScene(){
ofSetLineWidth(1);
selfDraw();

#ifdef OCULUS_RIFT
CloudsRGBDVideoPlayer::drawSubtitles3D(getOculusRift().baseCamera);
#endif

checkOpenGLError(getSystemName() + ":: DRAW");
ofPopStyle();
Expand Down
2 changes: 2 additions & 0 deletions libRGBD/RGBD.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\CloudsLibrary\src\CloudsLocalization.cpp" />
<ClCompile Include="..\CloudsLibrary\src\RGBD\BackgroundParticles\VoxelMesh.cpp" />
<ClCompile Include="..\CloudsLibrary\src\RGBD\CloudsRGBDPointLayer.cpp" />
<ClCompile Include="..\CloudsLibrary\src\RGBD\CloudsVisualSystemRGBD.cpp" />
Expand All @@ -70,6 +71,7 @@
<ClCompile Include="..\CloudsLibrary\src\RGBD\Portal\CloudsPortalRing.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\CloudsLibrary\src\CloudsLocalization.h" />
<ClInclude Include="..\CloudsLibrary\src\RGBD\BackgroundParticles\VoxelMesh.h" />
<ClInclude Include="..\CloudsLibrary\src\RGBD\CloudsRGBDPointLayer.h" />
<ClInclude Include="..\CloudsLibrary\src\RGBD\CloudsVisualSystemRGBD.h" />
Expand Down
6 changes: 6 additions & 0 deletions libRGBD/RGBD.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
<ClCompile Include="..\CloudsLibrary\src\RGBD\BackgroundParticles\VoxelMesh.cpp">
<Filter>CloudsLibrary\src\RGBD\BackgroundParticles</Filter>
</ClCompile>
<ClCompile Include="..\CloudsLibrary\src\CloudsLocalization.cpp">
<Filter>CloudsLibrary\src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\CloudsLibrary\src\RGBD\CloudsRGBDPointLayer.h">
Expand Down Expand Up @@ -125,5 +128,8 @@
<ClInclude Include="..\CloudsLibrary\src\RGBD\BackgroundParticles\VoxelMesh.h">
<Filter>CloudsLibrary\src\RGBD\BackgroundParticles</Filter>
</ClInclude>
<ClInclude Include="..\CloudsLibrary\src\CloudsLocalization.h">
<Filter>CloudsLibrary\src</Filter>
</ClInclude>
</ItemGroup>
</Project>

0 comments on commit 143e15b

Please sign in to comment.