Add dark defaults, modular effect templates and canvas leveling
这个提交包含在:
1 父节点
ffabdca5b1
当前提交
5ca307414c
25 个文件已更改
+1702
-88
没有与搜索条件相匹配的文件
@@ -190,3 +190,75 @@ if(faceFixture.length){
|
||||
NSURL *cube=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"unsupported-clone.cube"]];
|
||||
run.record(@"clone-stamp-spatial-state-refuses-static-cube-export",![renderer exportLUT:cube uniforms:u paths:@{} spider:nil tools:doc error:&failure]&&failure);
|
||||
}
|
||||
|
||||
{
|
||||
// Sample the real final GPU pass using linear X/Y ramps and opaque alpha.
|
||||
const NSUInteger w=64,h=36;
|
||||
DYDiagnosticTile *source=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease];
|
||||
DYDiagnosticTile *destination=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease];
|
||||
Pixels grid(w*h*4);
|
||||
for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w;x++){
|
||||
NSUInteger i=(y*w+x)*4;grid[i]=(x+.5)/w;grid[i+1]=(y+.5)/h;grid[i+2]=.1;grid[i+3]=1;
|
||||
}
|
||||
[[source metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,w,h)mipmapLevel:0 withBytes:grid.data() bytesPerRow:w*8];
|
||||
DYRenderer *renderer=[[[DYRenderer alloc]init]autorelease];DYUniforms u=DYToolUniforms(@{@"type":@"lens"});
|
||||
NSMutableDictionary *doc=DYMutablePlist(DYInitialToolDocument(nil));
|
||||
const double angle=-M_PI/6,aspect=w/double(h),c=cos(angle),s=sin(angle),zoom=c-s*aspect;
|
||||
doc[@"levelRotation"]=@(angle);
|
||||
NSError *failure=nil;
|
||||
BOOL ok=[renderer renderSource:source destination:destination uniforms:u paths:@{} spider:nil tools:DYToolRenderSnapshot(doc,kCMTimeZero) colorManagement:nil hostPrimaries:kFxColorPrimaries_Rec709 error:&failure];
|
||||
Pixels corrected=read(destination,gpu);
|
||||
double worst=0,alpha=1;
|
||||
for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w;x++){
|
||||
NSUInteger i=(y*w+x)*4;
|
||||
double dx=((x+.5)/w-.5)/zoom,dy=((y+.5)/h-.5)/zoom;
|
||||
double sx=std::clamp(.5+c*dx+s*dy/aspect,.5/w,1-.5/w);
|
||||
double sy=std::clamp(.5+c*dy-s*dx*aspect,.5/h,1-.5/h);
|
||||
worst=std::max({worst,fabs(corrected[i]-sx),fabs(corrected[i+1]-sy)});
|
||||
alpha=MIN(alpha,corrected[i+3]);
|
||||
}
|
||||
run.record(@"level-metal-inverse-rotation-and-full-corner-coverage",ok&&worst<.002&&alpha==1,@{@"error":reason(failure),@"maximumError":@(worst),@"minimumAlpha":@(alpha)});
|
||||
NSURL *cube=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"unsupported-level.cube"]];
|
||||
run.record(@"level-spatial-transform-is-refused-by-cube-export",![renderer exportLUT:cube uniforms:u paths:@{} spider:nil tools:doc error:&failure]&&failure);
|
||||
}
|
||||
|
||||
{
|
||||
DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,nil);
|
||||
DYToolCanvasProbe *host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero;
|
||||
id<DYToolCanvasHostProbe> plugin=(id)[[NSClassFromString(@"DYPlugIn")alloc]initWithAPIManager:host];
|
||||
[plugin scheduleToolCanvasRegistration];
|
||||
NSData *state=nil;[plugin pluginState:&state atTime:kCMTimeZero quality:(FxQuality)0 error:&error];
|
||||
auto drain=[](){double end=NSProcessInfo.processInfo.systemUptime+.07;while(NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.002]];};drain();
|
||||
id<FxOnScreenControl_v4> osc=(id)[[NSClassFromString(@"DYToolOSC")alloc]initWithAPIManager:host];
|
||||
DYDiagnosticTile *overlay=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:640 height:400]autorelease];
|
||||
[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];
|
||||
id viewer=[(id)osc valueForKey:@"viewerControls"];
|
||||
BOOL update=NO;
|
||||
auto down=[&](double x,double y){
|
||||
NSInteger part=0;
|
||||
[osc hitTestOSCAtMousePositionX:x mousePositionY:y activePart:&part atTime:kCMTimeZero];
|
||||
[osc mouseDownAtPositionX:x positionY:y activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];return part;
|
||||
};
|
||||
auto up=[&](double x,double y,NSInteger part){[osc mouseUpAtPositionX:x positionY:y activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];};
|
||||
auto click=[&](double x,double y){NSInteger part=down(x,y);up(x,y,part);};
|
||||
auto control=[&](NSInteger part){
|
||||
for(NSDictionary *a in [viewer valueForKey:@"areas"])if([a[@"part"]integerValue]==part){
|
||||
NSRect r=[a[@"rect"]rectValue];click(NSMidX(r),400-NSMidY(r));break;
|
||||
}
|
||||
};
|
||||
auto angle=[&](){return [DYReadTools(host,kCMTimeZero).document[@"levelRotation"] doubleValue];};
|
||||
int undo=base->_undoStarts;
|
||||
control(20026);
|
||||
click(150,280);click(390,200);drain();
|
||||
run.record(@"level-osc-two-points-horizontal-one-undo",fabs(angle()+atan2(80.,240.))<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
|
||||
control(20033);drain();
|
||||
control(20032);
|
||||
NSInteger part=down(200,270);up(230,150,part);drain();
|
||||
run.record(@"level-osc-reset-and-vertical-drag-each-create-one-undo",fabs(angle()-(M_PI_2-atan2(120.,30.)))<1e-6&&base->_undoStarts==undo+3&&base->_undoEnds==undo+3);
|
||||
double previous=angle();
|
||||
click(180,200);
|
||||
BOOL handled=NO;
|
||||
[osc keyDownAtPositionX:250 positionY:225 keyPressed:27 modifiers:0 forceUpdate:&update didHandle:&handled atTime:kCMTimeZero];drain();
|
||||
run.record(@"level-osc-escape-discards-uncommitted-point",handled&&angle()==previous&&base->_undoStarts==undo+3);
|
||||
[osc release];[plugin release];drain();
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户