Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
H3D.org Feeds


Browsing this Thread:   1 Anonymous Users






Custom VHTK Rendering Node
#1
Not too shy to talk
Not too shy to talk


See User information
Hey forum,

I want to leverage the features of the VHTK in my own program. Thanks to the kind tutaledge of Markus and KJ, I've established that the easiest way of making this work is to create my own render node in H3DAPI. The following milestones must be achieved:

1. Compile and execute a simple Node.

2. Get the node to exhibit some form of functionality.

3. Exhibit Render functionality

4. Combine the rendered data with some VHTK functionality

5. Profit!

However - Nothing is ever that simple. Right now I cannot even get to my first milestone. I've stolen some code from the Wiki which gives a simple example of creating a node.

Header file:

#ifndef __MYRENDERERNODE_H__
#define __MYRENDERERNODE_H__
 
// Include needed files here
#include <H3D/X3D.h>
 
namespace H3D {
  class 
myRendererNode: public BaseClass{
  public:
    
myRendererNodeInstFieldType >  _myFieldName 0);
 
    
// public virtual functions goes here
 
    // Fields are specified like this. Where FieldType is one of the types for fields.
    // these are all defined in the files which names start wit "SF" or "MF"
    
auto_ptrFieldType >  myFieldName;
 
    
/// The H3DNodeDatabase for this node.
    
static H3DNodeDatabase database;
 
  protected:
    
// protected virtual functions goes here.
  
};
}

#endif


CPP file:

#include "myRendererNode.h"
#include <H3D/X3D.h>
#include <H3D/X3DNode.h>

using namespace H3D;
 
// The second argument is NULL if this class is abstract.
H3DNodeDatabase X3DNode::database"myRendererNode",
                                   &(
newInstance<NodeTemplate>),
                                   
typeidNodeTemplate),
                                   &
BaseClass::database );
 
namespace 
X3DNodeInternals {
  
// The third argument is one of INPUT_OUTPUT, OUTPUT_ONLY or INPUT_ONLY.
  
FIELDDB_ELEMENTNodeTemplatemyFieldNameINPUT_OUTPUT );
}
 
myRendererNode::myRendererNode
                 
InstFieldType >  _myFieldName):
  
myFieldName_myFieldName) {
 
  
type_name "NodeTemplate";
  
database.initFieldsthis );
}
 
// other functions


As far as I can tell "BaseClass" doesn't exist and should be replaced by the best fit parent class. I want to build a class that renders volumetric data. Does anyone know which class would be well suited to inherit from? I assume it would be one within the VHTK.

Regards,
Lasse

Posted on: 2011/2/28 13:04
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Custom VHTK Rendering Node
#2
Guru
Guru


See User information
The volume renderer in VHTK has the following definition
class VOLUMEHAPTICS_API VolumeRenderer :
    public 
H3D::X3DChildNode,
    public 
H3D::H3DDisplayListObject,
    public 
H3D::X3DBoundedObject {

The first will make it placeable in the scenegraph, the second makes it renderable and the final makes it update the near/far planes of the rendering.

I believe there is a Wiki tutorial on how to create a node that renders things but that might be a geometry node.

Posted on: 2011/2/28 15:34
KJ Lundin Palmerius
C Research
Linköping University, Sweden
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top







You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create pdf.
You cannot get print page.

[Advanced Search]





(C) 2012 SenseGraphics AB    ---    Powered by XOOPS