Commit 28d89993 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kitware Robot

Merge topic 'move-webgl-exporter'

4094f5a9 Fix some WebGL warnings
4e6ed2fb remove comment that says the exporter is a plugin
3b73caf2 bug: don't compute magnitude for single component values
e93141e5 add wrapper friendly api for accessing binary data in vtkWebGLObject
2e14e2a1 change enum type to int so that method is available to wrapped languages
e1670d73 move WebGLExporter from plugin to VTKExtensions module
parents b76c22a3 4094f5a9
......@@ -419,6 +419,7 @@ else()
ParaViewCore/VTKExtensions/Core
ParaViewCore/VTKExtensions/Rendering
ParaViewCore/VTKExtensions/Default
ParaViewCore/VTKExtensions/WebGLExporter
ParaViewCore/ClientServerCore/Core
ParaViewCore/ClientServerCore/Rendering
ParaViewCore/ClientServerCore/Default
......
......@@ -11,6 +11,7 @@ vtk_module(vtkPVClientServerCoreRendering
vtkFiltersAMR
vtkPVClientServerCoreCore
vtkPVVTKExtensionsRendering
vtkPVVTKExtensionsWebGLExporter
vtkRenderingLabel
vtkRenderingVolumeAMR
vtkRenderingVolumeOpenGL
......
......@@ -2433,6 +2433,16 @@
</IntVectorProperty>
<!-- End of GL2PSExporterSVG -->
</GL2PSExporterProxy>
<RenderViewExporterProxy name="WebGLExporter" class="vtkPVWebGLExporter"
file_extension="webgl">
<StringVectorProperty name="FileName" command="SetFileName"
number_of_elements="1">
<Documentation>Name of the file to write into</Documentation>
</StringVectorProperty>
<!-- End of WebGLExporter -->
</RenderViewExporterProxy>
<!-- End of "exporters" -->
</ProxyGroup>
<ProxyGroup name="point_placers">
......
#==========================================================================
#
# Program: ParaView
#
# Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
# All rights reserved.
#
# ParaView is a free software; you can redistribute it and/or modify it
# under the terms of the ParaView license version 1.2.
#
# See License_v1.2.txt for the full ParaView license.
# A copy of this license can be obtained by contacting
# Kitware Inc.
# 28 Corporate Drive
# Clifton Park, NY 12065
# USA
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#==========================================================================
#
# The exporter will behave as any other ParaView exporter (VRML, X3D, POV...)
# but will generate several types of files. The main one is the scene graph
# description define as a JSON object with all the corresponding binary+base64
# pieces that come along with it. But also with it come a single standalone HTML
# file that can directly be used to see the data in a browser without any plugin.
#
# This code base should be cleaned up to follow VTK standard and even be
# integrated into VTK itself. But for now it is provided as is.
set(Module_SRCS
vtkPVWebGLExporter.cxx
vtkWebGLDataSet.cxx
vtkWebGLExporter.cxx
vtkWebGLObject.cxx
vtkWebGLPolyData.cxx
vtkWebGLWidget.cxx
md5.cxx
)
set_source_files_properties(md5.cxx WRAP_EXCLUDE)
set(JAVASCRIPT_SRCS
webglRenderer
glMatrix
)
foreach(file ${JAVASCRIPT_SRCS})
set(src ${CMAKE_CURRENT_SOURCE_DIR}/${file}.js)
set(res ${CMAKE_CURRENT_BINARY_DIR}/${file}.h)
add_custom_command(
OUTPUT ${res}
DEPENDS ${src}
COMMAND vtkEncodeString
ARGS ${res} ${src} ${file}
)
list(APPEND Module_SRCS ${res})
set_source_files_properties(${res} WRAP_EXCLUDE)
endforeach()
vtk_module_library(vtkPVVTKExtensionsWebGLExporter ${Module_SRCS})
vtk_module(vtkPVVTKExtensionsWebGLExporter
GROUPS
ParaViewRendering
DEPENDS
vtkIOExport
vtkInteractionWidgets
vtkRenderingCore
COMPILE_DEPENDS
vtkUtilitiesEncodeString
)
......@@ -76,7 +76,7 @@ void vtkPVWebGLExporter::WriteData()
vtkErrorMacro(<< "unable to open JSON MetaData file " << metadatFile.c_str());
return;
}
fprintf(fp,"%s",exporter->GenerateMetadata());
fputs(exporter->GenerateMetadata(), fp);
fclose(fp);
// Write binary objects
......
......@@ -16,8 +16,9 @@
#define __vtkPVWebGLExporter_h
#include "vtkExporter.h"
#include "vtkPVVTKExtensionsWebGLExporterModule.h" // needed for export macro
class vtkPVWebGLExporter : public vtkExporter
class VTKPVVTKEXTENSIONSWEBGLEXPORTER_EXPORT vtkPVWebGLExporter : public vtkExporter
{
public:
static vtkPVWebGLExporter *New();
......@@ -36,10 +37,10 @@ protected:
void WriteData();
char *FileName;
private:
vtkPVWebGLExporter(const vtkPVWebGLExporter&); // Not implemented.
void operator=(const vtkPVWebGLExporter&); // Not implemented.
};
#endif
......@@ -237,4 +237,3 @@ void vtkWebGLDataSet::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
}
......@@ -21,16 +21,17 @@
#include "vtkObject.h"
#include "vtkWebGLObject.h"
#include "vtkPVVTKExtensionsWebGLExporterModule.h" // needed for export macro
#include <string>
class vtkWebGLDataSet : public vtkObject
{
class VTKPVVTKEXTENSIONSWEBGLEXPORTER_EXPORT vtkWebGLDataSet : public vtkObject
{
public:
static vtkWebGLDataSet* New();
vtkTypeMacro(vtkWebGLDataSet, vtkObject)
void PrintSelf(ostream &os, vtkIndent indent);
//BTX
void SetVertices(float* v, int size);
void SetIndexes(short* i, int size);
void SetNormals(float* n);
......@@ -44,7 +45,10 @@ public:
int GetBinarySize();
void GenerateBinaryData();
bool HasChanged();
//BTX
std::string GetMD5();
//ETX
protected:
vtkWebGLDataSet();
......@@ -70,7 +74,6 @@ protected:
private:
vtkWebGLDataSet(const vtkWebGLDataSet&); // Not implemented
void operator=(const vtkWebGLDataSet&); // Not implemented
//ETX
};
};
#endif
......@@ -172,7 +172,7 @@ void vtkWebGLExporter::parseActor2D(vtkActor2D *actor, long actorTime, long rend
vtkScalarBarActor* scalarbar = vtkScalarBarActor::SafeDownCast(actor);
long dataMTime = actor->GetMTime() + actor->GetRedrawMTime() + actor->GetProperty()->GetMTime();
dataMTime += (bool)actor->GetMapper();
dataMTime += (long)actor->GetMapper();
if (scalarbar) dataMTime += scalarbar->GetLookupTable()->GetMTime();
if (dataMTime != actorTime && actor->GetVisibility())
{
......@@ -198,7 +198,7 @@ void vtkWebGLExporter::parseActor2D(vtkActor2D *actor, long actorTime, long rend
obj->SetRendererId(renderId);
this->Internal->Objects.push_back(obj);
obj->SetLayer(layer);
obj->SetVisibility(actor->GetVisibility());
obj->SetVisibility(actor->GetVisibility() != 0);
obj->SetIsWidget(isWidget);
obj->SetInteractAtServer(false);
obj->GenerateBinaryData();
......@@ -216,7 +216,7 @@ void vtkWebGLExporter::parseActor2D(vtkActor2D *actor, long actorTime, long rend
{
vtkWebGLObject* obj = this->Internal->tempObj[i];
this->Internal->tempObj.erase(this->Internal->tempObj.begin()+i);
obj->SetVisibility(actor->GetVisibility());
obj->SetVisibility(actor->GetVisibility() != 0);
this->Internal->Objects.push_back(obj);
}
}
......@@ -283,8 +283,8 @@ void vtkWebGLExporter::parseActor(vtkActor* actor, unsigned long actorTime, long
this->Internal->Objects.push_back(newobj);
newobj->SetLayer(layer);
newobj->SetTransformationMatrix(actor->GetMatrix());
newobj->SetVisibility(actor->GetVisibility());
newobj->SetHasTransparency(actor->HasTranslucentPolygonalGeometry());
newobj->SetVisibility(actor->GetVisibility() != 0);
newobj->SetHasTransparency(actor->HasTranslucentPolygonalGeometry() != 0);
newobj->SetIsWidget(isWidget);
newobj->SetInteractAtServer(isWidget);
newobj->GenerateBinaryData();
......@@ -309,8 +309,8 @@ void vtkWebGLExporter::parseActor(vtkActor* actor, unsigned long actorTime, long
this->Internal->Objects.push_back(obj);
obj->SetLayer(layer);
obj->SetTransformationMatrix(actor->GetMatrix());
obj->SetVisibility(actor->GetVisibility());
obj->SetHasTransparency(actor->HasTranslucentPolygonalGeometry());
obj->SetVisibility(actor->GetVisibility() != 0);
obj->SetHasTransparency(actor->HasTranslucentPolygonalGeometry() != 0);
obj->SetIsWidget(isWidget);
obj->SetInteractAtServer(isWidget);
obj->GenerateBinaryData();
......@@ -323,8 +323,8 @@ void vtkWebGLExporter::parseActor(vtkActor* actor, unsigned long actorTime, long
this->Internal->Objects.push_back(obj);
obj->SetLayer(layer);
obj->SetTransformationMatrix(actor->GetMatrix());
obj->SetVisibility(actor->GetVisibility());
obj->SetHasTransparency(actor->HasTranslucentPolygonalGeometry());
obj->SetVisibility(actor->GetVisibility() != 0);
obj->SetHasTransparency(actor->HasTranslucentPolygonalGeometry() != 0);
obj->SetIsWidget(isWidget);
obj->SetInteractAtServer(isWidget);
obj->GenerateBinaryData();
......@@ -337,8 +337,8 @@ void vtkWebGLExporter::parseActor(vtkActor* actor, unsigned long actorTime, long
this->Internal->Objects.push_back(obj);
obj->SetLayer(layer);
obj->SetTransformationMatrix(actor->GetMatrix());
obj->SetVisibility(actor->GetVisibility());
obj->SetHasTransparency(actor->HasTranslucentPolygonalGeometry());
obj->SetVisibility(actor->GetVisibility() != 0);
obj->SetHasTransparency(actor->HasTranslucentPolygonalGeometry() != 0);
obj->SetIsWidget(false);
obj->SetInteractAtServer(false);
obj->GenerateBinaryData();
......@@ -354,8 +354,8 @@ void vtkWebGLExporter::parseActor(vtkActor* actor, unsigned long actorTime, long
this->Internal->Objects.push_back(obj);
obj->SetLayer(layer);
obj->SetTransformationMatrix(actor->GetMatrix());
obj->SetVisibility(actor->GetVisibility());
obj->SetHasTransparency(actor->HasTranslucentPolygonalGeometry());
obj->SetVisibility(actor->GetVisibility() != 0);
obj->SetHasTransparency(actor->HasTranslucentPolygonalGeometry() != 0);
obj->SetIsWidget(isWidget);
obj->SetInteractAtServer(isWidget);
obj->GenerateBinaryData();
......@@ -377,7 +377,7 @@ void vtkWebGLExporter::parseActor(vtkActor* actor, unsigned long actorTime, long
{
vtkWebGLObject* obj = this->Internal->tempObj[i];
this->Internal->tempObj.erase(this->Internal->tempObj.begin()+i);
obj->SetVisibility(actor->GetVisibility());
obj->SetVisibility(actor->GetVisibility() != 0);
this->Internal->Objects.push_back(obj);
}
}
......@@ -385,11 +385,11 @@ void vtkWebGLExporter::parseActor(vtkActor* actor, unsigned long actorTime, long
}
}
void vtkWebGLExporter::parseScene(vtkRendererCollection* renderers, const char* viewId, VTKParseType property)
void vtkWebGLExporter::parseScene(vtkRendererCollection* renderers, const char* viewId, int parseType)
{
if (!renderers) return;
bool onlyWidget = property == VTK_ONLYWIDGET;
bool onlyWidget = parseType == VTK_ONLYWIDGET;
bool cameraOnly = onlyWidget && !this->hasWidget;
this->SceneId = viewId;
......@@ -401,7 +401,7 @@ void vtkWebGLExporter::parseScene(vtkRendererCollection* renderers, const char*
if (onlyWidget)
{
for (int i=this->Internal->Objects.size()-1; i>=0; i--)
for (int i= static_cast<int>(this->Internal->Objects.size())-1; i>=0; i--)
{
vtkWebGLObject* obj = this->Internal->Objects[i];
if (obj->InteractAtServer())
......@@ -610,7 +610,7 @@ vtkWebGLObject* vtkWebGLExporter::GetObject(int index)
int vtkWebGLExporter::GetNumberOfObjects()
{
return this->Internal->Objects.size();
return static_cast<int>(this->Internal->Objects.size());
}
void vtkWebGLExporter::PrintSelf(ostream& os, vtkIndent indent)
......
......@@ -32,27 +32,27 @@ class vtkWebGLObject;
class vtkWebGLPolyData;
#include "vtkObject.h"
#include "vtkPVVTKExtensionsWebGLExporterModule.h" // needed for export macro
#include <map>
#include <string>
//BTX
typedef enum {
VTK_ONLYCAMERA = 0,
VTK_ONLYWIDGET = 1,
VTK_PARSEALL = 2
} VTKParseType;
//ETX
class vtkWebGLExporter : public vtkObject
class VTKPVVTKEXTENSIONSWEBGLEXPORTER_EXPORT vtkWebGLExporter : public vtkObject
{
public:
static vtkWebGLExporter* New();
vtkTypeMacro(vtkWebGLExporter, vtkObject)
void PrintSelf(ostream& os, vtkIndent indent);
//BTX
// Description:
// Get all the needed information from the vtkRenderer
void parseScene(vtkRendererCollection* renderers, const char* viewId, VTKParseType property);
void parseScene(vtkRendererCollection* renderers, const char* viewId, int parseType);
// Generate and return the Metadata
void exportStaticScene(vtkRendererCollection* renderers, int width, int height, std::string path);
const char* GenerateMetadata();
......@@ -93,9 +93,8 @@ private:
vtkWebGLExporter(const vtkWebGLExporter&); // Not implemented
void operator=(const vtkWebGLExporter&); // Not implemented
class vtkInternal;
vtkInternal* Internal;
//ETX
class vtkInternal;
vtkInternal* Internal;
};
#endif
......@@ -17,6 +17,7 @@
#include "vtkMatrix4x4.h"
#include "vtkObjectFactory.h"
#include "vtkUnsignedCharArray.h"
#include <algorithm>
#include "md5.h"
......@@ -145,6 +146,26 @@ void vtkWebGLObject::SetInteractAtServer(bool i)
this->interactAtServer = i;
}
void vtkWebGLObject::GetBinaryData(int part, vtkUnsignedCharArray* buffer)
{
if (!buffer)
{
vtkErrorMacro("Buffer must not be NULL.");
return;
}
const int binarySize = this->GetBinarySize(part);
const unsigned char* binaryData = this->GetBinaryData(part);
buffer->SetNumberOfComponents(1);
buffer->SetNumberOfTuples(binarySize);
if (binarySize)
{
std::copy(binaryData, binaryData+binarySize, buffer->GetPointer(0));
}
}
void vtkWebGLObject::GenerateBinaryData(){this->hasChanged = false;}
unsigned char* vtkWebGLObject::GetBinaryData(int vtkNotUsed(part)){return NULL;}
int vtkWebGLObject::GetBinarySize(int vtkNotUsed(part)){return 0;}
......
......@@ -19,20 +19,21 @@
#ifndef __vtkWebGLObject_h
#define __vtkWebGLObject_h
class vtkMatrix4x4;
#include "vtkObject.h"
#include "vtkPVVTKExtensionsWebGLExporterModule.h" // needed for export macro
#include <string>
//BTX
class vtkMatrix4x4;
class vtkUnsignedCharArray;
enum WebGLObjectTypes {
wPOINTS = 0,
wLINES = 1,
wTRIANGLES = 2
};
//ETX
class vtkWebGLObject : public vtkObject
class VTKPVVTKEXTENSIONSWEBGLEXPORTER_EXPORT vtkWebGLObject : public vtkObject
{
public:
static vtkWebGLObject* New();
......@@ -43,7 +44,13 @@ public:
virtual unsigned char* GetBinaryData(int part);
virtual int GetBinarySize(int part);
virtual int GetNumberOfParts();
//BTX
// Description:
// This is a wrapper friendly method for access the binary data.
// The binary data for the requested part will be copied into the
// given vtkUnsignedCharArray.
void GetBinaryData(int part, vtkUnsignedCharArray* buffer);
void SetLayer(int l);
void SetRendererId(long int i);
void SetId(std::string i);
......@@ -60,8 +67,10 @@ public:
bool isWidget();
bool HasTransparency();
bool InteractAtServer();
//BTX
std::string GetMD5();
std::string GetId();
//ETX
long int GetRendererId();
int GetLayer();
......@@ -85,10 +94,6 @@ protected:
private:
vtkWebGLObject(const vtkWebGLObject&); // Not implemented
void operator=(const vtkWebGLObject&); // Not implemented
// class vtkInternal;
// vtkInternal* Internal;
//ETX
};
#endif
......@@ -277,7 +277,7 @@ void vtkWebGLPolyData::GenerateBinaryData()
}
if(this->Internal->Parts.size() != 0)
{
std::string localMD5 = md5((char*)ss.str().c_str(), ss.str().size());
std::string localMD5 = md5((char*)ss.str().c_str(), static_cast<int>(ss.str().size()));
this->hasChanged = this->MD5.compare(localMD5) != 0;
this->MD5 = localMD5;
}
......@@ -286,7 +286,7 @@ void vtkWebGLPolyData::GenerateBinaryData()
int vtkWebGLPolyData::GetNumberOfParts()
{
return this->Internal->Parts.size();
return static_cast<int>(this->Internal->Parts.size());
}
void vtkWebGLPolyData::PrintSelf(ostream& os, vtkIndent indent)
......@@ -662,6 +662,12 @@ void vtkWebGLPolyData::GetColorsFromPointData(unsigned char* color, vtkPointData
int mode = table->GetVectorMode();
double mag=0, rgb[3];
double alpha = 1.0;
if (numberOfComponents == 1 && mode == vtkScalarsToColors::MAGNITUDE)
{
mode = vtkScalarsToColors::COMPONENT;
colorComponent = 0;
}
for (int i=0; i<colorSize/4; i++)
{
switch(mode)
......
......@@ -20,6 +20,8 @@
#define __vtkWebGLPolyData_h
#include "vtkWebGLObject.h"
#include "vtkPVVTKExtensionsWebGLExporterModule.h" // needed for export macro
class vtkActor;
class vtkMatrix4x4;
class vtkMapper;
......@@ -27,7 +29,7 @@ class vtkPointData;
class vtkPolyData;
class vtkTriangleFilter;
class vtkWebGLPolyData : public vtkWebGLObject
class VTKPVVTKEXTENSIONSWEBGLEXPORTER_EXPORT vtkWebGLPolyData : public vtkWebGLObject
{
public:
static vtkWebGLPolyData* New();
......@@ -39,14 +41,12 @@ public:
int GetBinarySize(int part);
int GetNumberOfParts();
//BTX
void GetPoints(vtkTriangleFilter* polydata, vtkActor* actor, int maxSize);
//
void GetLinesFromPolygon(vtkMapper* mapper, vtkActor* actor, int lineMaxSize, double* edgeColor);
void GetLines(vtkTriangleFilter* polydata, vtkActor* actor, int lineMaxSize);
void GetColorsFromPolyData(unsigned char* color, vtkPolyData* polydata, vtkActor* actor);
//
//vtkTriangleFilter* GetPolyData(vtkMapper* mapper, unsigned long& dataMTime);
// Get following data from the actor
void GetPolygonsFromPointData(vtkTriangleFilter* polydata, vtkActor* actor, int maxSize);
void GetPolygonsFromCellData(vtkTriangleFilter* polydata, vtkActor* actor, int maxSize);
......@@ -58,8 +58,8 @@ public:
void SetTransformationMatrix(vtkMatrix4x4* m);
protected:
vtkWebGLPolyData();
~vtkWebGLPolyData();
vtkWebGLPolyData();
~vtkWebGLPolyData();
private:
vtkWebGLPolyData(const vtkWebGLPolyData&); // Not implemented
......@@ -69,7 +69,6 @@ private:
class vtkInternal;
vtkInternal* Internal;
//ETX
};
#endif
......@@ -65,12 +65,12 @@ void vtkWebGLWidget::GenerateBinaryData()
std::string oldMD5 = "qqehissorapaz";
oldMD5 = this->MD5;
int pos = 0;
size_t pos = 0;
//Calculate the size used
//NumOfColors, Type, Position, Size, Colors, Orientation, numberOfLabels
int total = sizeof(int) + 1 + 4*sizeof(float) + this->colors.size()*(sizeof(float)+3*sizeof(char)) + 1 + 1 + strlen(this->title);
int total = static_cast<int>(sizeof(int) + 1 + 4*sizeof(float) + this->colors.size()*(sizeof(float)+3*sizeof(char)) + 1 + 1 + strlen(this->title));
this->binaryData = new unsigned char[total];
int colorSize = this->colors.size();
int colorSize = static_cast<int>(this->colors.size());
memset(this->binaryData, 0, total); //Fill array with 0
memcpy(&this->binaryData[pos], &colorSize, sizeof(int)); pos+=sizeof(int); //Binary Data Size
......@@ -113,7 +113,7 @@ void vtkWebGLWidget::GetDataFromColorMap(vtkActor2D *actor)
vtkScalarBarActor* scalarbar = vtkScalarBarActor::SafeDownCast(actor);
this->numberOfLabels = scalarbar->GetNumberOfLabels();
this->title = scalarbar->GetTitle();
this->hasTransparency = scalarbar->GetUseOpacity();
this->hasTransparency = (scalarbar->GetUseOpacity() != 0);
this->orientation = scalarbar->GetOrientation();
//Colors
......
......@@ -20,11 +20,13 @@
#define __vtkWebGLWidget_h
#include "vtkWebGLObject.h"
#include "vtkPVVTKExtensionsWebGLExporterModule.h" // needed for export macro
#include <vector>
class vtkActor2D;
class vtkWebGLWidget : public vtkWebGLObject
class VTKPVVTKEXTENSIONSWEBGLEXPORTER_EXPORT vtkWebGLWidget : public vtkWebGLObject
{
public:
static vtkWebGLWidget* New();
......@@ -38,7 +40,6 @@ public:
void GetDataFromColorMap(vtkActor2D* actor);
//BTX
protected:
vtkWebGLWidget();
~vtkWebGLWidget();
......@@ -58,7 +59,6 @@ private:
vtkWebGLWidget(const vtkWebGLWidget&); // Not implemented
void operator=(const vtkWebGLWidget&); // Not implemented
//ETX
};
#endif
......@@ -250,7 +250,7 @@ WebGLRenderer.prototype.start = function(metadata, objects) {
this.ctx2d = document.getElementById(this.canvasName + "Widget").getContext('2d');
// Set up to draw the scene periodically.
this.drawInterval = requestAnimFrame(new Function("webglRenderers['" + this.view.id + "'].drawScene();"));
if (!this.offlineMode){
this.requestMetaData();
this.updateCamera();
......@@ -951,9 +951,9 @@ WebGLRenderer.prototype.setMatrixUniforms = function(s) {
WebGLRenderer.prototype.processObject = function() {
if (this.processQueue.length != 0){
obj = this.processQueue[this.processQueue.length-1];
this.processQueue.length -= 1;
this.parseObject(obj);
obj = this.processQueue[this.processQueue.length-1];
this.processQueue.length -= 1;
this.parseObject(obj);
}
}
......
......@@ -193,7 +193,7 @@ void vtkPieceList::Serialize()
<< mine.ViewPriority << " "
<< mine.CachedPriority << " ";
}
int len = strlen(temp.str().c_str());
int len = static_cast<int>(strlen(temp.str().c_str()));
this->Internals->SerializeBuffer = new char[len+10];
strcpy(this->Internals->SerializeBuffer, temp.str().c_str());
this->Internals->BufferSize = len;
......
# This plugin bring the ParaViewWeb WebGL exporter to regular ParaView
# as a plugin.
# That plugin will behave as any other ParaView exporter (VRML, X3D, POV...)
# but will generate several types of files. The main one is the scene graph
# description define as a JSON object with all the corresponding binary+base64
# pieces that come along with it. But also with it come a single standalone HTML
# file that can directly be used to see the data in a browser without any plugin.
#
# This code base should be cleaned up to follow VTK standard and even be
# integrated into VTK itself. But for now it is provided as is.
SET(PLUGIN_NAME WebGLExporter)
SET(PLUGIN_VERSION "1.0")
INCLUDE_DIRECTORIES(
${PARAVIEW_INCLUDE_DIRS}
${VTK_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
)
# ----------------------------------------------------------------------------
# Generate C++ header file that will embed the JavaScript content
# ----------------------------------------------------------------------------
SET(JAVASCRIPT_SRCS
webglRenderer
glMatrix
)
foreach(file ${JAVASCRIPT_SRCS})
set(src ${CMAKE_CURRENT_SOURCE_DIR}/${file}.js)
set(res ${CMAKE_CURRENT_BINARY_DIR}/${file}.h)
add_custom_command(
OUTPUT ${res}
DEPENDS ${src}
COMMAND vtkEncodeString
ARGS ${res} ${src} ${file}
)
set(EXTRA_SRCS ${EXTRA_SRCS} ${res})
endforeach(file)
# ----------------------------------------------------------------------------
# Generate ParaView plugin
# ----------------------------------------------------------------------------
ADD_PARAVIEW_PLUGIN(WebGLExporter "1.0"
SERVER_MANAGER_XML
WebglExporter.xml
SERVER_MANAGER_SOURCES
vtkPVWebGLExporter.cxx
vtkWebGLDataSet.cxx
vtkWebGLExporter.cxx
vtkWebGLObject.cxx
vtkWebGLPolyData.cxx
vtkWebGLWidget.cxx
SOURCES
md5.cxx
${EXTRA_SRCS}
)
<ServerManagerConfiguration>
<ProxyGroup name="exporters">
<RenderViewExporterProxy name="WebGLExporter" class="vtkPVWebGLExporter"<