Plugin Directory

Changeset 1603468


Ignore:
Timestamp:
02/25/2017 02:11:20 PM (9 years ago)
Author:
andywar65
Message:

commit version 2.2.1

Location:
bim-ba/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • bim-ba/trunk/bim-ba.php

    r1601749 r1603468  
    44Plugin URI: http://www.andywar.net/wordpress-plugins/bim-ba/
    55Description: A very basic Building Information Modeling
    6 Version: 2.2.0
     6Version: 2.2.1
    77Author: andywar65
    88Author URI: http://www.andywar.net/
     
    5454*/
    5555
    56 define('BIMBA_PLUGIN_VERSION', '2.2.0');
     56define('BIMBA_PLUGIN_VERSION', '2.2.1');
    5757define('BIMBA_PLUGIN_SLUG', 'bim-ba');
    5858
  • bim-ba/trunk/lib/3d-ambient-metabox.php

    r1601749 r1603468  
    124124            'id'   => 'ceiling_image',
    125125            'type' => 'file',
     126    ) );
     127    $cmb_group->add_group_field( $group_field_id, array(
     128            'name'        => esc_html__( 'Render Children', 'bim-ba' ),
     129            'description' => esc_html__( 'Check children 3D Ambients to be rendered with this one', 'bim-ba' ),
     130            'id'          => 'render_children',
     131            'type'        => 'multicheck',
     132            //'show_option_none' => true,
     133            'options_cb' => 'bimba_get_children_options',
    126134    ) );
    127135    $cmb_group->add_group_field( $group_field_id, array(
     
    377385    */
    378386    $cmb_group->add_group_field( $group_field_id, array(
     387            'name'       => esc_html__( 'Object', 'bim-ba' ),
     388            'description' => esc_html__( '(P) means that object is parametric', 'bim-ba' ),
     389            'id'         => 'type',
     390            'type'      => 'select',
     391            'show_option_none' => true,
     392            'options'          => array(
     393                    '3'     => esc_html__( 'Module (P)', 'bim-ba' ),
     394                    '8'     => esc_html__( 'Cylinder (P)', 'bim-ba' ),
     395                    '1' => esc_html__( 'Bed (P)', 'bim-ba' ),
     396                    '2'   => esc_html__( 'Table & Chair (P)', 'bim-ba' ),
     397                    //'4'     => esc_html__( 'Sideboard Bontempi', 'bim-ba' ),//dismissed items
     398                    //'5'     => esc_html__( 'Cupboard', 'bim-ba' ),
     399                    '6'     => esc_html__( 'Center Table + 4 chairs (P)', 'bim-ba' ),
     400                    '7'     => esc_html__( 'Note', 'bim-ba' ),
     401            ),
     402    ) );
     403    $cmb_group->add_group_field( $group_field_id, array(
     404            'name'        => esc_html__( 'Module Width', 'bim-ba' ),
     405            'description' => esc_html__( 'In centimeters (only for Modules)', 'bim-ba' ),
     406            'id'          => 'module_width',
     407            'type'        => 'text_number',
     408            'attributes' => array(
     409                    'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
     410                    'data-conditional-value' => wp_json_encode( array( '3' ) ),
     411            ),
     412    ) );
     413    $cmb_group->add_group_field( $group_field_id, array(
     414            'name'        => esc_html__( 'Parametric Width', 'bim-ba' ),
     415            'description' => esc_html__( 'Width of parametric objects. In case of Module, if null it will cover all wall length. In centimeters', 'bim-ba' ),
     416            'id'          => 'width',
     417            'type'        => 'text_number',
     418            'attributes' => array(
     419                    'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
     420                    'data-conditional-value' => wp_json_encode( array( '1', '2', '3', '6', '8' ) ),
     421            ),
     422    ) );
     423    $cmb_group->add_group_field( $group_field_id, array(
     424            'name'        => esc_html__( 'Parametric Height', 'bim-ba' ),
     425            'description' => esc_html__( 'Height of parametric objects. In case of Module, if null it will cover all room height. In centimeters', 'bim-ba' ),
     426            'id'          => 'height',
     427            'type'        => 'text_number',
     428            'attributes' => array(
     429                    'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
     430                    'data-conditional-value' => wp_json_encode( array( '3', '8' ) ),
     431            ),
     432    ) );
     433    $cmb_group->add_group_field( $group_field_id, array(
     434            'name'        => esc_html__( 'Parametric Depth', 'bim-ba' ),
     435            'description' => esc_html__( 'Depth of parametric objects. In centimeters', 'bim-ba' ),
     436            'id'          => 'depth',
     437            'type'        => 'text_number',
     438            'attributes' => array(
     439                    'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
     440                    'data-conditional-value' => wp_json_encode( array( '1', '2', '3', '6', '8' ) ),
     441            ),
     442    ) );
     443    $cmb_group->add_group_field( $group_field_id, array(
     444            'name'        => esc_html__( 'Color', 'bim-ba' ),
     445            //'description' => esc_html__( 'In centimeters', 'bim-ba' ),
     446            'id'          => 'color',
     447            'type'        => 'colorpicker',
     448            'attributes' => array(
     449                    'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
     450                    'data-conditional-value' => wp_json_encode( array( '1', '2', '3', '6', '8' ) ),
     451            ),
     452    ) );
     453    $cmb_group->add_group_field( $group_field_id, array(
     454            'name'        => esc_html__( 'Text', 'bim-ba' ),
     455            'description' => esc_html__( 'WARNING: problems with accents', 'bim-ba' ),
     456            'id'          => 'text',
     457            'type'        => 'text',
     458            //'attributes' => array(
     459                    //'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
     460                    //'data-conditional-value' => wp_json_encode( array( '1', '3', '7' ) ),
     461            //),
     462    ) );
     463    $cmb_group->add_group_field( $group_field_id, array(
    379464            'name'        => esc_html__( 'Wall ID', 'bim-ba' ),
    380465            'description' => esc_html__( 'Wall you want to relate the object to', 'bim-ba' ),
     
    382467            'type'        => 'text_number',
    383468    ) );
    384     $cmb_group->add_group_field( $group_field_id, array(
    385             'name'       => esc_html__( 'Object', 'bim-ba' ),
    386             'id'         => 'type',
    387             'type'      => 'select',
    388             'show_option_none' => true,
    389             'options'          => array(
    390                     '1' => esc_html__( 'Bed', 'bim-ba' ),
    391                     '2'   => esc_html__( 'Table & Chair', 'bim-ba' ),
    392                     '3'     => esc_html__( 'Module', 'bim-ba' ),
    393                     '4'     => esc_html__( 'Sideboard', 'bim-ba' ),
    394                     '5'     => esc_html__( 'Cupboard', 'bim-ba' ),
    395                     '6'     => esc_html__( 'Center Table + 4 chairs', 'bim-ba' ),
    396                     '7'     => esc_html__( 'Note', 'bim-ba' ),
    397             ),
    398     ) );
     469   
    399470    $cmb_group->add_group_field( $group_field_id, array(
    400471            'name'        => esc_html__( 'Offset', 'bim-ba' ),
     
    402473            'id'          => 'offset',
    403474            'type'        => 'text_number_neg',
    404             'attributes' => array(
    405                     'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
    406                     'data-conditional-value' => wp_json_encode( array( '1', '2', '3' ) ),
    407             ),
    408475    ) );
    409476    $cmb_group->add_group_field( $group_field_id, array(
     
    412479            'id'          => 'distance',
    413480            'type'        => 'text_number',
    414             'attributes' => array(
    415                     'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
    416                     'data-conditional-value' => wp_json_encode( array( '1', '2', '3' ) ),
    417             ),
    418481    ) );
    419482    $cmb_group->add_group_field( $group_field_id, array(
     
    424487            'attributes' => array(
    425488                    'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
    426                     'data-conditional-value' => wp_json_encode( array( '3', '7' ) ),
    427             ),
    428     ) );
    429     $cmb_group->add_group_field( $group_field_id, array(
    430             'name'        => esc_html__( 'Module Width', 'bim-ba' ),
    431             'description' => esc_html__( 'In centimeters', 'bim-ba' ),
    432             'id'          => 'module_width',
    433             'type'        => 'text_number',
    434             'attributes' => array(
    435                     'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
    436                     'data-conditional-value' => wp_json_encode( array( '3' ) ),
    437             ),
    438     ) );
    439     $cmb_group->add_group_field( $group_field_id, array(
    440             'name'        => esc_html__( 'Total Width', 'bim-ba' ),
    441             'description' => esc_html__( 'Width of module array. If null it will cover all wall length. In centimeters', 'bim-ba' ),
    442             'id'          => 'width',
    443             'type'        => 'text_number',
    444             'attributes' => array(
    445                     'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
    446                     'data-conditional-value' => wp_json_encode( array( '3' ) ),
    447             ),
    448     ) );
    449     $cmb_group->add_group_field( $group_field_id, array(
    450             'name'        => esc_html__( 'Module Height', 'bim-ba' ),
    451             'description' => esc_html__( 'In centimeters', 'bim-ba' ),
    452             'id'          => 'height',
    453             'type'        => 'text_number',
    454             'attributes' => array(
    455                     'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
    456                     'data-conditional-value' => wp_json_encode( array( '3' ) ),
    457             ),
    458     ) );
    459     $cmb_group->add_group_field( $group_field_id, array(
    460             'name'        => esc_html__( 'Module Depth', 'bim-ba' ),
    461             'description' => esc_html__( 'In centimeters', 'bim-ba' ),
    462             'id'          => 'depth',
    463             'type'        => 'text_number',
    464             'attributes' => array(
    465                     'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
    466                     'data-conditional-value' => wp_json_encode( array( '3' ) ),
    467             ),
    468     ) );
    469     $cmb_group->add_group_field( $group_field_id, array(
    470             'name'        => esc_html__( 'Module Color', 'bim-ba' ),
    471             //'description' => esc_html__( 'In centimeters', 'bim-ba' ),
    472             'id'          => 'color',
    473             'type'        => 'colorpicker',
    474             'attributes' => array(
    475                     'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
    476                     'data-conditional-value' => wp_json_encode( array( '3' ) ),
    477             ),
    478     ) );
    479     $cmb_group->add_group_field( $group_field_id, array(
    480             'name'        => esc_html__( 'Note Text', 'bim-ba' ),
    481             'description' => esc_html__( 'WARNING: problems with è, é, ò, à, ù...', 'bim-ba' ),
    482             'id'          => 'text',
    483             'type'        => 'text',
    484             'attributes' => array(
    485                     'data-conditional-id'    => wp_json_encode( array( $group_field_id, 'type' ) ),
    486                     'data-conditional-value' => wp_json_encode( array( '7' ) ),
    487             ),
    488     ) );
     489                    'data-conditional-value' => wp_json_encode( array( '3', '7', '8' ) ),
     490            ),
     491    ) );
     492   
    489493   
    490494}
     
    634638}
    635639
     640function bimba_get_children_options() {
     641    global $post;
     642    $args = array(
     643            'post_parent' => $post->ID,
     644            'post_type'   => 'bimba_3d_ambient',
     645            'numberposts' => -1,
     646    );
     647   
     648    $children = get_children( $args );//get eventual children
     649   
     650    $post_options = array();
     651    if ( $children ) {
     652        foreach ( $children as $child ) {
     653            $post_options[ $child->ID ] = $child->post_title;
     654        }
     655    }
     656   
     657    return $post_options;
     658}
     659
    636660/**
    637661 * Gives function bimba_get_material_options() an argument
  • bim-ba/trunk/lib/3d-ambient.php

    r1601749 r1603468  
    2828        $content .= bimba_3d_ambient_register_assets( $id, $room_name, $walls, $room_set );
    2929       
    30         $args = array(
    31             'post_parent' => $id,
    32             'post_type'   => 'bimba_3d_ambient',
    33             'numberposts' => -1,
    34         );
    35        
    36         $children = get_children( $args );//get eventual children
     30        //$args = array(
     31            //'post_parent' => $id,
     32            //'post_type'   => 'bimba_3d_ambient',
     33            //'numberposts' => -1,
     34        //);
     35       
     36        //$children = get_children( $args );//get eventual children
     37        $children = $room_set [0] ['render_children'];//eventual children to be rendered
    3738       
    3839        if ( $children ) {
    3940            foreach ($children as $child ){
    4041               
    41                 $child_room_name = basename( get_permalink( $child->ID ) );//for naming ids
    42                
    43                 $child_room_set = get_post_meta( $child->ID, '_3d_ambient_general_settings', true );//all the child room general settings
    44                
    45                 $child_walls = get_post_meta( $child->ID, '_3d_ambient_group_walls', true );//all the child wall general settings
    46                
    47                 $content .= bimba_3d_ambient_register_assets( $child->ID, $child_room_name, $child_walls , $child_room_set );
     42                $child_room_name = basename( get_permalink( $child ) );//for naming ids
     43               
     44                $child_room_set = get_post_meta( $child, '_3d_ambient_general_settings', true );//all the child room general settings
     45               
     46                $child_walls = get_post_meta( $child, '_3d_ambient_group_walls', true );//all the child wall general settings
     47               
     48                $content .= bimba_3d_ambient_register_assets( $child, $child_room_name, $child_walls , $child_room_set );
    4849               
    4950            }
     
    8990            foreach ($children as $child ){
    9091       
    91                 $child_room_name = basename( get_permalink( $child->ID ) );//for naming ids
    92                
    93                 $child_room_set = get_post_meta( $child->ID, '_3d_ambient_general_settings', true );//all the child room general settings
    94        
    95                 $child_walls = get_post_meta( $child->ID, '_3d_ambient_group_walls', true );
    96        
    97                 $child_coords = bimba_3d_ambient_extract_polygon_coords( $child_walls, $child->ID );
     92                $child_room_name = basename( get_permalink( $child ) );//for naming ids
     93               
     94                $child_room_set = get_post_meta( $child, '_3d_ambient_general_settings', true );//all the child room general settings
     95       
     96                $child_walls = get_post_meta( $child, '_3d_ambient_group_walls', true );
     97       
     98                $child_coords = bimba_3d_ambient_extract_polygon_coords( $child_walls, $child );
    9899               
    99100                $child_centers = bimba_3d_ambient_extract_wall_centers( $child_coords );
     
    103104                $child_floor_dim = bimba_3d_ambient_extract_floor_dimensions( $child_centers );
    104105               
    105                 $content .= bimba_3d_ambient_render_room( $child->ID, $child_room_name, $child_floor_area, $child_floor_dim, $child_walls, $child_centers, '1', $parent_coord , $child_room_set );
     106                $content .= bimba_3d_ambient_render_room( $child, $child_room_name, $child_floor_area, $child_floor_dim, $child_walls, $child_centers, '1', $parent_coord , $child_room_set );
    106107       
    107108            }
     
    127128            foreach ($children as $child ){
    128129               
    129                 $content .= bimba_3d_ambient_display_data( $child->ID );
    130                
    131                 $total_data = bimba_sum_arrays($total_data, get_post_meta( $child->ID, '_3d_ambient_data', true ));
     130                $content .= bimba_3d_ambient_display_data( $child );
     131               
     132                $total_data = bimba_sum_arrays($total_data, get_post_meta( $child, '_3d_ambient_data', true ));
    132133            }
    133134            $content .= bimba_3d_ambient_display_total_data( $total_data );
     
    613614                                //upper part
    614615                                $tiling_wall_height = $tiling_height;
    615                                 $wall_height = $op_height;
     616                                $wall_height = $op_height - $sill_height;
    616617                                $wall_y = ( $op_height - $sill_height ) / 2 + $sill_height;
    617618                                if ( $tiling_wall_height ) {
    618                                     if ( $tiling_wall_height > $wall_height ) {
    619                                         $tiling_wall_height = $wall_height;
     619                                    if ( $tiling_wall_height > $op_height ) {
     620                                        $tiling_wall_height = $op_height;
    620621                                    }
    621622                                    if ( $tiling_wall_height > $sill_height ) {
     
    624625                                        $return .= bimba_plane_entity_render( 'tiling', $room_name, ( $j . '-li' ) , $wall_depth, ( $tiling_wall_height - $sill_height ),
    625626                                                - $wall_length / 2 + $op_offset , ( $tiling_wall_height - $sill_height ) / 2 + $sill_height, - $wall_depth / 2, '0', '90', '0', $tiling_render );
    626                                     } else {
    627                                         $wall_height = $op_height - $sill_height;
    628                                     }
     627                                    }
    629628                                }
    630629                                $return .= bimba_plane_entity_render( 'wall', $room_name, ( $j . '-li' ) , $wall_depth , $wall_height ,
     
    678677                                //upper part
    679678                                $tiling_wall_height = $tiling_height;
    680                                 $wall_height = $op_height;
     679                                $wall_height = $op_height - $sill_height;
    681680                                $wall_y = ( $op_height - $sill_height ) / 2 + $sill_height;
    682681                                if ( $tiling_wall_height ) {
    683                                     if ( $tiling_wall_height > $wall_height ) {
    684                                         $tiling_wall_height = $wall_height;
     682                                    if ( $tiling_wall_height > $op_height ) {
     683                                        $tiling_wall_height = $op_height;
    685684                                    }
    686685                                    if ( $tiling_wall_height > $sill_height ) {
     
    689688                                        $return .= bimba_plane_entity_render( 'tiling', $room_name, ( $j . '-ri' ) , $wall_depth, ( $tiling_wall_height - $sill_height ),
    690689                                                $wall_length / 2 - $op_offset_right , ( $tiling_wall_height - $sill_height ) / 2 + $sill_height, - $wall_depth / 2, '0', '-90', '0', $tiling_render );
    691                                     } else {
    692                                         $wall_height = $op_height - $sill_height;
    693690                                    }
    694691                                }
     
    870867                                        <a-animation attribute="rotation" from="0 0 0" to="0 -90 0" begin="click" repeat="1" direction="alternate"></a-animation>
    871868                                        <a-entity id="'.$room_name.'-' . $op_name . '-'.$j.'" geometry="primitive: box; width: '.$op_width.'; height: '.$door_height.'; depth: 0.05"
    872                                             position="' . ( $op_width/2 ) . ' ' . $door_y . ' -0.025" material="' . $op_render . '"></a-entity></a-entity>';
     869                                            position="' . ( $op_width/2 ) . ' ' . $door_y . ' -0.025" material="' . $op_render . '; repeat:-1 1;"></a-entity></a-entity>';
    873870                                    break;
    874871                           
     
    889886                                        <a-animation attribute="rotation" from="0 0 0" to="0 90 0" begin="click" repeat="1" direction="alternate"></a-animation>
    890887                                        <a-entity id="'.$room_name.'-' . $op_name . '-r-'.$j.'" geometry="primitive: box; width: '. ($op_width / 2) .'; height: '. $door_height .'; depth: 0.05"
    891                                             position="' . ( - $op_width/4 ) . ' ' . $door_y . ' -0.025" material="' . $op_render . '"></a-entity></a-entity></a-entity>';
     888                                            position="' . ( - $op_width/4 ) . ' ' . $door_y . ' -0.025" material="' . $op_render . '; repeat:-1 1;"></a-entity></a-entity></a-entity>';
    892889                                    break;
    893890                           
     
    897894                                                to="' . ( - $wall_length / 2 + $op_offset - $op_width ) . ' 0 ' . ( -$wall_depth ) . '" begin="click" repeat="1" direction="alternate"></a-animation>
    898895                                        <a-entity id="'.$room_name.'-' . $op_name . '-'.$j.'" geometry="primitive: box; width: '.$op_width.'; height: '.$door_height.'; depth: 0.05"
    899                                             position="' . ( $op_width/2 ) . ' ' . $door_y . ' -0.05" material="' . $op_render . '"></a-entity></a-entity>';
     896                                            position="' . ( $op_width/2 ) . ' ' . $door_y . ' -0.05" material="' . $op_render . '; repeat:-1 1;"></a-entity></a-entity>';
    900897                                    break;
    901898                           
     
    917914                                                <a-animation attribute="position" from="'. $op_width .' 0 0" to="'. ($op_width * 1.5) .' 0 0" begin="click" repeat="1" direction="alternate"></a-animation>
    918915                                                <a-entity id="'.$room_name.'-' . $op_name . '-r-'.$j.'" geometry="primitive: box; width: '. ($op_width / 2) .'; height: '. $door_height .'; depth: 0.05"
    919                                                 position="' . ( - $op_width/4 ) . ' ' . $door_y . ' -0.05" material="' . $op_render . '"></a-entity></a-entity></a-entity>';
     916                                                position="' . ( - $op_width/4 ) . ' ' . $door_y . ' -0.05" material="' . $op_render . '; repeat:-1 1;"></a-entity></a-entity></a-entity>';
    920917                                    break;
    921918                            }//end switch opening animation
     
    939936                $jj = $ii + 1;
    940937                if ( $object [ 'wall-id' ] == $j ) {
    941                     $object_offset = $object ['offset'] / 100;
    942                     switch ( $object [ 'type' ] ) {
    943                        
    944                         case 0://none
    945                         break;
    946                        
    947                         case 1://bed
    948                             $object_width = 0.8/2;
    949                             if ( $object_offset == 0 ) {
    950                                 $object_offset = ( $wall_length ) / 2 - $object_width;
    951                             } elseif ( $object_offset < 0 ) {
    952                                 $object_offset = 0;
    953                             }
    954                             $return .='
    955                                     <a-entity id="' . $room_name . '-bed-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset + $object_width) . ' 0 ' . $object ['distance'] / 100 . '">';
    956                             $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.1; depth: 0.05" position="-0.375 0.05 0.025" material="color: white;"></a-entity>';
    957                             $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.1; depth: 0.05" position="0.375 0.05 0.025" material="color: white;"></a-entity>';
    958                             $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.1; depth: 0.05" position="-0.375 0.05 1.875" material="color: white;"></a-entity>';
    959                             $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.1; depth: 0.05" position="0.375 0.05 1.875" material="color: white;"></a-entity>';
    960                             $return .='<a-entity geometry="primitive: box; width: 0.8; height: 0.35; depth: 1.9" position="0 0.275 0.95" material="color: red;"></a-entity>';
    961                             $return .='<a-entity geometry="primitive: box; width: 0.7; height: 0.1; depth: 0.35" position="0 0.5 0.175" material="color: white;"></a-entity>';
    962                             $return .= '
    963                                     </a-entity>';
    964                         break;
    965                            
    966                         case 2://chair and table
    967                             $object_width = 1.5/2;
    968                             if ( $object_offset == 0 ) {
    969                                 $object_offset = ( $wall_length ) / 2 - $object_width;
    970                             } elseif ( $object_offset < 0 ) {
    971                                 $object_offset = 0;
    972                             }
    973                             $return .='
    974                                     <a-entity id="' . $room_name . '-table-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset + $object_width) . ' 0 ' . $object ['distance'] / 100 . '">';
    975                             $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.05" position="-0.725 0.35 0.025" material="color: white;"></a-entity>';
    976                             $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.05" position="0.725 0.35 0.025" material="color: white;"></a-entity>';
    977                             $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.05" position="-0.725 0.35 0.725" material="color: white;"></a-entity>';
    978                             $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.05" position="0.725 0.35 0.725" material="color: white;"></a-entity>';
    979                             $return .='<a-entity geometry="primitive: box; width: 1.5; height: 0.05; depth: 0.75" position="0 0.725 0.375" material="color: white;"></a-entity>';
    980                             $return .= '<a-entity id="' . $room_name . '-chair-' . $jj . '" position="0 0 0.75" rotation="0 0 0">';
    981                             $return .= bimba_3d_ambient_render_chair();
    982                             $return .= '</a-entity>';
    983                            
    984                             $return .= '
    985                                     </a-entity>';
    986                         break;
     938                   
     939                    $return .= bimba_3d_ambient_render_object( $object, $jj, $room_name, $wall_length, $height );
    987940                               
    988                         case 3://module
    989                             $object_module = $object ['module_width'] / 100;
    990                             if ( ! $object_module) {
    991                                 $object_module = 0.6;
    992                             }
    993                             $object_height = $object ['height'] / 100;
    994                             if ( ! $object_height OR $object_height > $height ) {
    995                                 $object_height = $height;
    996                             }
    997                             $object_depth = $object ['depth'] / 100;
    998                             if ( ! $object_depth) {
    999                                 $object_depth = 0.6;
    1000                             }
    1001                             $object_altitude = $object ['altitude'] / 100;
    1002                             if ( $object_altitude + $object_height > $height ) {
    1003                                 $object_altitude = $height - $object_height;
    1004                             }
    1005                             if ( $object ['width'] ) {
    1006                                 $object_width = intval( $object ['width'] / 100 / $object_module ) * $object_module;
    1007                             } else {
    1008                                 $object_width = intval( ( $wall_length - $object_offset ) / $object_module ) * $object_module;
    1009                             }
    1010                            
    1011                             if ( $object_width > $wall_length ) {
    1012                                 $object_width = intval( $wall_length / $object_module ) * $object_module;
    1013                             }
    1014                             if ( ( $object_width + $object_offset ) > $wall_length ) {
    1015                                 $object_offset = $wall_length - $object_width;
    1016                             }
    1017                            
    1018                             if ( $object_offset == 0 ) {
    1019                                 $object_offset = ( $wall_length - $object_width ) / 2;
    1020                             } elseif ( $object_offset < 0 ) {
    1021                                 $object_offset = 0;
    1022                             }
    1023                             $return .='
    1024                                     <a-entity id="' . $room_name . '-module-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset ) . ' 0 ' . $object ['distance'] / 100 . '">';
    1025                             for ($k = 0; $k < ( $object_width / $object_module ); $k++) {
    1026                                 $return .='<a-entity geometry="primitive: box; width: ' . ( $object_module - 0.01 ) . '; height: ' . $object_height . '; depth: ' . $object_depth . '"
    1027                                         position="' . ( $object_module / 2 + $object_module * $k ) . ' ' . ( $object_height / 2  + $object_altitude ) . ' ' . $object_depth / 2 . '" material="color: ' . $object ['color'] . ';"></a-entity>';
    1028                             }
    1029                             $return .= '
    1030                                     </a-entity>';
    1031                         break;
    1032                        
    1033                         case 4://sideboard
    1034                             $object_width = 1.8/2;
    1035                             if ( $object_offset == 0 ) {
    1036                                 $object_offset = ( $wall_length ) / 2 - $object_width;
    1037                             } elseif ( $object_offset < 0 ) {
    1038                                 $object_offset = 0;
    1039                             }
    1040                             $return .='
    1041                                     <a-entity id="' . $room_name . '-sideboard-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset + $object_width) . ' 0 ' . $object ['distance'] / 100 . '">';
    1042                             $return .='<a-entity geometry="primitive: box; width: 1.8; height: 0.52; depth: 0.52" position="0 0.46 0.26" material="color: #8b877b;"></a-entity>';
    1043                             $return .= '<a-entity id="' . $room_name . '-sideboard-' . $jj . '-label" scale="2 2 2" position="0 0.46 0.53" text="value: Bontempi Aly Glass; align: center;"></a-entity>';
    1044                             $return .= '
    1045                                     </a-entity>';
    1046                             break;
    1047                        
    1048                         case 5://cupboard
    1049                             $object_width = 1.1/2;
    1050                             if ( $object_offset == 0 ) {
    1051                                 $object_offset = ( $wall_length ) / 2 - $object_width;
    1052                             } elseif ( $object_offset < 0 ) {
    1053                                 $object_offset = 0;
    1054                             }
    1055                             $return .='
    1056                                     <a-entity id="' . $room_name . '-cupboard-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset + $object_width) . ' 0 ' . $object ['distance'] / 100 . '">';
    1057                             $return .='<a-entity geometry="primitive: box; width: 1.1; height: 1.8; depth: 0.4" position="0 0.9 0.2" material="color: #ad7c44;"></a-entity>';
    1058                             $return .= '
    1059                                     </a-entity>';
    1060                             break;
    1061                            
    1062                         case 6://center table with 4 chairs
    1063                             $object_width = 0.9/2;
    1064                             if ( $object_offset == 0 ) {
    1065                                 $object_offset = ( $wall_length ) / 2 - $object_width;
    1066                             } elseif ( $object_offset < 0 ) {
    1067                                 $object_offset = 0;
    1068                             }
    1069                             $return .='
    1070                                     <a-entity id="' . $room_name . '-center-table-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset + $object_width) . ' 0 ' . $object ['distance'] / 100 . '">';
    1071                             $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.02" position="-0.425 0.35 0.025" rotation="0 -45 0" material="color: white;"></a-entity>';//table legs
    1072                             $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.02" position="0.425 0.35 0.025" rotation="0 45 0" material="color: white;"></a-entity>';
    1073                             $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.02" position="-0.425 0.35 1.375" rotation="0 45 0" material="color: white;"></a-entity>';
    1074                             $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.02" position="0.425 0.35 1.375" rotation="0 -45 0" material="color: white;"></a-entity>';
    1075                             $return .='<a-entity geometry="primitive: box; width: 0.9; height: 0.05; depth: 1.4" position="0 0.725 0.7" material="color: #8b877b;"></a-entity>';//table plane
    1076                             $return .= '
    1077                                     <a-entity id="' . $room_name . '-chair-' . $jj . '-a" position="0 0 0" rotation="0 180 0">';
    1078                             $return .= bimba_3d_ambient_render_chair();
    1079                             $return .= '
    1080                                     </a-entity>';
    1081                             $return .= '
    1082                                     <a-entity id="' . $room_name . '-chair-' . $jj . '-b" position="0 0 1.4" rotation="0 0 0">';
    1083                             $return .= bimba_3d_ambient_render_chair();
    1084                             $return .= '
    1085                                     </a-entity>';
    1086                             $return .= '
    1087                                     <a-entity id="' . $room_name . '-chair-' . $jj . '-c" position="-0.45 0 0.7" rotation="0 270 0">';
    1088                             $return .= bimba_3d_ambient_render_chair();
    1089                             $return .= '
    1090                                     </a-entity>';
    1091                             $return .= '
    1092                                     <a-entity id="' . $room_name . '-chair-' . $jj . '-d" position="0.45 0 0.7" rotation="0 90 0">';
    1093                             $return .= bimba_3d_ambient_render_chair();
    1094                             $return .= '
    1095                                     </a-entity>';
    1096                             $return .= '
    1097                                     </a-entity>';
    1098                             break;
    1099                            
    1100                         //case 7://architect look-at component not
    1101                             //$return .= '
    1102                                     //<a-entity id="' . $room_name . '-architect-ent-' . $jj . '" position="' . $object_offset . ' 0 ' . $object ['distance'] / 100 . '" look-at="#camera-foot">
    1103                                     //<a-entity id="' . $room_name . '-architect-' . $jj . '" geometry="primitive: plane; width: 0.56; height: 1.70;" position="0 0.85 0" material="src: #bimba-architect">
    1104                                     //</a-entity></a-entity>';
    1105                         //break;
    1106                        
    1107                         case 7://note
    1108                             $return .= '
    1109                             <a-entity id="' . $room_name . '-note-ent-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset + 0.3) . ' ' . $object ['altitude'] / 100 . ' ' . $object ['distance'] / 100 . '">
    1110                             <a-entity id="' . $room_name . '-note-' . $jj . '" scale="2 2 2" geometry="primitive: plane; width: 0.3; height: auto;" position="0 0 0.01" material="color: #e7e662; side: double;"
    1111                             text="value: ' . $object ['text'] . '; color: black; align: center; width: 0.3;">
    1112                             </a-entity></a-entity>';
    1113                         break;
    1114                        
    1115                     }                   
    1116                                        
    1117941                }
    1118942                $ii ++;
     
    1147971    update_post_meta( $id, '_3d_ambient_group_walls', $walls );
    1148972   
     973    return $return;
     974}
     975
     976function bimba_3d_ambient_render_object( $object, $jj, $room_name, $wall_length, $height ) {
     977   
     978    $object_offset = $object ['offset'] / 100;
     979    switch ( $object [ 'type' ] ) {
     980   
     981        case 0://none
     982            break;
     983   
     984        case 1://bed
     985            if ( $object ['width'] ){
     986                $object_width = $object ['width'] / 200;
     987            } else {
     988                $object_width = 0.8/2;
     989            }
     990            if ( $object ['depth'] ){
     991                $object_depth = $object ['depth'] / 100;
     992            } else {
     993                $object_depth = 1.9;
     994            }
     995            if ( $object ['color'] ){
     996                $object_color = $object ['color'];
     997            } else {
     998                $object_color = 'red';
     999            }
     1000           
     1001            if ( $object_offset == 0 ) {
     1002                $object_offset = ( $wall_length ) / 2 - $object_width;
     1003            } elseif ( $object_offset < 0 ) {
     1004                $object_offset = 0;
     1005            }
     1006            $return .='
     1007                                    <a-entity id="' . $room_name . '-bed-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset + $object_width) . ' 0 ' . $object ['distance'] / 100 . '">';
     1008            $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.1; depth: 0.05" position="-' . ( $object_width - 0.025 ) . ' 0.05 0.025" material="color: white;"></a-entity>';
     1009            $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.1; depth: 0.05" position="' . ( $object_width - 0.025 ) . ' 0.05 0.025" material="color: white;"></a-entity>';
     1010            $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.1; depth: 0.05" position="-' . ( $object_width - 0.025 ) . ' 0.05 ' . ( $object_depth - 0.025 ) . '" material="color: white;"></a-entity>';
     1011            $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.1; depth: 0.05" position="' . ( $object_width - 0.025 ) . ' 0.05 ' . ( $object_depth - 0.025 ) . '" material="color: white;"></a-entity>';
     1012            $return .='<a-entity geometry="primitive: box; width: ' . ( $object_width * 2 ) . '; height: 0.35; depth: ' . $object_depth . '" position="0 0.275 ' . ( $object_depth / 2 ) . '" material="color: ' . $object_color . ';"></a-entity>';
     1013            $return .='<a-entity geometry="primitive: box; width: ' . ( $object_width * 2 - 0.1 ) . '; height: 0.1; depth: 0.35" position="0 0.5 0.175" material="color: white;"></a-entity>';
     1014            $return .= '<a-entity id="' . $room_name . '-bed-' . $jj . '-label" scale="2 2 2" position="0 0.275 ' . $object_depth . '" text="value: ' . $object ['text'] . '; align: center; color: ' . bimba_complementary_color( $object_color ) . ';"></a-entity>';
     1015            $return .= '
     1016                                    </a-entity>';
     1017            break;
     1018               
     1019        case 2://chair and table
     1020            if ( $object ['width'] ){
     1021                $object_width = $object ['width'] / 200;
     1022            } else {
     1023                $object_width = 1.5/2;
     1024            }
     1025            if ( $object ['depth'] ){
     1026                $object_depth = $object ['depth'] / 100;
     1027            } else {
     1028                $object_depth = 0.75;
     1029            }
     1030            if ( $object ['color'] ){
     1031                $object_color = $object ['color'];
     1032            } else {
     1033                $object_color = '#8b877b';
     1034            }
     1035            if ( $object_offset == 0 ) {
     1036                $object_offset = ( $wall_length ) / 2 - $object_width;
     1037            } elseif ( $object_offset < 0 ) {
     1038                $object_offset = 0;
     1039            }
     1040            $return .='
     1041                                    <a-entity id="' . $room_name . '-table-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset + $object_width) . ' 0 ' . $object ['distance'] / 100 . '">';
     1042            $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.05" position="-' . ($object_width - 0.025 ) . ' 0.35 0.025" material="color: white;"></a-entity>';
     1043            $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.05" position="' . ($object_width - 0.025 ) . ' 0.35 0.025" material="color: white;"></a-entity>';
     1044            $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.05" position="-' . ($object_width - 0.025 ) . ' 0.35 ' . ($object_depth - 0.025 ) . '" material="color: white;"></a-entity>';
     1045            $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.05" position="' . ($object_width - 0.025 ) . ' 0.35 ' . ($object_depth - 0.025 ) . '" material="color: white;"></a-entity>';
     1046            $return .='<a-entity geometry="primitive: box; width: ' . $object_width * 2 . '; height: 0.05; depth: ' . $object_depth . '" position="0 0.725 ' . ($object_depth / 2 ) . '" material="color: ' . $object_color . ';"></a-entity>';
     1047            $return .= '<a-entity id="' . $room_name . '-table-' . $jj . '-label" scale="2 2 2" position="0 0.8 ' . $object_depth / 2 . '" text="value: ' . $object ['text'] . '; align: center; color: ' . bimba_complementary_color( $object_color ) . '; side: double;"></a-entity>';
     1048            $return .= '<a-entity id="' . $room_name . '-chair-' . $jj . '" position="0 0 ' . $object_depth . '" rotation="0 0 0">';
     1049            $return .= bimba_3d_ambient_render_chair();
     1050            $return .= '</a-entity>';
     1051               
     1052            $return .= '
     1053                                    </a-entity>';
     1054            break;
     1055   
     1056        case 3://module
     1057            $object_module = $object ['module_width'] / 100;
     1058            if ( ! $object_module) {
     1059                $object_module = 0.6;
     1060            }
     1061            $object_height = $object ['height'] / 100;
     1062            if ( ! $object_height OR $object_height > $height ) {
     1063                $object_height = $height;
     1064            }
     1065            $object_depth = $object ['depth'] / 100;
     1066            if ( ! $object_depth) {
     1067                $object_depth = 0.6;
     1068            }
     1069            $object_altitude = $object ['altitude'] / 100;
     1070            if ( $object_altitude + $object_height > $height ) {
     1071                $object_altitude = $height - $object_height;
     1072            }
     1073            if ( $object ['width'] ) {
     1074                $object_width = intval( $object ['width'] / 100 / $object_module ) * $object_module;
     1075            } else {
     1076                $object_width = intval( ( $wall_length - $object_offset ) / $object_module ) * $object_module;
     1077            }
     1078               
     1079            if ( $object_width > $wall_length ) {
     1080                $object_width = intval( $wall_length / $object_module ) * $object_module;
     1081            }
     1082            if ( ( $object_width + $object_offset ) > $wall_length ) {
     1083                $object_offset = $wall_length - $object_width;
     1084            }
     1085               
     1086            if ( $object_offset == 0 ) {
     1087                $object_offset = ( $wall_length - $object_width ) / 2;
     1088            } elseif ( $object_offset < 0 ) {
     1089                $object_offset = 0;
     1090            }
     1091            $return .='
     1092                                    <a-entity id="' . $room_name . '-module-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset ) . ' 0 ' . $object ['distance'] / 100 . '">';
     1093            for ($k = 0; $k < ( $object_width / $object_module ); $k++) {
     1094                $return .='<a-entity geometry="primitive: box; width: ' . ( $object_module - 0.01 ) . '; height: ' . $object_height . '; depth: ' . $object_depth . '"
     1095                                        position="' . ( $object_module / 2 + $object_module * $k ) . ' ' . ( $object_height / 2  + $object_altitude ) . ' ' . $object_depth / 2 . '" material="color: ' . $object ['color'] . ';"></a-entity>';
     1096            }
     1097            $return .= '<a-entity id="' . $room_name . '-module-' . $jj . '-label" scale="2 2 2" position="' . $object_width / 2 . ' ' . ( $object_height / 2  + $object_altitude ) . ' ' . $object_depth . '" text="value: ' . $object ['text'] . '; align: center; color: ' . bimba_complementary_color( $object ['color'] ) . ';"></a-entity>';
     1098            $return .= '
     1099                                    </a-entity>';
     1100            break;
     1101   
     1102        case 4://sideboard (dismissed)
     1103            $object_width = 1.8/2;
     1104            if ( $object_offset == 0 ) {
     1105                $object_offset = ( $wall_length ) / 2 - $object_width;
     1106            } elseif ( $object_offset < 0 ) {
     1107                $object_offset = 0;
     1108            }
     1109            $return .='
     1110                                    <a-entity id="' . $room_name . '-sideboard-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset + $object_width) . ' 0 ' . $object ['distance'] / 100 . '">';
     1111            $return .='<a-entity geometry="primitive: box; width: 1.8; height: 0.52; depth: 0.52" position="0 0.46 0.26" material="color: #8b877b;"></a-entity>';
     1112            $return .= '<a-entity id="' . $room_name . '-sideboard-' . $jj . '-label" scale="2 2 2" position="0 0.46 0.53" text="value: Bontempi Aly Glass; align: center;"></a-entity>';
     1113            $return .= '
     1114                                    </a-entity>';
     1115            break;
     1116   
     1117        case 5://cupboard (dismissed)
     1118            $object_width = 1.1/2;
     1119            if ( $object_offset == 0 ) {
     1120                $object_offset = ( $wall_length ) / 2 - $object_width;
     1121            } elseif ( $object_offset < 0 ) {
     1122                $object_offset = 0;
     1123            }
     1124            $return .='
     1125                                    <a-entity id="' . $room_name . '-cupboard-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset + $object_width) . ' 0 ' . $object ['distance'] / 100 . '">';
     1126            $return .='<a-entity geometry="primitive: box; width: 1.1; height: 1.8; depth: 0.4" position="0 0.9 0.2" material="color: #ad7c44;"></a-entity>';
     1127            $return .= '
     1128                                    </a-entity>';
     1129            break;
     1130               
     1131        case 6://center table with 4 chairs
     1132            if ( $object ['width'] ){
     1133                $object_width = $object ['width'] / 200;
     1134            } else {
     1135                $object_width = 0.9/2;
     1136            }
     1137            if ( $object ['depth'] ){
     1138                $object_depth = $object ['depth'] / 100;
     1139            } else {
     1140                $object_depth = 1.4;
     1141            }
     1142            if ( $object ['color'] ){
     1143                $object_color = $object ['color'];
     1144            } else {
     1145                $object_color = '#8b877b';
     1146            }
     1147            if ( $object_offset == 0 ) {
     1148                $object_offset = ( $wall_length ) / 2 - $object_width;
     1149            } elseif ( $object_offset < 0 ) {
     1150                $object_offset = 0;
     1151            }
     1152           
     1153            $return .='
     1154                                    <a-entity id="' . $room_name . '-center-table-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset + $object_width) . ' 0 ' . $object ['distance'] / 100 . '">';
     1155            $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.02" position="-' . ($object_width - 0.025 ) . ' 0.35 0.025" rotation="0 -45 0" material="color: white;"></a-entity>';//table legs
     1156            $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.02" position="' . ($object_width - 0.025 ) . ' 0.35 0.025" rotation="0 45 0" material="color: white;"></a-entity>';
     1157            $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.02" position="-' . ($object_width - 0.025 ) . ' 0.35 ' . ($object_depth - 0.025 ) . '" rotation="0 45 0" material="color: white;"></a-entity>';
     1158            $return .='<a-entity geometry="primitive: box; width: 0.05; height: 0.7; depth: 0.02" position="' . ($object_width - 0.025 ) . ' 0.35 ' . ($object_depth - 0.025 ) . '" rotation="0 -45 0" material="color: white;"></a-entity>';
     1159            $return .='<a-entity geometry="primitive: box; width: ' . $object_width * 2 . '; height: 0.05; depth: ' . $object_depth . '" position="0 0.725 ' . ($object_depth / 2 ) . '" material="color: ' . $object_color . ';"></a-entity>';//table plane
     1160            $return .= '<a-entity id="' . $room_name . '-center-table-' . $jj . '-label" scale="2 2 2" position="0 0.8 ' . $object_depth / 2 . '" text="value: ' . $object ['text'] . '; align: center; color: ' . bimba_complementary_color( $object_color ) . '; side: double;"></a-entity>';
     1161            $return .= '
     1162                                    <a-entity id="' . $room_name . '-chair-' . $jj . '-a" position="0 0 0" rotation="0 180 0">';
     1163            $return .= bimba_3d_ambient_render_chair();
     1164            $return .= '
     1165                                    </a-entity>';
     1166            $return .= '
     1167                                    <a-entity id="' . $room_name . '-chair-' . $jj . '-b" position="0 0 ' . $object_depth . '" rotation="0 0 0">';
     1168            $return .= bimba_3d_ambient_render_chair();
     1169            $return .= '
     1170                                    </a-entity>';
     1171            $return .= '
     1172                                    <a-entity id="' . $room_name . '-chair-' . $jj . '-c" position="-' . $object_width . ' 0 ' . $object_depth / 2 . '" rotation="0 270 0">';
     1173            $return .= bimba_3d_ambient_render_chair();
     1174            $return .= '
     1175                                    </a-entity>';
     1176            $return .= '
     1177                                    <a-entity id="' . $room_name . '-chair-' . $jj . '-d" position="' . $object_width . ' 0 ' . $object_depth / 2 . '" rotation="0 90 0">';
     1178            $return .= bimba_3d_ambient_render_chair();
     1179            $return .= '
     1180                                    </a-entity>';
     1181            $return .= '
     1182                                    </a-entity>';
     1183            break;
     1184               
     1185            //case 7://architect look-at component not
     1186            //$return .= '
     1187            //<a-entity id="' . $room_name . '-architect-ent-' . $jj . '" position="' . $object_offset . ' 0 ' . $object ['distance'] / 100 . '" look-at="#camera-foot">
     1188            //<a-entity id="' . $room_name . '-architect-' . $jj . '" geometry="primitive: plane; width: 0.56; height: 1.70;" position="0 0.85 0" material="src: #bimba-architect">
     1189            //</a-entity></a-entity>';
     1190            //break;
     1191   
     1192        case 7://note
     1193            $return .= '
     1194                            <a-entity id="' . $room_name . '-note-ent-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset + 0.3) . ' ' . $object ['altitude'] / 100 . ' ' . $object ['distance'] / 100 . '">
     1195                            <a-entity id="' . $room_name . '-note-' . $jj . '" scale="2 2 2" geometry="primitive: plane; width: 0.3; height: auto;" position="0 0 0.01" material="color: #e7e662; side: double;"
     1196                            text="value: ' . $object ['text'] . '; color: black; align: center; width: 0.3;">
     1197                            </a-entity></a-entity>';
     1198            break;
     1199           
     1200        case 8://cylinder
     1201            $object_width = $object ['width'] / 200;
     1202            if ( ! $object_width) {
     1203                $object_width = 0.5;
     1204            }
     1205            $object_height = $object ['height'] / 100;
     1206            if ( ! $object_height OR $object_height > $height ) {
     1207                $object_height = $height;
     1208            }
     1209            $object_depth = $object ['depth'] / 200;
     1210            if ( ! $object_depth) {
     1211                $object_depth = $object_width;
     1212            }
     1213            $object_altitude = $object ['altitude'] / 100;
     1214            if ( $object_altitude + $object_height > $height ) {
     1215                $object_altitude = $height - $object_height;
     1216            }
     1217            if ( $object ['color'] ){
     1218                $object_color = $object ['color'];
     1219            } else {
     1220                $object_color = '#ffffff';
     1221            }
     1222            if ( $object_offset == 0 ) {
     1223                $object_offset = ( $wall_length ) / 2 - $object_width;
     1224            } elseif ( $object_offset < 0 ) {
     1225                $object_offset = 0;
     1226            }
     1227            $return .='
     1228                                    <a-entity id="' . $room_name . '-cylinder-ent-' . $jj . '" position="' . ( - $wall_length / 2 + $object_offset + $object_width) . ' 0 ' . $object ['distance'] / 100 . '">';
     1229            $return .='<a-entity id="' . $room_name . '-cylinder-' . $jj . '" geometry="primitive: cylinder; radius: ' . $object_width . '; height: ' . $object_height . ';"
     1230                    position="0 ' . ( $object_height/2 + $object_altitude ) . ' ' . $object_depth . '" material="color: ' . $object_color . ';" scale="1 1 ' . $object_depth / $object_width . '"></a-entity>';
     1231            $return .= '
     1232                                    </a-entity>';
     1233        break;
     1234   
     1235    }//end object switch
    11491236    return $return;
    11501237}
     
    13481435    }
    13491436    return $array;
     1437}
     1438
     1439function bimba_complementary_color( $color ){
     1440    // $hexcode is the six digit hex colour code we want to convert
     1441
     1442    $color = str_replace('#', '', $color);
     1443    if (strlen($color) != 6){ return '#000000'; }
     1444    $rgb = '';
     1445    for ($x=0;$x<3;$x++){
     1446        //$c = 255 - hexdec(substr($color,(2*$x),2));
     1447        //$c = ($c < 0) ? 0 : dechex($c);
     1448        //$rgb .= (strlen($c) < 2) ? '0'.$c : $c;
     1449        $c = hexdec(substr($color,(2*$x),2));
     1450        $rgb .= ($c > 127) ? '00' : 'ff';
     1451    }
     1452    return '#'.$rgb;
     1453   
    13501454}
    13511455
  • bim-ba/trunk/readme.txt

    r1601749 r1603468  
    55Requires at least: 4.1
    66Tested up to: 4.7.2
    7 Stable tag: 2.2.0
     7Stable tag: 2.2.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7474== Changelog ==
    7575
     76= 2.2.1 =
     77* Small fix in window rendering.
     78* Objects are parametric. Cylinder object added.
     79* You can choose what child to render along with parent.
     80
    7681= 2.2.0 =
    7782* A-Frame library 0.5.0 with text integration!
     
    110115== Upgrade Notice ==
    111116
     117= 2.2.1 =
     118* Small fix in window rendering.
     119
    112120= 2.2.0 =
    113121* New A-Frame library and overall improvements.
     
    132140
    133141= 1.0 =
    134 * No upgrades available.
     142* First release.
Note: See TracChangeset for help on using the changeset viewer.