Skip to content

Commit

Permalink
render group view
Browse files Browse the repository at this point in the history
  • Loading branch information
Zyie committed Aug 5, 2024
1 parent 95ba7e7 commit 88cc57f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { InstructionPill } from './shared/InstructionBubble';
import type { InstructionPillProps } from './shared/InstructionBubble';
import { TilingSpriteView } from './TilingSprite';
import { CustomRenderView } from './CustomRender';
import { RenderGroupView } from './RenderGroup';

export type RenderingTextureDataState = Pick<
TextureDataState,
Expand Down Expand Up @@ -204,6 +205,7 @@ const instructionViews = {
graphics: GraphicsView,
nineSliceSprite: NineSliceSpriteView,
customRender: CustomRenderView,
'Render Group': RenderGroupView,
};

export const Instructions: React.FC = memo(() => {
Expand Down
28 changes: 28 additions & 0 deletions packages/frontend/src/pages/rendering/instructions/RenderGroup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type React from 'react';
import { memo } from 'react';
import type { BaseInstruction } from './Instructions';
import { InstructionSection } from './shared/InstructionSection';

export const RenderGroupView: React.FC<BaseInstruction> = memo(({ drawTextures, type, action }) => {
return (
<div className="flex flex-col">
<div className="items-left flex w-full flex-col justify-between gap-4">
<div>
Render groups are used to group instructions together. They can be used to optimise your scene by reducing the
amount of instruction rebuilds that need to be done.
<br />
<br />
You can learn more about render groups{' '}
<a
href="https://pixijs.com/8.x/guides/advanced/render-groups"
className="text-primary underline"
target="_blank"
>
here
</a>
</div>
<InstructionSection type={type} action={action} drawTextures={drawTextures} />
</div>
</div>
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ export interface InstructionPillProps {
export const InstructionPill: React.FC<InstructionPillProps> = memo(
({ onClick, selected, renderGroupColor, drawTextures, type, action, isDrawCall }) => {
const border = selected ? 'bg-primary' : isDrawCall ? 'border-primary' : '';
const fill = selected ? '[&_svg]:fill-primary' : '';
const text = selected ? 'text-white' : '';
return (
<div
className={cn(
fill,
`hover:bg-secondary bg-border [&_svg]:hover:fill-secondary flex cursor-pointer flex-row items-center justify-center gap-1 rounded-sm border p-1`,
`hover:bg-secondary bg-border flex cursor-pointer flex-row items-center justify-center gap-1 rounded-sm border p-1`,
'min-w-52',
border,
)}
Expand Down

0 comments on commit 88cc57f

Please sign in to comment.