码迷,mamicode.com
首页 > 其他好文 > 详细

Houdini18 HDK Offline Test

时间:2020-04-30 15:40:50      阅读:98      评论:0      收藏:0      [点我收藏+]

标签:already   err   index   range   --   soft   ace   director   ref   

技术图片
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()----------------\n";
    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----------------\n";
    // 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

标签:already   err   index   range   --   soft   ace   director   ref   

原文地址:https://www.cnblogs.com/gearslogy/p/12808723.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!