Exemplo n.º 1
0
    //[ MenuItem( HoudiniConstants.HAPI_PRODUCT_NAME + "/Create Simple Input Geo", false, 1000 ) ]
    static private void createSimpleInputGeo()
    {
        int asset_id = HoudiniHost.createInputNode("simple_input_geo_test");

        HoudiniHost.cookNode(
            asset_id,
            HoudiniHost.prSplitGeosByGroup,
            HoudiniHost.prSplitPointsByVertexAttributes,
            HoudiniHost.prImportTemplatedGeos);

        HAPI_PartInfo new_part = new HAPI_PartInfo();

        new_part.vertexCount = 3;
        new_part.pointCount  = 3;
        new_part.faceCount   = 1;
        new_part.type        = HAPI_PartType.HAPI_PARTTYPE_MESH;
        HoudiniHost.setPartInfo(0, 0, ref new_part);

        HAPI_AttributeInfo attrib_info = new HAPI_AttributeInfo("P");

        attrib_info.exists    = true;
        attrib_info.count     = 3;     // 3 points
        attrib_info.tupleSize = 3;     // 3 floats per point (x, y, z)
        attrib_info.owner     = HAPI_AttributeOwner.HAPI_ATTROWNER_POINT;
        attrib_info.storage   = HAPI_StorageType.HAPI_STORAGETYPE_FLOAT;
        HoudiniHost.addAttribute(0, 0, "P", ref attrib_info);

        float[] positions = new float[9] {
            0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f
        };
        HoudiniHost.setAttributeFloatData(0, 0, "P", ref attrib_info, positions, 0, 3);

        int[] vertices = new int[3] {
            0, 1, 2
        };
        HoudiniHost.setVertexList(0, 0, vertices, 0, 3);

        int[] face_counts = new int[1] {
            3
        };                                              // 3 edges for the first face (the only face)
        HoudiniHost.setFaceCounts(0, 0, face_counts, 0, 1);

        bool[] point_group_mem = new bool[3] {
            true, true, false
        };
        HoudiniHost.addGroup(0, 0, HAPI_GroupType.HAPI_GROUPTYPE_POINT, "test_pt_group");
        HoudiniHost.setGroupMembership(
            0, 0, HAPI_GroupType.HAPI_GROUPTYPE_POINT, "test_pt_group", point_group_mem, 3);

        bool[] prim_group_mem = new bool[1] {
            true
        };
        HoudiniHost.addGroup(0, 0, HAPI_GroupType.HAPI_GROUPTYPE_PRIM, "test_prim_group");
        HoudiniHost.setGroupMembership(
            0, 0, HAPI_GroupType.HAPI_GROUPTYPE_PRIM, "test_prim_group", prim_group_mem, 1);

        HoudiniHost.commitGeo(0);
    }