mirror of
				https://github.com/NoelFB/blah.git
				synced 2025-11-04 01:41:34 +08:00 
			
		
		
		
	d3d11 notes and updating dummy graphics backend
This commit is contained in:
		@ -1,9 +1,7 @@
 | 
			
		||||
#ifdef BLAH_USE_D3D11
 | 
			
		||||
 | 
			
		||||
// TODO:
 | 
			
		||||
// Note the D3D11 Implementation is super WIP
 | 
			
		||||
// A bunch of rendering features aren't implemented at all
 | 
			
		||||
// and some stuff is .... ugly
 | 
			
		||||
// Note the D3D11 Implementation is still a work-in-progress
 | 
			
		||||
 | 
			
		||||
#include <blah/internal/graphics_backend.h>
 | 
			
		||||
#include <blah/internal/platform_backend.h>
 | 
			
		||||
 | 
			
		||||
@ -9,21 +9,15 @@ namespace Blah
 | 
			
		||||
	private:
 | 
			
		||||
		int m_width;
 | 
			
		||||
		int m_height;
 | 
			
		||||
		TextureFilter m_filter;
 | 
			
		||||
		TextureWrap m_wrap_x;
 | 
			
		||||
		TextureWrap m_wrap_y;
 | 
			
		||||
		TextureFormat m_format;
 | 
			
		||||
		bool m_framebuffer;
 | 
			
		||||
 | 
			
		||||
	public:
 | 
			
		||||
 | 
			
		||||
		Dummy_Texture(int width, int height, TextureFilter filter, TextureWrap wrap_x, TextureWrap wrap_y, TextureFormat format, bool framebuffer)
 | 
			
		||||
		Dummy_Texture(int width, int height, TextureFormat format, bool framebuffer)
 | 
			
		||||
		{
 | 
			
		||||
			m_width = width;
 | 
			
		||||
			m_height = height;
 | 
			
		||||
			m_filter = filter;
 | 
			
		||||
			m_wrap_x = wrap_x;
 | 
			
		||||
			m_wrap_y = wrap_y;
 | 
			
		||||
			m_format = format;
 | 
			
		||||
			m_framebuffer = framebuffer;
 | 
			
		||||
		}
 | 
			
		||||
@ -43,32 +37,6 @@ namespace Blah
 | 
			
		||||
			return m_format;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		virtual void set_filter(TextureFilter filter) override
 | 
			
		||||
		{
 | 
			
		||||
			m_filter = filter;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		virtual TextureFilter get_filter() const override
 | 
			
		||||
		{
 | 
			
		||||
			return m_filter;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		virtual void set_wrap(TextureWrap x, TextureWrap y) override
 | 
			
		||||
		{
 | 
			
		||||
			m_wrap_x = x;
 | 
			
		||||
			m_wrap_y = y;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		virtual TextureWrap get_wrap_x() const override
 | 
			
		||||
		{
 | 
			
		||||
			return m_wrap_x;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		virtual TextureWrap get_wrap_y() const override
 | 
			
		||||
		{
 | 
			
		||||
			return m_wrap_y;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		virtual void set_data(unsigned char* data) override
 | 
			
		||||
		{
 | 
			
		||||
 | 
			
		||||
@ -98,13 +66,8 @@ namespace Blah
 | 
			
		||||
			for (int i = 0; i < attachmentCount; i++)
 | 
			
		||||
			{
 | 
			
		||||
				m_attachments.push_back(
 | 
			
		||||
					TextureRef(
 | 
			
		||||
						new Dummy_Texture(width, height,
 | 
			
		||||
							TextureFilter::Linear,
 | 
			
		||||
							TextureWrap::Repeat,
 | 
			
		||||
							TextureWrap::Repeat,
 | 
			
		||||
							attachments[i],
 | 
			
		||||
							true)));
 | 
			
		||||
					TextureRef(new Dummy_Texture(width, height, attachments[i], true))
 | 
			
		||||
				);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -168,6 +131,10 @@ namespace Blah
 | 
			
		||||
 | 
			
		||||
	class Dummy_Mesh : public Mesh
 | 
			
		||||
	{
 | 
			
		||||
	private:
 | 
			
		||||
		int64_t m_index_count = 0;
 | 
			
		||||
		int64_t m_vertex_count = 0;
 | 
			
		||||
		int64_t m_instance_count = 0;
 | 
			
		||||
	public:
 | 
			
		||||
 | 
			
		||||
		Dummy_Mesh()
 | 
			
		||||
@ -177,32 +144,32 @@ namespace Blah
 | 
			
		||||
 | 
			
		||||
		virtual void index_data(IndexFormat format, const void* indices, int64_t count) override
 | 
			
		||||
		{
 | 
			
		||||
 | 
			
		||||
			m_index_count = count;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		virtual void vertex_data(const VertexFormat& format, const void* vertices, int64_t count) override
 | 
			
		||||
		{
 | 
			
		||||
 | 
			
		||||
			m_vertex_count = count;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		virtual void instance_data(const VertexFormat& format, const void* instances, int64_t count) override
 | 
			
		||||
		{
 | 
			
		||||
 | 
			
		||||
			m_instance_count = count;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		virtual int64_t index_count() const override
 | 
			
		||||
		{
 | 
			
		||||
			return 0;
 | 
			
		||||
			return m_index_count;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		virtual int64_t vertex_count() const override
 | 
			
		||||
		{
 | 
			
		||||
			return 0;
 | 
			
		||||
			return m_vertex_count;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		virtual int64_t instance_count() const override
 | 
			
		||||
		{
 | 
			
		||||
			return 0;
 | 
			
		||||
			return m_instance_count;
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
@ -232,9 +199,9 @@ namespace Blah
 | 
			
		||||
	void GraphicsBackend::before_render() {}
 | 
			
		||||
	void GraphicsBackend::after_render() {}
 | 
			
		||||
 | 
			
		||||
	TextureRef GraphicsBackend::create_texture(int width, int height, TextureFilter filter, TextureWrap wrap_x, TextureWrap wrap_y, TextureFormat format)
 | 
			
		||||
	TextureRef GraphicsBackend::create_texture(int width, int height, TextureFormat format)
 | 
			
		||||
	{
 | 
			
		||||
		return TextureRef(new Dummy_Texture(width, height, filter, wrap_x, wrap_y, format, false));
 | 
			
		||||
		return TextureRef(new Dummy_Texture(width, height, format, false));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	FrameBufferRef GraphicsBackend::create_framebuffer(int width, int height, const TextureFormat* attachments, int attachmentCount)
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user