Ignore:
Timestamp:
08/25/14 02:43:30 (11 years ago)
Author:
epyon
Message:
  • updated all tests to new nova
  • cleaned up tests paths
  • general cleanup of tests and test data
Location:
trunk/tests/cachebuf_test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/cachebuf_test/cachebuf_test.lua

    r102 r321  
    33        files { "nv_cachebuf_test.cc" }
    44        includedirs { "../../" }
    5         targetname "nv_gui_test"
    6         links { "nv" }
     5        links { "nv-core", "nv-gl", "nv-gfx" }
     6        targetdir "../../bin"
     7        targetname "nv_cachebuf_test"
    78 
  • trunk/tests/cachebuf_test/nv_cachebuf_test.cc

    r319 r321  
    55#include <nv/core/logging.hh>
    66#include <nv/core/logger.hh>
    7 #include <glm/glm.hpp>
    8 #include <glm/gtc/matrix_transform.hpp>
    9 #include <glm/gtc/type_ptr.hpp>
    107#include <nv/core/string.hh>
    11 #include <cstdlib> // rand
    12 #include <ctime> // time
    13 
     8#include <nv/core/random.hh>
    149#include <nv/gfx/sliced_buffer.hh>
    1510
     
    259254                nv::buffer buffer = m_quad_cache->get_vertex_buffer();
    260255                #else
    261                 m_quad_cache = new gcache( m_context, nv::DYNAMIC_DRAW, 20, true );
     256                m_quad_cache = new gcache( m_context, nv::VERTEX_BUFFER, nv::DYNAMIC_DRAW, 20 );
    262257                nv::buffer buffer = m_quad_cache->get_buffer();
    263258                #endif
     
    286281                        m_context->set_index_buffer( m_va, m_quad_cache->get_index_buffer(), nv::USHORT, false );
    287282                        nv::buffer buffer = m_quad_cache->get_vertex_buffer();
     283                        m_context->replace_vertex_buffer( m_va, buffer, nv::slot::POSITION, false );
    288284                        #else
    289285                        nv::buffer buffer = m_quad_cache->get_buffer();
     286                        m_context->replace_vertex_buffer( m_va, buffer, false );
    290287                        #endif
    291288                }
    292289
    293290                m_window->get_context()->clear( m_clear_state );
    294 //              m_program->set_uniform( "tex", 0 );
    295291                #ifdef INDEXED_TEST
    296292                size_t draw_size = m_quad_cache->get_index_size();
     
    330326void application::spawn_window()
    331327{
    332         glm::ivec2 a( std::rand() % 600, std::rand() % 400 );
    333         glm::ivec2 b( std::rand() % 200, std::rand() % 200 );
     328        glm::ivec2 a = nv::random::get().range( nv::ivec2(), nv::ivec2( 600, 400 ) );
     329        glm::ivec2 b = nv::random::get().range( nv::ivec2(), nv::ivec2( 200, 200 ) );
    334330        NV_LOG( nv::LOG_INFO, "Spawn (" << a.x << "," << a.y << "x" << b.x << "," << b.y << ")" );
    335331        m_windows.emplace_back( m_quad_cache, a, a + b, glm::vec4( 0, 0, 1, 1 ) );
     
    339335{
    340336        if ( m_windows.size() == 0 ) return;
    341         size_t index = rand() % m_windows.size();
     337        size_t index = nv::random::get().urand( m_windows.size() );
    342338        m_windows.erase( m_windows.begin() + index );
    343339}
     
    346342{
    347343        if ( m_windows.size() == 0 ) return;
    348         size_t index = rand() % m_windows.size();
     344        size_t index = nv::random::get().urand( m_windows.size() );
    349345        m_windows[ index ].change_color( nv::vec4( (float)rand() / float(RAND_MAX), (float)rand() / float(RAND_MAX), (float)rand() / float(RAND_MAX), 1.0 ) );
    350346}
     
    353349{
    354350        if ( m_windows.size() == 0 ) return;
    355         size_t index = rand() % m_windows.size();
     351        size_t index = nv::random::get().urand( m_windows.size() );
    356352        NV_LOG( nv::LOG_INFO, "Simplify " << index );
    357353        m_windows[ index ].simplify_toggle();
     
    372368int main(int, char* [])
    373369{
    374         std::srand((unsigned int) std::time(0) );
     370        nv::random::get().randomize();
    375371        nv::logger log(nv::LOG_TRACE);
    376372        log.add_sink( new nv::log_file_sink("log.txt"), nv::LOG_TRACE );
  • trunk/tests/cachebuf_test/premake4.lua

    r102 r321  
    55        flags { "ExtraWarnings", "NoPCH" }
    66
    7         configuration "gmake"   
    8                 buildoptions "-std=c++11"
    9 
    107        configuration "debug"
    118                defines { "DEBUG" }
    129                flags { "Symbols", "StaticRuntime" }
    13                 objdir (_ACTION.."/debug")
     10                objdir ("../../".._ACTION.."/debug")
    1411
    1512        configuration "release"
    1613                defines { "NDEBUG" }
    1714                flags { "Optimize", "StaticRuntime" }
    18                 objdir (_ACTION.."/release")
     15                objdir ("../../".._ACTION.."/release")
    1916
    2017        dofile("cachebuf_test.lua")
    2118        dofile("../../nv.lua")
    2219
    23 if _ACTION == "clean" then
    24         for action in premake.action.each() do
    25                 os.rmdir(action.trigger)
    26         end
    27 end
Note: See TracChangeset for help on using the changeset viewer.