OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 virtual void SetViewportInPixels(int left, | 622 virtual void SetViewportInPixels(int left, |
623 int top, | 623 int top, |
624 int width, | 624 int width, |
625 int height, | 625 int height, |
626 float min_z, | 626 float min_z, |
627 float max_z) = 0; | 627 float max_z) = 0; |
628 | 628 |
629 // Sets the client's size. Derived classes must call this on Init and Resize. | 629 // Sets the client's size. Derived classes must call this on Init and Resize. |
630 void SetClientSize(int width, int height); | 630 void SetClientSize(int width, int height); |
631 | 631 |
632 // The current render surfaces. NULL = no surface. | 632 // Calls any registered lost resources callback. |
633 const RenderSurface* current_render_surface_; | 633 void CallLostResourcesCallback() const { |
634 const RenderDepthStencilSurface* current_depth_surface_; | 634 lost_resources_callback_manager_.Run(); |
635 bool current_render_surface_is_back_buffer_; | 635 } |
636 | |
637 Sampler::Ref error_sampler_; // sampler used when one is missing. | |
638 Texture::Ref error_texture_; // texture used when one is missing. | |
639 Texture::Ref fallback_error_texture_; // texture used when error_texture is | |
640 // null. | |
641 ParamObject::Ref error_object_; // holds params used for missing textures. | |
642 ParamSampler::Ref error_param_sampler_; // A Param for the error sampler. | |
643 | |
644 // Map of State Handlers. | |
645 StateHandlerMap state_handler_map_; | |
646 | |
647 // Stack of state params | |
648 ParamVectorArray state_param_stacks_; | |
649 | |
650 // Stack of state objects. | |
651 StateArray state_stack_; | |
652 | |
653 // State object holding the default state settings. | |
654 State::Ref default_state_; | |
655 | |
656 // A State object holding the settings required to be able to clear the | |
657 // back buffer. | |
658 State::Ref clear_back_buffer_state_; | |
659 | |
660 // Lost Resources Callbacks. | |
661 LostResourcesCallbackManager lost_resources_callback_manager_; | |
662 | 636 |
663 int dest_x_offset() const { | 637 int dest_x_offset() const { |
664 return dest_x_offset_; | 638 return dest_x_offset_; |
665 } | 639 } |
666 | 640 |
667 int dest_y_offset() const { | 641 int dest_y_offset() const { |
668 return dest_y_offset_; | 642 return dest_y_offset_; |
669 } | 643 } |
670 | 644 |
671 Features* features() const { | 645 Features* features() const { |
(...skipping 14 matching lines...) Expand all Loading... |
686 void ClearBackBufferIfNotCleared() { | 660 void ClearBackBufferIfNotCleared() { |
687 if (!back_buffer_cleared_ && current_render_surface_is_back_buffer_) { | 661 if (!back_buffer_cleared_ && current_render_surface_is_back_buffer_) { |
688 ClearBackBuffer(); | 662 ClearBackBuffer(); |
689 } | 663 } |
690 } | 664 } |
691 | 665 |
692 ServiceLocator* service_locator_; | 666 ServiceLocator* service_locator_; |
693 ServiceImplementation<Renderer> service_; | 667 ServiceImplementation<Renderer> service_; |
694 ServiceDependency<Features> features_; | 668 ServiceDependency<Features> features_; |
695 | 669 |
| 670 // The current render surfaces. NULL = no surface. |
| 671 const RenderSurface* current_render_surface_; |
| 672 const RenderDepthStencilSurface* current_depth_surface_; |
| 673 bool current_render_surface_is_back_buffer_; |
| 674 |
| 675 Sampler::Ref error_sampler_; // sampler used when one is missing. |
| 676 Texture::Ref error_texture_; // texture used when one is missing. |
| 677 Texture::Ref fallback_error_texture_; // texture used when error_texture is |
| 678 // null. |
| 679 ParamObject::Ref error_object_; // holds params used for missing textures. |
| 680 ParamSampler::Ref error_param_sampler_; // A Param for the error sampler. |
| 681 |
| 682 // Map of State Handlers. |
| 683 StateHandlerMap state_handler_map_; |
| 684 |
| 685 // Stack of state params |
| 686 ParamVectorArray state_param_stacks_; |
| 687 |
| 688 // Stack of state objects. |
| 689 StateArray state_stack_; |
| 690 |
| 691 // State object holding the default state settings. |
| 692 State::Ref default_state_; |
| 693 |
| 694 // A State object holding the settings required to be able to clear the |
| 695 // back buffer. |
| 696 State::Ref clear_back_buffer_state_; |
| 697 |
| 698 // Lost Resources Callbacks. |
| 699 LostResourcesCallbackManager lost_resources_callback_manager_; |
| 700 |
696 // Current viewport setting. | 701 // Current viewport setting. |
697 Float4 viewport_; | 702 Float4 viewport_; |
698 | 703 |
699 // Current depth range. | 704 // Current depth range. |
700 Float2 depth_range_; | 705 Float2 depth_range_; |
701 | 706 |
702 // Current write mask. | 707 // Current write mask. |
703 int write_mask_; | 708 int write_mask_; |
704 | 709 |
705 int render_frame_count_; // count of times we've rendered frame. | 710 int render_frame_count_; // count of times we've rendered frame. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 747 |
743 // Whether the backbuffer has been cleared this frame. | 748 // Whether the backbuffer has been cleared this frame. |
744 bool back_buffer_cleared_; | 749 bool back_buffer_cleared_; |
745 | 750 |
746 DISALLOW_COPY_AND_ASSIGN(Renderer); | 751 DISALLOW_COPY_AND_ASSIGN(Renderer); |
747 }; | 752 }; |
748 | 753 |
749 } // namespace o3d | 754 } // namespace o3d |
750 | 755 |
751 #endif // O3D_CORE_CROSS_RENDERER_H_ | 756 #endif // O3D_CORE_CROSS_RENDERER_H_ |
OLD | NEW |