Houdini18 HDK Offline Test

Posted gearslogy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Houdini18 HDK Offline Test相关的知识,希望对你有一定的参考价值。

技术图片
cmake_minimum_required(VERSION 3.5)

project(Triangle)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# OPENGL
find_package(OpenGL REQUIRED)
include_directories(${OpenGL_INCLUDE_DIRS})
link_directories(${OpenGL_LIBRARY_DIRS})
add_definitions(${OpenGL_DEFINITIONS})

if(NOT OPENGL_FOUND)
    message(ERROR " OPENGL not found!")
endif(NOT OPENGL_FOUND)

# GLEW
set(GLEW_HOME D:/plugin_dev/libs/glew-2.1.0)
include_directories(${GLEW_HOME}/include)
link_directories(${GLEW_HOME}/lib/Release/x64)

# GLFW
set(GLFW_HOME D:/plugin_dev/libs/glfw-3.3.1.bin.WIN64)
include_directories(${GLFW_HOME}/include/)
link_directories(${GLFW_HOME}/lib-vc2019)

# STB
include_directories(D:/plugin_dev/libs/stb)

# GLM
include_directories(D:/plugin_dev/libs/GLM_include)




# ---------------- HOUDINI
if (MSVC)
    # Prevent Boost auto-linking.
    add_definitions(-DBOOST_ALL_NO_LIB )
    add_definitions(-D_SCL_SECURE_NO_WARNINGS
            -D_CRT_SECURE_NO_WARNINGS
            -D_WIN32
            -D_WINSOCK_DEPRECATED_NO_WARNINGS
            -D__x86_64__)

    # HOUDINI :
    add_definitions(-TP
            -Zc:forScope
            -DVERSION="18.0.348"
            -DI386
            -DWIN32
            -DSWAP_BITFIELDS

            -DWINVER=0x0501
            -DNOMINMAX
            -DSTRICT
            -DWIN32_LEAN_AND_MEAN
            -D_USE_MATH_DEFINES
            -D_CRT_SECURE_NO_DEPRECATE
            -D_CRT_NONSTDC_NO_DEPRECATE
            -D_SCL_SECURE_NO_WARNINGS
            -DSESI_LITTLE_ENDIAN
            -DHBOOST_ALL_NO_LIB
            -DEIGEN_MALLOC_ALREADY_ALIGNED=0
            -DFBX_ENABLED=1
            -DOPENCL_ENABLED=1
            -DOPENVDB_ENABLED=1
            -MD
            -EHsc
            -GR
            -DNEED_SPECIALIZATION_STORAGE
            -DAMD64
            -DSIZEOF_VOID_P=8)

endif()


set(HOUDINI_HOME "D:/Program Files/Side Effects Software/Houdini 18.0.348")
include_directories("${HOUDINI_HOME}/toolkit/include")
link_directories("${HOUDINI_HOME}/custom/houdini/dsolib")





# output excutable dir
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build)


# SRC FILE
FILE(
    GLOB
    SRC
    *.cpp *.h
    )

add_executable(Triangle ${SRC})



target_link_libraries(Triangle
    PRIVATE
    libGA.lib
    libGU.lib
    libUT.lib
    libCE.lib
    libLM.lib
    libFS.lib
    libSYS.lib
    libGEO.lib

    )
CMakeLists

HDK Geometry Struct:

技术图片

 

 

Houdini Geometry responsed to this figure:

技术图片

 

 

1, get GLDraw info from this code:

技术图片
#include <GU/GU_Detail.h>
#include <GEO/GEO_Primitive.h>
#include <GEO/GEO_PrimPoly.h>
#include <GA/GA_Primitive.h>
#include <GA/GA_Iterator.h>
#include <iostream>


using namespace std;


int main(){
    GU_Detail gdp;
    gdp.load("geos/box.bgeo");

    cout << "Numpoints:"<<gdp.getNumPoints() <<endl;
    cout << "NumVerticles" << gdp.getNumVertices() << endl;
    cout << "NumFace:" << gdp.getNumPrimitives() << endl;

    // LOOP All face, cout this vertex count
    GEO_Primitive *geoPrim;
    GA_FOR_ALL_PRIMITIVES(&gdp,geoPrim){
         int faceCount = geoPrim->getVertexCount() ;// per face have 3 point


    }

    cout << "------------------ Iterator Face ID & Per face point ID, this can used  GL_DRAW_ELMENTS()----------------
";
    GA_Iterator primIter(gdp.getPrimitiveRange());
    fpreal start_primtive_num = *primIter;
    cout << "START primtive num:" << start_primtive_num << endl;


    // loop the face(prim)
    for (;!primIter.atEnd();++primIter) {
        GA_Primitive *prim = gdp.getPrimitive(*primIter);


        // iterator face points
        cout <<"this face id :" << *primIter <<"->have vertex count:" <<prim->getVertexCount() << endl;
        GA_Iterator pointIter(prim->getPointRange());
        for(;!pointIter.atEnd();++pointIter){
            cout <<"share point id:" <<*pointIter << endl;
        }

    }


    cout << "------------------  access points Iterator directly not opengl draw indcices----------------
";
    // Loop the point, direct access the point , not prim vertex shared point
    GA_Iterator pointIter(gdp.getPointRange());
    while(!pointIter.atEnd()){

        int pointNum = *pointIter ;
        GA_Index pointIndex = gdp.pointIndex(*pointIter);
        GA_Offset pointOffset = gdp.pointOffset(pointIndex);

        cout <<"Lookup -> Point id:" <<*pointIter << " Point Index:" << pointIndex
            << " Point offset:" << pointOffset
            << endl;

        GA_OffsetArray orry;
        gdp.getVerticesReferencingPoint(orry,pointOffset);
        cout <<"And this point have "<< orry.size() << " verticles, and the vertex number:" ;
        for(auto &of: orry){
            cout << of << " ";
        }
        cout << endl;
        ++pointIter;
    }







    cin.get();
    return 0;

}
main.cpp

技术图片

 

The GA_Primitive class is a base class, GEO manipulate 3d  Geometry further .

技术图片

 

以上是关于Houdini18 HDK Offline Test的主要内容,如果未能解决你的问题,请参考以下文章

Houdini18.0.416 Install On CentOS8/Linux

Android-X86集成houdini(Arm兼容工具)

houdini 使用HDA Processor 实现处理HDA输入输出

houdini_help_linuxos:在浏览器上查看帮助文档的配置方法

Houdini技术体系 基础管线 : Houdini与Houdini Engine的安装

houdini copy怎么输出zip文件